This commit was manufactured by cvs2svn to create tag 'v_357b'.
Sprout from master 2003-06-05 19:58:33 UTC Philipe Mulet <pmulet> '37274'
Cherrypick from master 2003-06-18 16:50:18 UTC Philipe Mulet <pmulet> '*** empty log message ***':
org.eclipse.jdt.core/buildnotes_jdt-core.html
org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
Cherrypick from master 2003-06-18 16:52:00 UTC Philipe Mulet <pmulet> '*** empty log message ***':
org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
Delete:
org.eclipse.jdt.core.tests.builder/.classpath
org.eclipse.jdt.core.tests.builder/.cvsignore
org.eclipse.jdt.core.tests.builder/.project
org.eclipse.jdt.core.tests.builder/about.html
org.eclipse.jdt.core.tests.builder/build.properties
org.eclipse.jdt.core.tests.builder/plugin.xml
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Assert.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AssertionFailedException.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ClasspathTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompilationUnitLocationTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FilteredTestSuite.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/JCLTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java
org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Tests.java
org.eclipse.jdt.core.tests.builder/test.xml
org.eclipse.jdt.core.tests.compiler/.classpath
org.eclipse.jdt.core.tests.compiler/.cvsignore
org.eclipse.jdt.core.tests.compiler/.project
org.eclipse.jdt.core.tests.compiler/about.html
org.eclipse.jdt.core.tests.compiler/build.properties
org.eclipse.jdt.core.tests.compiler/plugin.xml
org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTestKeyword.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/InnerTypeCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LabelStatementCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest2.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SingleCompletionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceImport.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourcePackage.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileComparatorTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExpectedProblem.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LogRequestor.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeVariableTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationContext.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationResult.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleCodeSnippetTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleVariableTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/VariableTest.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/IDEInterface.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/ExcludedTestSuite.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/StopableTestCase.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestListener.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestResult.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VMLauncher.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/RuntimeConstants.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetException.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/SocketHelper.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java
org.eclipse.jdt.core.tests.compiler/test.xml
org.eclipse.jdt.core.tests.model/.classpath
org.eclipse.jdt.core.tests.model/.cvsignore
org.eclipse.jdt.core.tests.model/.project
org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip
org.eclipse.jdt.core.tests.model/JCL/jclMin.jar
org.eclipse.jdt.core.tests.model/JCL/jclMinsrc.zip
org.eclipse.jdt.core.tests.model/about.html
org.eclipse.jdt.core.tests.model/build.properties
org.eclipse.jdt.core.tests.model/plugin.xml
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTNodesCollectorVisitor.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTVisitorTest.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BindingsCollectorVisitor.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunAllTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/BufferTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTestsRequestor.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ContainerInitializer.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/EncodingTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExclusionPatternsTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExistenceTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalJarDeltaTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/FactoryTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/HierarchyOnWorkingCopiesTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RootManipulationsTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Semaphore.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SignatureTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SuiteOfTestCases.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TestProgressMonitor.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchySerializationTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/VariablesInitializer.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyNotInClasspathTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopySearchTests.java
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyTests.java
org.eclipse.jdt.core.tests.model/test.xml
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.project
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach.jar
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2.jar
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2src.zip
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.new.zip
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.zip
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/full.jar
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/fullsrc.zip
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/lib/p/X.class
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/src.zip
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/srcLib/p/X.java
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test.jar
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test2.jar
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4.jar
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4_src.zip
org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/update.jar
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.classpath
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.project
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/lib.jar
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/libSrc.zip
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectArgument1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType3.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport3.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariable1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass2.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface1.java
org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/.classpath
org.eclipse.jdt.core.tests.model/workspace/Completion/.project
org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/mypackage/MyClass.class
org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/pack1/PX.class
org.eclipse.jdt.core.tests.model/workspace/Completion/lib.jar
org.eclipse.jdt.core.tests.model/workspace/Completion/pack.jar
org.eclipse.jdt.core.tests.model/workspace/Completion/src/A.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/B.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CUWithSecondaryType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/ClassWithComplexName.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractSuperClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArgumentName.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArrayAccess1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitive.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitivePackage.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConstructorForAnonymousType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionDefaultPackage.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyToken1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEndOfCompilationUnit.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionExpectedTypeIsNotValid.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldName.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindConstructor.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindLocalVariable.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInProcess.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInThis.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSecondaryType1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSuperInterface.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindThisDotField.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionInstanceofOperator1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalName.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalType1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNonEmptyToken1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNullRequestor.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionObjectsMethodWithInterfaceReceiver.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOutOfBounds.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedAllocationType1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedExpectedType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionRepeatedType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnInInitializer.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSameSuperClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionThrowStatement.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionType1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedEnclosingType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedFieldType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedParameterType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedReturnType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameUnresolvedType.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVisibilityCheck.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVoidMethod.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionWithBinaryFolder.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/Default.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperInterface.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/TEST_FOO_MyClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/Test_Bar_MyClass.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/TypeWithConstructor.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX00.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX01.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX02.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX20.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX21.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX22.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/p1/ABC.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/p2/ABC.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/p3/CompletionToplevelType1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/PX.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/pack3/PX.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack2/PX.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/q1/CT1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src/q2/CT1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract15.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract16.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass15.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass16.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass17.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass18.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass19.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass20.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass21.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass22.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass23.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass24.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal15.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal16.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal17.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal18.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface15.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface16.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface17.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface18.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew15.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew16.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic15.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic16.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic17.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic18.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic19.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic20.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis11.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis12.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis13.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis14.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile1.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile10.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile3.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile4.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile5.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile6.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile7.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile9.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage2.java
org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage8.java
org.eclipse.jdt.core.tests.model/workspace/Completion/zzz.jar
org.eclipse.jdt.core.tests.model/workspace/Completion/zzzsrc.zip
org.eclipse.jdt.core.tests.model/workspace/Converter/.classpath
org.eclipse.jdt.core.tests.model/workspace/Converter/.project
org.eclipse.jdt.core.tests.model/workspace/Converter/Hello.java
org.eclipse.jdt.core.tests.model/workspace/Converter/NO_WORKING.java
org.eclipse.jdt.core.tests.model/workspace/Converter/Test0157.java
org.eclipse.jdt.core.tests.model/workspace/Converter/Test0158.java
org.eclipse.jdt.core.tests.model/workspace/Converter/Test0170.java
org.eclipse.jdt.core.tests.model/workspace/Converter/Test462.java
org.eclipse.jdt.core.tests.model/workspace/Converter/codeManipulation/bug.java
org.eclipse.jdt.core.tests.model/workspace/Converter/examples.oneofeach/ASTPosterChild.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/AboutDialog.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/Logo.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/ProgressBar.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/TestRunner.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ActiveTestSuite.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ExceptionTestCase.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/RepeatedTest.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestDecorator.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestSetup.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Assert.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/AssertionFailedError.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Protectable.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestCase.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestFailure.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestListener.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestResult.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestSuite.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/BaseTestRunner.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ClassPathTestCollector.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/FailureDetailView.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/LoadingTestCollector.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ReloadingTestSuiteLoader.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/SimpleTestCollector.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Sorter.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/StandardTestSuiteLoader.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCaseClassLoader.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCollector.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestSuiteLoader.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Version.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/AboutDialog.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/CounterPanel.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/DefaultFailureDetailView.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/FailureRunView.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/ProgressBar.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/StatusLine.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestHierarchyRunView.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunContext.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunView.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunner.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSelector.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSuitePanel.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestTreeModel.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/textui/TestRunner.java
org.eclipse.jdt.core.tests.model/workspace/Converter/junit/ui/TestRunner.java
org.eclipse.jdt.core.tests.model/workspace/Converter/p1/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/p2/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/p3/B.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0001/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0002/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0003/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0004/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0005/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0006/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0007/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0008/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0009/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0010/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0011/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0012/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0013/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0014/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0015/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0016/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0017/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0018/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0019/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0020/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0021/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0022/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0023/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0024/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0025/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0026/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0027/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0028/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0029/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0030/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0031/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0032/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0033/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0034/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0035/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0036/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0037/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0038/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0039/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0040/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0041/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0042/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0043/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0044/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0045/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0046/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0047/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0048/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0049/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0050/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0051/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0052/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0053/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0054/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0055/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0056/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0057/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0058/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0059/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0060/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0061/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0062/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0063/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0064/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0065/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0066/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0067/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0068/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0069/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0070/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0071/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0072/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0073/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0074/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0075/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0076/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0077/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0078/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0079/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0080/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0081/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0082/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0083/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0084/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0085/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0086/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0087/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0088/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0089/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0090/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0091/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0092/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0093/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0094/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0095/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0096/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0097/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0098/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0099/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0100/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0101/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0102/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0103/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0104/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0105/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0106/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0107/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0108/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0109/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0110/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0111/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0112/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0113/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0114/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0115/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0116/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0117/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0118/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0119/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0120/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0121/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0122/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0123/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0124/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0125/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0126/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0127/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0128/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0129/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0130/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0131/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0132/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0133/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0134/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0135/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0136/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0137/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0138/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0139/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0140/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0141/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0142/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0143/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0144/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0145/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0146/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0147/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0148/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0149/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0150/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0151/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0152/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0153/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0154/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0155/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0156/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0159/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0160/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0161/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0162/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0163/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0164/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0165/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0166/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0167/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0168/test1/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0169/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0171/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0172/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0173/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0174/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0175/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0176/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0177/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0178/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0179/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0180/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0181/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0182/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0183/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0184/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0185/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0186/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0187/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0188/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0189/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0190/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0191/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0192/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0193/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0194/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0195/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0196/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0197/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0198/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0199/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0200/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0201/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0202/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0203/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0204/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0205/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0206/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0207/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0208/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0209/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0210/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0211/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0212/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0213/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0214/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0215/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0216/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0217/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0218/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0219/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0220/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0221/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0222/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0223/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0224/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0225/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0226/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0227/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0228/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0229/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0230/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0231/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0232/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0233/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0234/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0235/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0236/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0238/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0239/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0240/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0241/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0242/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0243/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0244/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0245/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0246/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0247/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0248/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0249/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0250/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0251/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0252/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0253/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0254/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0255/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0256/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0257/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0258/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0259/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0260/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0261/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0262/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0263/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0264/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0265/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0266/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0267/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0268/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0269/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0270/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0271/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0272/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0273/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0274/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0275/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0276/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0277/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0278/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0279/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0280/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0281/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0282/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0283/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0284/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0285/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0286/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0287/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0288/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0289/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0290/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0291/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0292/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0293/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0294/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0295/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0296/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0297/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0298/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0299/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0300/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0301/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0302/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0303/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0304/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0307/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0308/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0309/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0310/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0311/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0312/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0313/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0314/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0315/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0317/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0318/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0319/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0320/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0321/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0322/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0323/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0324/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0325/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0326/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0327/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0328/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0329/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0330/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0331/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0332/LocalSelectionTransfer.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0333/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0334/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0335/ExceptionTestCaseTest.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0336/SorterTest.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0337/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0338/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0339/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0341/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0342/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0343/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0344/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0345/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0346/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0347/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0348/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0349/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0350/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0351/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0352/Test2.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0353/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0354/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0355/Foo.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/X.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0357/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0358/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0359/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0360/X.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0361/X.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0362/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0363/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0364/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0365/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0366/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0367/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0368/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0369/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0370/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0371/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0372/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0373/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0374/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0375/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0376/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0377/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0378/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0379/Test.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0380/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0381/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0382/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0383/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0384/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0385/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0386/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0387/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0388/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0389/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0390/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0391/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0392/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0393/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0394/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0395/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0396/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0397/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0398/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0399/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0400/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0401/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0402/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0403/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0404/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0405/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0406/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0406_a/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0407/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0408/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0409/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0410/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0411/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0412/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0413/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/B.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0415/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0416/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0417/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0418/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0419/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0420/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0421/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0422/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0423/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0424/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0425/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0426/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0427/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0428/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0429/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0430/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0431/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0432/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0433/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0434/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0435/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0436/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0437/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0438/D.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0438_a/W.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/C.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/E.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0440/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0441/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0442/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0443/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0444/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0445/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0446/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0447/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0448/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0449/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0450/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0451/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0453/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0454/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0455/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0456/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0457/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0458/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0459/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0460/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0461/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0463/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0464/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0465/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0466/Assert.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0467/Assert.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0468/A.java
org.eclipse.jdt.core.tests.model/workspace/Converter/test0470/A.java
org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.classpath
org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.project
org.eclipse.jdt.core.tests.model/workspace/CreateMembers/src/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.classpath
org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.project
org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/lib/p/Y.class
org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.classpath
org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.project
org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/src/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.classpath
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.project
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/bin/dummy
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/lib.jar
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/readme.txt
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme.txt
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme2.txt
org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/y/Main.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.classpath
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.project
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/AbortCompilation.jar
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/MyJar.jar
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/NotInClasspath/p/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc()/X31997.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc()/Y31997.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/CA.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/D.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/E.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/InterfaceImplementors.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/Azz.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/NoReference/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/O.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/ObjectMemberTypeReference/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PR_1GGNOTF.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/C.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/D.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/E.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/F.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/G.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/H.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/I.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/J.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/K.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceA.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceB.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceC.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceD.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceE.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceF.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceG.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceH.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceI.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceJ.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/Test.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceAsSingleNameReference.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInArray/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInImport/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/C.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/D.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/W.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a2/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/References.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Z.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a4/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a5/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a6/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a7/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a8/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a9/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Z.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b3/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b4/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b5/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b6/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b7/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b8/Test.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b9/Foo.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/I.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c3/C.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c4/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c5/Test.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c6/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c9/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d1/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Z.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d3/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d7/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/AA.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p1/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p2/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e1/A29366.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/X31985.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/Y31985.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/I.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Z.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p2/Z.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/p2/p/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p4/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p5/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p6/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p7/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p8/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p9/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q1/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q2/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q3/A$B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q4/C.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q5/AQ.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q6/CD.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q7/AQ.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q8/EclipseTest.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q9/I.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/I.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r3/A21485.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r4/B21485.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r5/XYZ.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/B.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r8/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/Z.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s3/A.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/sd/AQ.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc1/X.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc2/Y.java
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.jar
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.zip
org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test24741.jar
org.eclipse.jdt.core.tests.model/workspace/Resolve/.classpath
org.eclipse.jdt.core.tests.model/workspace/Resolve/.project
org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType$Inner.class
org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.class
org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/p3.jar
org.eclipse.jdt.core.tests.model/workspace/Resolve/p3src.zip
org.eclipse.jdt.core.tests.model/workspace/Resolve/p4.jar
org.eclipse.jdt.core.tests.model/workspace/Resolve/p4src.zip
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveAbstractMethod.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArgumentName.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArrayLength.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentName.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType1.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType2.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass1.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass2.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass3.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass4.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass5.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass6.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructor.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructorDeclaration.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveEmptySelectionOnMethod.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitSuperConstructorCall.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitThisConstructorCall.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveField.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveFieldDeclaration.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveImport.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInnerClassAsParamater.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInterface.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveLocalName.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration1.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration2.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMessageSendOnBaseType.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethod.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclaration.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodWithIncorrectParameter.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePackage.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePartiallyQualifiedType.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedType.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeDeclaration.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection2.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeInComment.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveUnicode.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperClass.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperInterface.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/X1.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/a/b/ImportedClass.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/X.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/Y.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p2/X.java
org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888.jar
org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888src.zip
org.eclipse.jdt.core.tests.model/workspace/Resolve/zzz.jar
org.eclipse.jdt.core.tests.model/workspace/Resolve/zzzsrc.zip
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.classpath
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.project
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$1$Victory.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$Inner.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$1$Victory.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$Inner.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.java
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperClass.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperInnerClass.class
org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/src/aa/bb/cc/BClass.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.classpath
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.project
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/NotInClasspath/e/E.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/lib.jar
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/A.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Deep.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I1.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I2.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Y.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Z.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I1.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I2.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I3.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/Y.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/A.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/B.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I1.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p4/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p5/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/wc/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.classpath
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.project
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/Dependent.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.classpath
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.project
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/Error.class
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/a/A.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/b/B.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/c/C.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/d/D.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/e/E.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I1.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I2.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/External.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/MyError.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/other/External.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/A.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/B.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.classpath
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.project
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I1.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I2.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I3.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I4.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I5.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I6.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Y.java
org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Z.java
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.classpath
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.project
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p/TypeResolve.java
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p1/X.java
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p2/Y.java
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p3/B.java
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/A.java
org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/B.java
diff --git a/org.eclipse.jdt.core.tests.builder/.classpath b/org.eclipse.jdt.core.tests.builder/.classpath
deleted file mode 100644
index b7132bc..0000000
--- a/org.eclipse.jdt.core.tests.builder/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="/org.junit"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.core"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.core.tests.compiler"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.builder/.cvsignore b/org.eclipse.jdt.core.tests.builder/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/org.eclipse.jdt.core.tests.builder/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.builder/.project b/org.eclipse.jdt.core.tests.builder/.project
deleted file mode 100644
index 571c831..0000000
--- a/org.eclipse.jdt.core.tests.builder/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core.tests.builder</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.jdt.core</project>
- <project>org.eclipse.jdt.core.tests.compiler</project>
- <project>org.junit</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.builder/about.html b/org.eclipse.jdt.core.tests.builder/about.html
deleted file mode 100644
index 21aa90c..0000000
--- a/org.eclipse.jdt.core.tests.builder/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org 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
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.builder/build.properties b/org.eclipse.jdt.core.tests.builder/build.properties
deleted file mode 100644
index f113880..0000000
--- a/org.eclipse.jdt.core.tests.builder/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- test.xml,\
- about.html,\
- *.jar
-source.jdtcoretestsbuilder.jar = src
-src.includes=about.html
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.builder/plugin.xml b/org.eclipse.jdt.core.tests.builder/plugin.xml
deleted file mode 100644
index 039c27b..0000000
--- a/org.eclipse.jdt.core.tests.builder/plugin.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.jdt.core.tests.builder"
- name="Java Builder Tests"
- version="2.1.0">
-
- <runtime>
- <library name="jdtcoretestsbuilder.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.junit"/>
- <import plugin="org.eclipse.jdt.core"/>
- <import plugin="org.eclipse.jdt.core.tests.compiler"/>
- <import plugin="org.eclipse.core.resources"/>
- </requires>
-
-
-</plugin>
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java
deleted file mode 100644
index 20a3e59..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 AbstractMethodTests extends Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public AbstractMethodTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(AbstractMethodTests.class);
- return suite;
- }
-
- public void test001() throws JavaModelException {
- //----------------------------
- // Step 1
- //----------------------------
- //----------------------------
- // Project1
- //----------------------------
- IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
-
- // 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.addExternalJar(project2Path, Util.getJavaClassLib());
- 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 (or is not a valid type) for the argument x of the method foo", classX)); //$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(classY, new Problem("Y", "Class must implement the inherited abstract method X.foo(IX)", classY)); //$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();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Assert.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Assert.java
deleted file mode 100644
index d8b6146..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Assert.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-/**
- * <code>Assert</code> is useful for for embedding runtime sanity checks
- * in code.
- * The predicate methods all test a condition and throw some
- * type of unchecked exception if the condition does not hold.
- * <p>
- * Assertion failure exceptions, like most runtime exceptions, are
- * thrown when something is misbehaving. Assertion failures are invariably
- * unspecified behavior; consequently, clients should never rely on
- * these being thrown (and certainly should not being catching them
- * specifically).
- * </p>
- */
-public final class Assert {
-/* This class is not intended to be instantiated. */
-private Assert() {
-}
-/** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression) {
- return isLegal(expression, ""); //$NON-NLS-1$
-}
-/** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException(message);
- return expression;
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param object the value to test
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object) {
- isNotNull(object, ""); //$NON-NLS-1$
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new AssertionFailedException("null argument;" + message); //$NON-NLS-1$
-}
-/** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression) {
- return isTrue(expression, ""); //$NON-NLS-1$
-}
-/** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression, String message) {
- if (!expression)
- throw new AssertionFailedException("assertion failed; "+message); //$NON-NLS-1$
- return expression;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AssertionFailedException.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AssertionFailedException.java
deleted file mode 100644
index e512219..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AssertionFailedException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-/**
- * <code>AssertionFailedException</code> is a runtime exception thrown
- * by some of the methods in <code>Assert</code>.
- * <p>
- * This class is not declared public to prevent some misuses; programs that catch
- * or otherwise depend on assertion failures are susceptible to unexpected
- * breakage when assertions in the code are added or removed.
- * </p>
- */
-/* package */
-class AssertionFailedException extends RuntimeException {
-/** Constructs a new exception.
- */
-public AssertionFailedException() {
-}
-/** Constructs a new exception with the given message.
- */
-public AssertionFailedException(String detail) {
- super(detail);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
deleted file mode 100644
index a2e43a1..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import java.util.Hashtable;
-
-import junit.framework.*;
-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;
-
-/**
- * Basic tests of the image builder.
- */
-public class BasicBuildTests extends Tests {
- public BasicBuildTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(BasicBuildTests.class);
- }
-
- public void testBuild() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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$
-
- JavaCore.setOptions(newOptions);
-
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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)); //$NON-NLS-1$ //$NON-NLS-2$
-
- JavaCore.setOptions(options);
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ClasspathTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ClasspathTests.java
deleted file mode 100644
index 36906c4..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ClasspathTests.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.tests.util.Util;
-
-import java.util.*;
-
-public class ClasspathTests extends Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public ClasspathTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(ClasspathTests.class);
- return suite;
- }
-
- public void testClosedProject() throws JavaModelException {
- IPath project1Path = env.addProject("CP1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
- IPath jarPath = env.addInternalJar(project1Path, "temp.jar", new byte[] {0}); //$NON-NLS-1$
-
- IPath project2Path = env.addProject("CP2"); //$NON-NLS-1$
- env.addExternalJar(project2Path, Util.getJavaClassLib());
- env.addRequiredProject(project2Path, project1Path);
-
- IPath project3Path = env.addProject("CP3"); //$NON-NLS-1$
- env.addExternalJar(project3Path, Util.getJavaClassLib());
- 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), //$NON-NLS-1$ //$NON-NLS-2$
- new Problem("Build path", "Missing required Java project: CP1.", project2Path) //$NON-NLS-1$ //$NON-NLS-2$
- }
- );
- expectingOnlySpecificProblemsFor(project3Path,
- new Problem[] {
- new Problem("", "The project cannot be built until build path errors are resolved.", project3Path), //$NON-NLS-1$ //$NON-NLS-2$
- new Problem("Build path", "Missing required library: 'CP1/temp.jar'.", project3Path) //$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);
-
- incrementalBuild();
- expectingOnlyProblemsFor(new IPath[] {project2Path, project3Path});
- expectingOnlySpecificProblemFor(project2Path,
- new Problem("Build path", "Missing required Java project: CP1.", project2Path) //$NON-NLS-1$ //$NON-NLS-2$
- );
- expectingOnlySpecificProblemFor(project3Path,
- new Problem("Build path", "Missing required library: 'CP1/temp.jar'.", project3Path) //$NON-NLS-1$ //$NON-NLS-2$
- );
-
- env.openProject(project1Path);
- incrementalBuild();
- expectingNoProblems();
-
- options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.ABORT);
- JavaCore.setOptions(options);
- }
-
- public void testMissingProject() throws JavaModelException {
- IPath project1Path = env.addProject("MP1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
-
- IPath project2Path = env.addProject("MP2"); //$NON-NLS-1$
- env.addExternalJar(project2Path, Util.getJavaClassLib());
- env.addRequiredProject(project2Path, project1Path);
-
- fullBuild();
- expectingNoProblems();
-
- //----------------------------
- // Step 2
- //----------------------------
- env.removeProject(project1Path);
-
- incrementalBuild();
- expectingOnlyProblemsFor(project2Path);
- expectingOnlySpecificProblemsFor(project2Path,
- new Problem[] {
- new Problem("", "The project cannot be built until build path errors are resolved.", project2Path), //$NON-NLS-1$ //$NON-NLS-2$
- new Problem("Build path", "Missing required Java project: MP1.", project2Path) //$NON-NLS-1$ //$NON-NLS-2$
- }
- );
-
- project1Path = env.addProject("MP1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
-
- incrementalBuild();
- expectingNoProblems();
-
- //----------------------------
- // Step 3
- //----------------------------
- Hashtable options = JavaCore.getOptions();
- options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE);
- JavaCore.setOptions(options);
- env.removeProject(project1Path);
-
- incrementalBuild();
- expectingOnlyProblemsFor(project2Path);
- expectingOnlySpecificProblemFor(project2Path,
- new Problem("Build path", "Missing required Java project: MP1.", project2Path) //$NON-NLS-1$ //$NON-NLS-2$
- );
-
- project1Path = env.addProject("MP1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
-
- incrementalBuild();
- expectingNoProblems();
-
- options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.ABORT);
- JavaCore.setOptions(options);
- }
-
- 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 rebuilding this project.", projectPath), //$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) //$NON-NLS-1$ //$NON-NLS-2$
- }
- );
-
- //----------------------------
- // Step 2
- //----------------------------
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- incrementalBuild();
- expectingNoProblems();
- expectingPresenceOf(new IPath[]{
- bin.append("p1").append("Test1.class"), //$NON-NLS-1$ //$NON-NLS-2$
- });
- }
-
- 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, "p1", "Test1", //$NON-NLS-1$ //$NON-NLS-2$
- "package p1;\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, "p2", "Test3", //$NON-NLS-1$ //$NON-NLS-2$
- "package p2;\n"+ //$NON-NLS-1$
- "public class Test3 {}" //$NON-NLS-1$
- );
-
- fullBuild();
- 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 rebuilding this project.", projectPath)); //$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("p1", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.", classTest1)); //$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)); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- expectingSpecificProblemFor(classTest3, new Problem("p2", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.", classTest3)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- //----------------------------
- // Step 2
- //----------------------------
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- incrementalBuild();
- expectingNoProblems();
- expectingPresenceOf(new IPath[]{
- bin.append("p1").append("Test1.class"), //$NON-NLS-1$ //$NON-NLS-2$
- bin.append("p2").append("Test2.class"), //$NON-NLS-1$ //$NON-NLS-2$
- bin.append("p2").append("Test3.class") //$NON-NLS-1$ //$NON-NLS-2$
- });
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompilationUnitLocationTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompilationUnitLocationTests.java
deleted file mode 100644
index a0a3fd5..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompilationUnitLocationTests.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 CompilationUnitLocationTests extends Tests {
- private static String[] EXCLUDED_TESTS = {
- "CompilationUnitLocationTests", "testWrongCompilationUnitLocation" //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- public CompilationUnitLocationTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(CompilationUnitLocationTests.class);
- return suite;
- }
-
- /**
- * Bugs 6461
- */
- public void testWrongCompilationUnitLocation() throws JavaModelException {
- //----------------------------
- // Step 1
- //----------------------------
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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$
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java
deleted file mode 100644
index 26c903c..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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.
- */
-public class CopyResourceTests extends Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public CopyResourceTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(CopyResourceTests.class);
- return suite;
- }
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath2, Util.getJavaClassLib());
-
- env.addFile(projectPath2, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- fullBuild();
- expectingNoProblems();
- expectingPresenceOf(bin.append("z.txt")); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java
deleted file mode 100644
index 9d37a12..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import java.util.Vector;
-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;
-
-public class EfficiencyCompilerRequestor implements IDebugRequestor {
- private boolean isActive = false;
-
- private Vector compiledClasses = new Vector(10);
-
- public void acceptDebugResult(CompilationResult result){
- 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++) {
- String className = new String(classFiles[i].fileName());
- compiledClasses.addElement(className.replace('/', '.'));
- }
- }
-
- String[] getCompiledClasses(){
- return (String [])compiledClasses.toArray(new String[0]);
- }
-
- public void clearResult(){
- compiledClasses.clear();
- }
-
- public void reset() {
- }
-
- public void activate() {
- isActive = true;
- }
-
- public void deactivate() {
- isActive = false;
- }
-
- public boolean isActive() {
- return isActive;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java
deleted file mode 100644
index f94d0f1..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 Tests {
- public EfficiencyTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(EfficiencyTests.class);
- }
-
- public void testEfficiency() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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[]{"p1.Indicted", "p2.Collaborator"}); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testMethodAddition() throws JavaModelException {
-
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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[]{"p1.X", "p2.Y" }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testLocalTypeAddition() throws JavaModelException {
-
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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[]{"p1.X", "p1.X$1" }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testLocalTypeAddition2() throws JavaModelException {
-
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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[]{"p1.X", "p1.X$1", "p1.X$2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testLocalTypeRemoval() throws JavaModelException {
-
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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[]{"p1.X" }); //$NON-NLS-1$
- }
-
- public void testLocalTypeRemoval2() throws JavaModelException {
-
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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[]{"p1.X", "p1.X$1" }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java
deleted file mode 100644
index 348bcc8..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 errors tests of the image builder.
- */
-public class ErrorsTests extends Tests {
- public ErrorsTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(ErrorsTests.class);
- }
-
- public void testErrors() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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", "Class must implement the inherited abstract method Indicted.foo()", collaboratorPath)); //$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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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 or is not a valid superclass", cuPath)); //$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();
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java
deleted file mode 100644
index 75e5068..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 Tests {
- public ExecutionTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(ExecutionTests.class);
- }
-
- public void testSuccess() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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);
- expectingNoProblems();
- executeClass(projectPath, "p1.Hello", "Hello world\r\n", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testFailure() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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$
- " Missing semicolon\n" //$NON-NLS-1$
- );
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FilteredTestSuite.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FilteredTestSuite.java
deleted file mode 100644
index 4c4dd80..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FilteredTestSuite.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import junit.framework.*;
-public class FilteredTestSuite extends TestSuite {
- public static boolean EXPERT = false;
- String[] excludedTests = null;
-/**
- * Creates a new test suite by excluding the given tests
- * from the given test suite if Tests.EXPERT is false.
- */
-public FilteredTestSuite(String[] excludedTests) {
- if(!EXPERT) {
- this.excludedTests = excludedTests;
- //for (int i = 0; i < excludedTests.length; i+=2) {
- // System.out.println("excluded : "+excludedTests[i]+"#"+excludedTests[i+1]);
- //}
- }
-}
-/**
- * Adds a test to the suite.
- */
-public void addTest(Test test) {
- if(EXPERT){
- super.addTest(test);
- } else {
- if (test instanceof TestCase) {
- if (!isExcluded((TestCase)test)) {
- super.addTest(test);
- }
- } else if (test instanceof TestSuite) {
- java.util.Enumeration enum = ((TestSuite)test).tests();
- while (enum.hasMoreElements()) {
- this.addTest((Test)enum.nextElement());
- }
- }
- }
-}
-/**
- * Returns whether the test is excluded.
- */
-public boolean isExcluded(TestCase test) {
- if (this.excludedTests == null) {
- return false;
- }
- for (int i = 0; i < this.excludedTests.length; i += 2) {
- String className = this.excludedTests[i];
- String methodName = this.excludedTests[i+1];
- if (test.getName().equals(methodName) &&
- test.getClass().getName().endsWith(className)) {
- return true;
- }
- }
- return false;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java
deleted file mode 100644
index 07fe9b5..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-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;
-
-public class IncrementalTests extends Tests {
-
- public IncrementalTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(IncrementalTests.class);
- }
-
- public void testDefaultPackage() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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();
- }
-
- public void testDefaultPackage2() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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();
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=17329
- */
- public void testRenameMainType() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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 });
- expectingSpecificProblemFor(pathToA, new Problem("_A", "The public type _A must be defined in its own file", pathToA)); //$NON-NLS-1$ //$NON-NLS-2$
- expectingSpecificProblemFor(pathToB, new Problem("B", "A cannot be resolved or is not a valid superclass", pathToB)); //$NON-NLS-1$ //$NON-NLS-2$
- expectingSpecificProblemFor(pathToC, new Problem("C", "The hierarchy of the type C is inconsistent", pathToC)); //$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();
- }
-
- /*
- * 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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(new IPath[]{ pathToAB });
- expectingSpecificProblemFor(pathToAB, new Problem("AB", "AZ cannot be resolved or is not a valid superclass", pathToAB)); //$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();
- }
-
- /*
- * 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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(new IPath[]{ pathToBB });
- expectingSpecificProblemFor(pathToBB, new Problem("BB.foo()", "ZA cannot be resolved or is not a type", pathToBB)); //$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();
- }
-
- public void testMoveSecondaryType() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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();
- }
-
- public void testMoveMemberType() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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")), //$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")), //$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")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- });
- }
-
- public void testMovePackage() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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();
- }
-
- public void testMemberTypeFromClassFile() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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();
- }
-
- // 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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")), //$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")), //$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")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- });
-
- } catch(StackOverflowError e){
- assertTrue("Infinite loop in cycle detection", false); //$NON-NLS-1$
- e.printStackTrace();
- }
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/JCLTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/JCLTests.java
deleted file mode 100644
index c6b50c4..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/JCLTests.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import junit.framework.*;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Basic tests of the image builder.
- */
-public class JCLTests extends Tests {
- private static String[] EXCLUDED_TESTS = {
- "JCLTests", "testNewJCL" //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- public JCLTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(JCLTests.class);
- return suite;
- }
-
-
- 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
- //----------------------------
- IPath object = 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();
- expectingSpecificProblemFor(object, new Problem("java.lang", "This compilation unit indirectly references the missing type java.lang.Throwable (typically some required class file is referencing a type outside the classpath)", object)); //$NON-NLS-1$ //$NON-NLS-2$
-
- //----------------------------
- // Step 3
- //----------------------------
- IPath throwable = 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();
- expectingSpecificProblemFor(object, new Problem("java.lang", "This compilation unit indirectly references the missing type java.lang.RuntimeException (typically some required class file is referencing a type outside the classpath)", object)); //$NON-NLS-1$ //$NON-NLS-2$
- expectingSpecificProblemFor(throwable, new Problem("java.lang", "This compilation unit indirectly references the missing type java.lang.RuntimeException (typically some required class file is referencing a type outside the classpath)", throwable)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java
deleted file mode 100644
index 5f4168b..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java
+++ /dev/null
@@ -1,712 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import java.util.Hashtable;
-
-import junit.framework.*;
-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;
-
-
-public class MultiProjectTests extends Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public MultiProjectTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(MultiProjectTests.class);
- return suite;
- }
-
- public void testCompileOnlyDependent() throws JavaModelException {
- //----------------------------
- // Step 1
- //----------------------------
- //----------------------------
- // Project1
- //----------------------------
- IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
- 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.addExternalJar(project2Path, Util.getJavaClassLib());
- 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.addExternalJar(project3Path, Util.getJavaClassLib());
- 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$
- );
-
- fullBuild();
- 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$
- );
-
- incrementalBuild();
- expectingCompiledClasses(new String[]{"A", "B"}); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testRemoveField() throws JavaModelException {
- //----------------------------
- // Step 1
- //----------------------------
- //----------------------------
- // Project1
- //----------------------------
- IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$
- env.addExternalJar(project1Path, Util.getJavaClassLib());
- 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.addExternalJar(project2Path, Util.getJavaClassLib());
- 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$
- );
-
- fullBuild();
- expectingNoProblems();
-
- //----------------------------
- // Step 2
- //----------------------------
- env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$
- "public class A {\n"+ //$NON-NLS-1$
- "}\n" //$NON-NLS-1$
- );
-
- incrementalBuild();
- expectingSpecificProblemFor(b, new Problem("B.foo()", "x cannot be resolved or is not a field", b)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCompileOrder() 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.addExternalJar(p1, Util.getJavaClassLib());
- // 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.addExternalJar(p2, Util.getJavaClassLib());
- // 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.addExternalJar(p3, Util.getJavaClassLib());
- // 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$
- fullBuild();
-
- expectingCompilingOrder(new String[]{"p1.X", "p3.Z", "p2.Y"}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- IPath workspaceRootPath = env.getWorkspaceRootPath();
- expectingOnlySpecificProblemsFor(workspaceRootPath,new Problem[]{
- new Problem("p3", "W cannot be resolved (or is not a valid type) for the field Z.w", c3),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "W cannot be resolved (or is not a valid type) for the field Y.w", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p1", "W cannot be resolved (or is not a valid type) for the field X.w", c1)//$NON-NLS-1$ //$NON-NLS-2$
- });
- JavaCore.setOptions(options);
- }
-
- public void testCycle1() 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.addExternalJar(p1, Util.getJavaClassLib());
- // 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.addExternalJar(p2, Util.getJavaClassLib());
- // 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.addExternalJar(p3, Util.getJavaClassLib());
- // 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$
- fullBuild();
-
- expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$
- expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project: P1", p1));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project: P2", p2));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project: P3", p3));//$NON-NLS-1$ //$NON-NLS-2$
-
- JavaCore.setOptions(options);
- } finally {
- env.setBuildOrder(null);
- }
- }
-
- public void testCycle2() 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.addExternalJar(p1, Util.getJavaClassLib());
- // 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.addExternalJar(p2, Util.getJavaClassLib());
- // 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.addExternalJar(p3, Util.getJavaClassLib());
- // 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$
- fullBuild();
-
- expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$
- expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project: P1", p1));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemsFor(p2,new Problem[]{
- new Problem("p2", "The method bar(Y, int) in the type X is not applicable for the arguments (Y)", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "A cycle was detected in the build path of project: P2", p2)//$NON-NLS-1$ //$NON-NLS-2$
- });
- expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project: P3", p3));//$NON-NLS-1$ //$NON-NLS-2$
-
- JavaCore.setOptions(options);
- } finally {
- env.setBuildOrder(null);
- }
- }
-
- public void testCycle3() 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.addExternalJar(p1, Util.getJavaClassLib());
- // 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.addExternalJar(p2, Util.getJavaClassLib());
- // 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.addExternalJar(p3, Util.getJavaClassLib());
- // 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$
- fullBuild();
-
- expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$
- expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project: P1", p1));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project: P2", p2));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project: P3", p3));//$NON-NLS-1$ //$NON-NLS-2$
-
- 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();
-
- expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z"}); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
- expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project: P1", p1));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemsFor(p2,new Problem[]{
- new Problem("p2", "The method bar(Y, int) in the type X is not applicable for the arguments (Y)", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "A cycle was detected in the build path of project: P2", p2)//$NON-NLS-1$ //$NON-NLS-2$
- });
- expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project: P3", p3));//$NON-NLS-1$ //$NON-NLS-2$
-
- JavaCore.setOptions(options);
- } finally {
- env.setBuildOrder(null);
- }
- }
-
- public void testCycle4() 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.addExternalJar(p1, Util.getJavaClassLib());
- // 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.addExternalJar(p2, Util.getJavaClassLib());
- // 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.addExternalJar(p3, Util.getJavaClassLib());
- // 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$
- fullBuild();
-
- expectingCompilingOrder(new String[]{"p2.Y", "p3.Z", "p2.Y"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
- expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project: P1", p1));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemsFor(p2,new Problem[]{
- new Problem("p2", "The import p1 cannot be resolved", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "X cannot be resolved (or is not a valid return type) for the method zork", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "X cannot be resolved or is not a type", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "The method foo() is undefined for the type Y", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "A cycle was detected in the build path of project: P2", p2)//$NON-NLS-1$ //$NON-NLS-2$
- });
- expectingOnlySpecificProblemsFor(p3,new Problem[]{
- new Problem("p3", "X cannot be resolved (or is not a valid return type) for the method foo", c3),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p3", "The import p1 cannot be resolved", c3),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p3", "A cycle was detected in the build path of project: P3", p3)//$NON-NLS-1$ //$NON-NLS-2$
- });
-
- 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();
- expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y"}); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$
- expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project: P1", p1));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project: P2", p2));//$NON-NLS-1$ //$NON-NLS-2$
- expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project: P3", p3));//$NON-NLS-1$ //$NON-NLS-2$
-
- JavaCore.setOptions(options);
- } finally {
- env.setBuildOrder(null);
- }
- }
-
- 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.addExternalJar(p1, Util.getJavaClassLib());
- // 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.addExternalJar(p2, Util.getJavaClassLib());
- // 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$
- fullBuild();
-
- expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p1.X", "p2.Y"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
- expectingOnlySpecificProblemsFor(p1,new Problem[]{
- new Problem("p1", "The import p22 cannot be resolved", c1),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p1", "A cycle was detected in the build path of project: P1", p1)//$NON-NLS-1$ //$NON-NLS-2$
- });
- expectingOnlySpecificProblemsFor(p2,new Problem[]{
- new Problem("p2", "The import p11 cannot be resolved", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "A cycle was detected in the build path of project: P2", p2)//$NON-NLS-1$ //$NON-NLS-2$
- });
-
- 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();
-
- expectingCompilingOrder(new String[]{"p11.XX", "p22.YY", "p2.Y", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
- expectingOnlySpecificProblemsFor(p1,new Problem[]{
- new Problem("p1", "The import p22 is never used", c1),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p1", "A cycle was detected in the build path of project: P1", p1)//$NON-NLS-1$ //$NON-NLS-2$
- });
- expectingOnlySpecificProblemsFor(p2,new Problem[]{
- new Problem("p2", "The import p11 is never used", c2),//$NON-NLS-1$ //$NON-NLS-2$
- new Problem("p2", "A cycle was detected in the build path of project: P2", p2)//$NON-NLS-1$ //$NON-NLS-2$
- });
-
- JavaCore.setOptions(options);
- } finally {
- env.setBuildOrder(null);
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java
deleted file mode 100644
index 93d38c4..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public MultiSourceFolderAndOutputFolderTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(MultiSourceFolderAndOutputFolderTests.class);
- return suite;
- }
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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() throws JavaModelException {
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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() throws JavaModelException {
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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$
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java
deleted file mode 100644
index f05379c..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public OutputFolderTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(OutputFolderTests.class);
- return suite;
- }
-
- public void testChangeOutputFolder() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- // 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$
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$
- "<classpath>\n" + //$NON-NLS-1$
- " <classpathentry kind=\"src\" path=\"src\"/>\n" + //$NON-NLS-1$
- " <classpathentry kind=\"var\" path=\"" + Util.getJavaClassLib() + "\"/>\n" + //$NON-NLS-1$ //$NON-NLS-2$
- " <classpathentry kind=\"output\" path=\"\"/>\n" + //$NON-NLS-1$
- "</classpath>" //$NON-NLS-1$
- );
-
- // simulate exit/restart
- JavaModelManager manager = JavaModelManager.getJavaModelManager();
- JavaProject project = (JavaProject)manager.getJavaModel().getJavaProject("P"); //$NON-NLS-1$
- manager.removePerProjectInfo(project);
-
- // 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath2, Util.getJavaClassLib());
- 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/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java
deleted file mode 100644
index e71d800..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 PackageTests extends Tests {
- private static String[] EXCLUDED_TESTS = {
- };
-
- public PackageTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(PackageTests.class);
- return suite;
- }
-
- /**
- * Bugs 6564
- */
- public void testPackageProblem() throws JavaModelException {
- //----------------------------
- // Step 1
- //----------------------------
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
- 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();
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java
deleted file mode 100644
index 123e470..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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;
-
-public class Problem {
- private String location;
- private String message;
- private IPath resourcePath;
-
- public Problem(String location, String message, IPath resourcePath){
- this.location = location;
- this.message = message;
- this.resourcePath = resourcePath;
- }
-
- 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();
- }
- /**
- * Gets the location.
- * @return Returns a String
- */
- public String getLocation() {
- return location;
- }
- /**
- * Gets the message.
- * @return Returns a String
- */
- public String getMessage() {
- return message;
- }
- /**
- * Gets the resourcePath.
- * @return Returns a IPath
- */
- public IPath getResourcePath() {
- return resourcePath;
- }
-
- public String toString(){
-// ignore locations since the builder no longer finds exact Java elements
-// return "Problem : " + message + " [ resource : <" + resourcePath + "> location <"+ location + "> ]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- return "Problem : " + message + " [ resource : <" + resourcePath + "> ]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- public boolean equals(Object o){
- if(o instanceof Problem){
- return this.toString().equals(o.toString());
- }
- return false;
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java
deleted file mode 100644
index 5eb5443..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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 Tests {
- private static String[] EXCLUDED_TESTS = {};
-
- public StaticFinalTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
- suite.addTestSuite(StaticFinalTests.class);
- return suite;
- }
-
- public void testBoolean() throws JavaModelException {
- IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
- env.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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.addExternalJar(projectPath, Util.getJavaClassLib());
-
- 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/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java
deleted file mode 100644
index 785c3a1..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java
+++ /dev/null
@@ -1,848 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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.jdt.core.*;
-
-import org.eclipse.jdt.internal.core.JavaProject;
-import java.io.*;
-import java.util.*;
-
-public class TestingEnvironment {
-
- private boolean fIsOpen = false;
- private boolean fWasBuilt = false;
-
- private IWorkspace fWorkspace = null;
- private Hashtable fProjects = 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", fIsOpen); //$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);
- } else {
- 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", fIsOpen); //$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);
- } else {
- return addClass(packageFragmentRootPath, className, contents);
- }
- }
-
- /** 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", fIsOpen); //$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); //$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 {
- checkAssertion("a workspace must be open", fIsOpen); //$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, exclusionPatterns == null ? new Path[0] : exclusionPatterns, outputPath);
- addEntry(projectPath, entry);
- return path;
- }
-
- public IPath addProject(String projectName){
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- IProject project = createProject(projectName);
- return project.getFullPath();
- }
-
- public void addRequiredProject(IPath projectPath, IPath requiredProjectPath) throws JavaModelException {
- addRequiredProject(projectPath, requiredProjectPath, false);
- }
-
- /** Adds a project to the classpath of a project.
- */
- public void addRequiredProject(IPath projectPath, IPath requiredProjectPath, boolean isExported) throws JavaModelException {
- checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$
- addEntry(projectPath, JavaCore.newProjectEntry(requiredProjectPath, isExported));
- }
-
- 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 addExternalJar(IPath projectPath, String jar, boolean isExported) throws JavaModelException {
- checkAssertion("file name must end with .zip or .jar", jar.endsWith(".zip") || jar.endsWith(".jar")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addEntry(projectPath, JavaCore.newLibraryEntry(new Path(jar), null, null, isExported));
- }
-
- private void addEntry(IPath projectPath, IClasspathEntry entryPath) throws JavaModelException {
- IClasspathEntry[] classpath = getClasspath(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", fIsOpen); //$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", fIsOpen); //$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, and the given
- * zip name must end with ".zip" or ".jar". 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", fIsOpen); //$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$
- 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);
- }
-
- /** 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 (fProjects != null) {
- Enumeration projectNames = fProjects.keys();
- while (projectNames.hasMoreElements()) {
- String projectName = (String) 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", fIsOpen); //$NON-NLS-1$
- try {
- getJavaProject(projectPath).getProject().close(null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- private void closeWorkspace() {
- fIsOpen = false;
- fWasBuilt = false;
- }
-
- private IFile createFile(IPath path, byte[] contents) {
- try {
- IFile file = fWorkspace.getRoot().getFile(path);
-
- ByteArrayInputStream 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);
- }
- return null;
- }
-
- private 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 = fWorkspace.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) {
- IProject project = null;
- try {
- project = fWorkspace.getRoot().getProject(projectName);
- project.create(null, null);
- project.open(null);
- fProjects.put(projectName, project);
- addBuilderSpecs(projectName);
- } catch (CoreException e) {
- handle(e);
- }
-
- return project;
- }
-
- /** Batch builds the workspace. A workspace must be
- * open.
- */
- public void fullBuild() {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- try {
- getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
- } catch (CoreException e) {
- handle(e);
- }
- fWasBuilt = true;
- }
-
- /** Batch builds a project. A workspace must be
- * open.
- */
- public void fullBuild(IPath projectPath) {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- try {
- getProject(projectPath).build(IncrementalProjectBuilder.FULL_BUILD, null);
- } catch (CoreException e) {
- handle(e);
- }
- fWasBuilt = true;
- }
-
- /**
- * Returns the class path.
- */
- public IClasspathEntry[] getClasspath(IPath projectPath) {
- try {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- JavaProject javaProject = (JavaProject) JavaCore.create(getProject(projectPath));
- return javaProject.getExpandedClasspath(true);
-// 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 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){
-
- }
- 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){
- 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]));
-
- Problem[] result = new Problem[problems.size()];
- problems.toArray(result);
- return result;
- } catch(CoreException e){
- }
- return new Problem[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", fIsOpen); //$NON-NLS-1$
- if (packageName.length() == 0)
- return root;
- else
- 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", fIsOpen); //$NON-NLS-1$
- if (name.length() == 0)
- return projectPath;
- else
- return projectPath.append(name);
- }
-
- /**
- * Returns the core project.
- */
- public IProject getProject(String projectName) {
- return (IProject)fProjects.get(projectName);
- }
-
- /**
- * Returns the core project.
- */
- public IProject getProject(IPath projectPath) {
- return (IProject)fProjects.get(projectPath.lastSegment());
- }
-
- /**
- * Returns the workspace.
- */
- public IWorkspace getWorkspace() {
- return fWorkspace;
- }
-
- /**
- * Returns the path of workspace root.
- */
- public IPath getWorkspaceRootPath(){
- return getWorkspace().getRoot().getLocation();
- }
-
- private IPath getJarRootPath(IPath projectPath) {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- return getProject(projectPath).getFullPath();
- }
-
- 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
- */
- private void handleCoreException(CoreException e) {
- e.printStackTrace();
- Assert.isTrue(
- false,
- "Core exception in testing environment: " + e.getMessage()); //$NON-NLS-1$
- }
-
- /** Incrementally builds the workspace. A workspace must be
- * open.
- */
- public void incrementalBuild() {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- checkAssertion("the workspace must have been built", fWasBuilt); //$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", fIsOpen); //$NON-NLS-1$
- checkAssertion("the workspace must have been built", fWasBuilt); //$NON-NLS-1$
- try {
- getProject(projectPath).build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /** Open an empty workspace.
- */
- public void openEmptyWorkspace() {
- close();
- openWorkspace();
- fProjects = new Hashtable(10);
- setup();
- }
-
- /** Close a project from the workspace.
- */
- public void openProject(IPath projectPath){
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- try {
- getJavaProject(projectPath).getProject().open(null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- private void openWorkspace() {
- try {
- closeWorkspace();
-
- fWorkspace = ResourcesPlugin.getWorkspace();
-
- // turn off auto-build -- the tests determine when builds occur
- IWorkspaceDescription description = fWorkspace.getDescription();
- description.setAutoBuilding(false);
- fWorkspace.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", fIsOpen); //$NON-NLS-1$
- IFolder packageFolder = fWorkspace.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", fIsOpen); //$NON-NLS-1$
- className += ".class"; //$NON-NLS-1$
- IFolder packageFolder = fWorkspace.getRoot().getFolder(packagePath);
- try {
- packageFolder.getFile(className).delete(true, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /** 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", fIsOpen); //$NON-NLS-1$
- className += ".java"; //$NON-NLS-1$
- IFolder packageFolder = fWorkspace.getRoot().getFolder(packagePath);
- try {
- packageFolder.getFile(className).delete(true, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /** 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", fIsOpen); //$NON-NLS-1$
- IPath path =
- packageFragmentRootPath.append(packageName.replace('.', IPath.SEPARATOR));
- IFolder folder = fWorkspace.getRoot().getFolder(path);
- try {
- folder.delete(false, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /** 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", fIsOpen); //$NON-NLS-1$
- if (packageFragmentRootName.length() > 0) {
- IFolder folder = getProject(projectPath).getFolder(packageFragmentRootName);
- if (folder.exists()) {
- try {
- folder.delete(false, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
- }
- 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", fIsOpen); //$NON-NLS-1$
- try {
- getJavaProject(projectPath).close();
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
- IProject project = getProject(projectPath);
- try {
- project.delete(true, null);
- } catch (CoreException e) {
- handle(e);
- }
-
- }
-
- /** 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 (fProjects != null) {
- Enumeration projectNames = fProjects.keys();
- while (projectNames.hasMoreElements()) {
- String projectName = (String) 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", fIsOpen); //$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);
- try {
- file.delete(false, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /**
- * Remove an external jar from the classpath.
- */
- public void removeExternalJar(IPath projectPath, IPath jarPath) throws JavaModelException {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- removeEntry(projectPath, jarPath);
- }
-
- private void removeEntry(IPath projectPath, IPath entryPath) throws JavaModelException {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- IClasspathEntry[] oldEntries = getClasspath(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);
- }
- }
- }
-
- /** Remove a file
- */
- public void removeFile(IPath filePath) {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- try {
- fWorkspace.getRoot().getFile(filePath).delete(true, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /** Remove a folder
- */
- public void removeFolder(IPath folderPath) {
- checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- IFolder folder = fWorkspace.getRoot().getFolder(folderPath);
- try {
- folder.delete(true, null);
- } catch (CoreException e) {
- handle(e);
- }
- }
-
- /** 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 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", fIsOpen); //$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", fIsOpen); //$NON-NLS-1$
- IProject p = getProject(projectPath);
- IFolder f = p.getFolder(name);
- f.createLink(externalOutputLocation, IFolder.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", fIsOpen); //$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() {
- fIsOpen = true;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Tests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Tests.java
deleted file mode 100644
index 042de19..0000000
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Tests.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.builder;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import junit.framework.*;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.*;
-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 org.eclipse.jdt.core.compiler.CharOperation;
-
-/**
- * Base class for Java image builder tests
- */
-public class Tests extends TestCase {
- protected static boolean DEBUG = false;
- protected static TestingEnvironment env = null;
- protected EfficiencyCompilerRequestor debugRequestor = null;
-
- private static String[] EXCLUDED_TESTS = {
- };
-
- public Tests(String name) {
- super(name);
- }
-
- /** 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);
- Vector classpath = new Vector(5);
-
- IPath workspacePath = env.getWorkspaceRootPath();
-
- classpath.addElement(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.addElement(workspacePath.append(c).toOSString());
- } else {
- classpath.addElement(c.toOSString());
- }
- }
- }
-
- verifier.execute(className, (String[]) 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.indexOf(expectingOutput) != -1); //$NON-NLS-1$
-
- }
-
- /** 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 = debugRequestor.getCompiledClasses();
- org.eclipse.jdt.internal.core.Util.sort(actual);
- org.eclipse.jdt.internal.core.Util.sort(expected);
- expectingCompiling(actual, expected, "unexpected recompiled units"); //$NON-NLS-1$
- }
-
- /** Verifies that given classes have been compiled in the specified order.
- */
- protected void expectingCompilingOrder(String[] expected) {
- expectingCompiling(debugRequestor.getCompiledClasses(), 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]);
-
- StringBuffer actualBuffer = new StringBuffer("{"); //$NON-NLS-1$
- for (int i = 0; i < actual.length; i++) {
- if (i > 0)
- actualBuffer.append(","); //$NON-NLS-1$
- actualBuffer.append(actual[i]);
- }
- actualBuffer.append('}');
- StringBuffer expectedBuffer = new StringBuffer("{"); //$NON-NLS-1$
- for (int i = 0; i < expected.length; i++) {
- if (i > 0)
- expectedBuffer.append(","); //$NON-NLS-1$
- expectedBuffer.append(expected[i]);
- }
- 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) {
- if (DEBUG)
- printProblemsFor(roots);
-
- for (int i = 0; i < roots.length; i++) {
- Problem[] problems = env.getProblemsFor(roots[i]);
- if (problems.length != 0)
- assertTrue("unexpected problem(s) : " + problems[0], false); //$NON-NLS-1$
- }
- }
-
- /** Verifies that the given element has problems and
- * only the given element.
- */
- protected void expectingOnlyProblemsFor(IPath expected) {
- expectingOnlyProblemsFor(new IPath[] { expected });
- }
-
- /** Verifies that the given elements have problems and
- * only the given elements.
- */
- protected void expectingOnlyProblemsFor(IPath[] expected) {
- if (DEBUG)
- printProblems();
-
- Problem[] rootProblems = env.getProblems();
- Hashtable actual = new Hashtable(rootProblems.length * 2 + 1);
- for (int i = 0; i < rootProblems.length; i++) {
- IPath culprit = rootProblems[i].getResourcePath();
- actual.put(culprit, culprit);
- }
-
- for (int i = 0; i < expected.length; i++)
- if (!actual.containsKey(expected[i]))
- assertTrue("missing expected problem with " + expected[i].toString(), false); //$NON-NLS-1$
-
- if (actual.size() > 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;
- }
- }
- 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 expected) {
- expectingProblemsFor(new IPath[] { expected });
- }
-
- /** Verifies that the given elements have problems.
- */
- protected void expectingProblemsFor(IPath[] expected) {
- if (DEBUG)
- printProblemsFor(expected);
-
- for (int i = 0; i < expected.length; i++) {
- /* get the leaf problems for this type */
- Problem[] problems = env.getProblemsFor(expected[i]);
- assertTrue("missing expected problem with " + expected[i].toString(), problems.length > 0); //$NON-NLS-1$
- }
- }
-
- /** 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];
- System.out.println("got pb: new Problem(\"" + pb.getLocation() + "\", \"" + pb.getMessage() + "\", \"" + pb.getResourcePath() + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- assertTrue("missing expected problem : " + problem, false); //$NON-NLS-1$
- }
- }
-
- /** Batch builds the workspace.
- */
- protected void fullBuild() {
- debugRequestor.clearResult();
- debugRequestor.activate();
- env.fullBuild();
- debugRequestor.deactivate();
- }
-
- /** Batch builds the given project.
- */
- protected void fullBuild(IPath projectPath) {
- debugRequestor.clearResult();
- debugRequestor.activate();
- env.fullBuild(projectPath);
- debugRequestor.deactivate();
- }
-
- /** Incrementally builds the given project.
- */
- protected void incrementalBuild(IPath projectPath) {
- debugRequestor.clearResult();
- debugRequestor.activate();
- env.incrementalBuild(projectPath);
- debugRequestor.deactivate();
- }
-
- /** Incrementally builds the workspace.
- */
- protected void incrementalBuild() {
- debugRequestor.clearResult();
- debugRequestor.activate();
- env.incrementalBuild();
- 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);
- for (int j = 0; j < problems.length; j++)
- System.out.println(problems[j].toString());
- }
- }
-
- /** Sets up this test.
- */
- protected void setUp() {
- debugRequestor = new EfficiencyCompilerRequestor();
- Compiler.DebugRequestor = 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());
- }
-
- public static Test suite() {
- TestSuite suite = new FilteredTestSuite(EXCLUDED_TESTS);
-
- /* tests */
- suite.addTest(AbstractMethodTests.suite());
- suite.addTest(BasicBuildTests.suite());
- suite.addTest(ClasspathTests.suite());
- suite.addTest(CompilationUnitLocationTests.suite());
- suite.addTest(CopyResourceTests.suite());
- suite.addTest(ErrorsTests.suite());
- suite.addTest(EfficiencyTests.suite());
- suite.addTest(ExecutionTests.suite());
- suite.addTest(IncrementalTests.suite());
- suite.addTest(JCLTests.suite());
- suite.addTest(MultiProjectTests.suite());
- suite.addTest(MultiSourceFolderAndOutputFolderTests.suite());
- suite.addTest(OutputFolderTests.suite());
- suite.addTest(PackageTests.suite());
- suite.addTest(StaticFinalTests.suite());
-
- return suite;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.builder/test.xml b/org.eclipse.jdt.core.tests.builder/test.xml
deleted file mode 100644
index 41cb3b6..0000000
--- a/org.eclipse.jdt.core.tests.builder/test.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <property name="eclipse-home" value="${basedir}\..\.."/>
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="plugin-name" value="org.eclipse.jdt.core.tests.builder"/>
- <property name="library-file"
- value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property name="jdt-builder-folder"
- value="${eclipse-home}/jdt_builder_folder"/>
- <delete dir="${jdt-builder-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jdt-builder-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jdt.core.tests.builder.Tests"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
diff --git a/org.eclipse.jdt.core.tests.compiler/.classpath b/org.eclipse.jdt.core.tests.compiler/.classpath
deleted file mode 100644
index 48572db..0000000
--- a/org.eclipse.jdt.core.tests.compiler/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="/org.junit"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.debug"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.core"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.compiler/.cvsignore b/org.eclipse.jdt.core.tests.compiler/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/org.eclipse.jdt.core.tests.compiler/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/.project b/org.eclipse.jdt.core.tests.compiler/.project
deleted file mode 100644
index 7d98a6c..0000000
--- a/org.eclipse.jdt.core.tests.compiler/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core.tests.compiler</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.jdt.core</project>
- <project>org.eclipse.jdt.debug</project>
- <project>org.junit</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.compiler/about.html b/org.eclipse.jdt.core.tests.compiler/about.html
deleted file mode 100644
index 2c7906e..0000000
--- a/org.eclipse.jdt.core.tests.compiler/about.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org 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
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Third Party Content</h3>
-
-<p>The Content includes items that may be have been sourced from third parties as follows:</p>
-
-<p><b>JUnit 3.7</b></p>
-<p>The plug-in is based on software developed by JUnit.org. Your use of JUnit 3.7 in both source and binary code
-form contained in the plug-in is subject to the terms and conditions of the IBM Public License 1.0 which is available at
-<a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>.
-The source code is located in src/org/eclipse/jdt/core/tests/junit/extension.</p>
-
-<p>i) IBM effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;</p>
-<p>ii) IBM effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;</p>
-<p>iii) IBM states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/build.properties b/org.eclipse.jdt.core.tests.compiler/build.properties
deleted file mode 100644
index 349d37d..0000000
--- a/org.eclipse.jdt.core.tests.compiler/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- test.xml,\
- about.html,\
- *.jar
-source.jdtcoretestscompiler.jar = src
-src.includes=about.html
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/plugin.xml b/org.eclipse.jdt.core.tests.compiler/plugin.xml
deleted file mode 100644
index 89564d5..0000000
--- a/org.eclipse.jdt.core.tests.compiler/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.jdt.core.tests.compiler"
- name="Java Compiler Tests"
- version="2.1.0">
-
- <runtime>
- <library name="jdtcoretestscompiler.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.junit"/>
- <import plugin="org.eclipse.jdt.debug"/>
- <import plugin="org.eclipse.jdt.core"/>
- </requires>
-
-
-</plugin>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip b/org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip
deleted file mode 100644
index 19bb2e9..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java
deleted file mode 100644
index 2df8cde..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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.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.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;
-
-public abstract class AbstractCompletionTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
-
- public final static String NONE = "<NONE>";
-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();
- CompletionParser parser =
- new CompletionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())),
- options.sourceLevel);
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
- CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation);
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString(0);
- String computedParentCompletion = parser.assistNodeParent == null
- ? NONE
- : parser.assistNodeParent.toString(0);
- String computedUnitToString = unit.toString();
- //System.out.println(computedUnitToString);
- //System.out.println(Util.displayString(computedUnitToString));
- //System.out.println(expectedUnitToString);
-
- assertEquals(
- "invalid completion node-" + testName,
- expectedCompletion,
- computedCompletion);
-
- if(expectedParentCompletion != null) {
- assertEquals(
- "invalid completion parent node-" + testName,
- expectedParentCompletion,
- computedParentCompletion);
- }
-
- assertEquals(
- "invalid completion tree-" + testName,
- expectedUnitToString,
- computedUnitToString);
-
- if (expectedCompletionIdentifier != null){
- char[] chars = ((CompletionScanner)parser.scanner).completionIdentifier;
- String computedCompletionIdentifier = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid completion identifier-" + testName,
- expectedCompletionIdentifier,
- computedCompletionIdentifier);
- }
-
- if (expectedReplacedSource != 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 (((CompletionScanner)parser.scanner).completedIdentifierEnd
- >= ((CompletionScanner)parser.scanner).completedIdentifierStart){
- chars = CharOperation.subarray(
- parser.scanner.source,
- ((CompletionScanner)parser.scanner).completedIdentifierStart,
- ((CompletionScanner)parser.scanner).completedIdentifierEnd + 1);
- }
- }
- }
- String computedReplacedSource = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid replaced source-" + testName,
- expectedReplacedSource,
- computedReplacedSource);
- }
-}
-/*
- * 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();
- CompletionParser parser =
- new CompletionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())),
- options.sourceLevel);
-
- 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;
- }
- }
- }
- assertTrue("no method found at cursor location", foundMethod != null);
- if (foundMethod instanceof AbstractMethodDeclaration) {
- parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit);
- } else {
- TypeDeclaration type = (TypeDeclaration)foundMethod;
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.fields[i];
- if (field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) {
- if (field instanceof Initializer) {
- parser.parseBlockStatements((Initializer)field, type, unit);
- break;
- } else {
- assertTrue("TBD", false); // field initializer
- }
- }
- }
- }
- }
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString(0);
- String computedParentCompletion = parser.assistNodeParent == null
- ? NONE
- : parser.assistNodeParent.toString(0);
- String computedUnitToString = unit.toString();
- //System.out.println(computedUnitToString);
- //System.out.println(Util.displayString(computedUnitToString));
- //System.out.println(expectedUnitToString);
-
- assertEquals(
- "invalid completion node-" + testName,
- expectedCompletion,
- computedCompletion);
-
- if(expectedParentCompletion != null) {
- assertEquals(
- "invalid completion parent node-" + testName,
- expectedParentCompletion,
- computedParentCompletion);
- }
-
- assertEquals(
- "invalid completion location-"+testName,
- expectedUnitToString,
- computedUnitToString);
-
- if (expectedCompletionIdentifier != null){
- char[] chars = ((CompletionScanner)parser.scanner).completionIdentifier;
- String computedCompletionIdentifier = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid completion identifier-" + testName,
- expectedCompletionIdentifier,
- computedCompletionIdentifier);
- }
- if (expectedReplacedSource != 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 (((CompletionScanner)parser.scanner).completedIdentifierEnd
- >= ((CompletionScanner)parser.scanner).completedIdentifierStart){
- chars = CharOperation.subarray(
- parser.scanner.source,
- ((CompletionScanner)parser.scanner).completedIdentifierStart,
- ((CompletionScanner)parser.scanner).completedIdentifierEnd + 1);
- }
- }
- }
- String computedReplacedSource = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid replaced source-" + testName,
- expectedReplacedSource,
- computedReplacedSource);
- if (expectedReplacedSource.length() == 0) {
- assertEquals(
- "invalid insertion point-" + testName,
- cursorLocation + 1,
- parser.assistNode.sourceStart);
- }
- }
- if (expectedLabels != null) {
-// int length = (parser.labels == null) ? 0 : 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 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);
-}
-/*
- * 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;
- }
- }
- }
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.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/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java
deleted file mode 100644
index dd58947..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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;
-
-public abstract class AbstractSelectionTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
-
- public final static String NONE = "<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();
- SelectionParser parser =
- new SelectionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())),
- options.sourceLevel);
-
- 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(0);
- assertEquals(
- "invalid selection node-" + testName,
- expectedSelection,
- computedSelection);
-
- assertEquals(
- "invalid selection tree-" + 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();
- SelectionParser parser =
- new SelectionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())),
- options.sourceLevel);
-
- 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;
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.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(Util.displayString(computedUnitToString));
- //System.out.println(expectedUnitToString);
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString(0);
- assertEquals(
- "invalid selection node-" + testName,
- expectedSelection,
- computedCompletion);
-
- assertEquals(
- "invalid selection location-"+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;
- }
- }
- }
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.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/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java
deleted file mode 100644
index 824044e..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be an AllocationExpression.
- */
-public class AllocationExpressionCompletionTest extends AbstractCompletionTest {
-public AllocationExpressionCompletionTest(String testName) {
- super(testName);
-}
-
-/*
- * Completion inside an if statement.
- */
-public void testInIfStatement() {
- 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:
- "<CompleteOnAllocationExpression:new z.y.X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete inside an if statement>"
- );
-}
-/*
- * 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 testNoQualificationQualifiedTypeName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new z.y.X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnAllocationExpression:new z.y.X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on non qualified instance creation with qualified type 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 testNoQualificationSimpleTypeName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnAllocationExpression:new X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on non qualified instance creation with simple type name>"
- );
-}
-/*
- * Completion on a constructor invocation qualified with a name.
- *
- * ie. ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testQualifiedWithName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar {\n" +
- " void foo() { \n" +
- " Buz.x.new X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on name qualified instance creation>"
- );
-}
-/*
- * Completion on a constructor invocation qualified with a primary.
- *
- * ie. ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testQualifiedWithPrimary() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " primary().new X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on primary qualified instance creation>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java
deleted file mode 100644
index 482a541..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be a ClassLiteralAccess.
- */
-public class ClassLiteralAccessCompletionTest extends AbstractCompletionTest {
-public ClassLiteralAccessCompletionTest(String testName) {
- super(testName);
-}
-/*
- * Completion on the keyword 'class' on an array type
- */
-public void testArrayType() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " String[].; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "String[].",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:String[].>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:String[].>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "String[].",
- // test name
- "<complete on array type member>"
- );
-}
-/*
- * Test access to the keyword 'class' on an array type
- * where the keyword is non empty.
- */
-public void testArrayTypeWithNonEmptyIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " String[].class; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "String[].cl",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:String[].cl>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:String[].cl>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "cl",
- // expectedReplacedSource:
- "String[].class",
- // test name
- "<complete on array type member with non empty identifier>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive array type
- */
-public void testPrimitiveArrayType() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[].; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int[].",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int[].>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int[].>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "int[].",
- // test name
- "<complete on primitive array type member>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive array type where the
- * keyword is non empty
- */
-public void testPrimitiveArrayTypeWithNonEmptyIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[].class; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int[].cl",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int[].cl>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int[].cl>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "cl",
- // expectedReplacedSource:
- "int[].class",
- // test name
- "<complete on primitive array type member with non empty identifier>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive type
- */
-public void testPrimitiveType() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int.; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int.",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int.>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "int.",
- // test name
- "<complete on primitive type member>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive type where the
- * keyword is non empty
- */
-public void testPrimitiveTypeWithNonEmptyIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int.class; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int.cl",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int.cl>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int.cl>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "cl",
- // expectedReplacedSource:
- "int.class",
- // test name
- "<complete on primitive type member with non empty identifier>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java
deleted file mode 100644
index f3e9114..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java
+++ /dev/null
@@ -1,8533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import org.eclipse.jdt.internal.codeassist.complete.*;
-
-public class CompletionParserTest extends AbstractCompletionTest {
-public CompletionParserTest(String testName) {
- super(testName);
-}
-public void testA() {
- String str =
- "package p; \n" +
- "public class A {\n" +
- " public void foo(\n" +
- " java.util.Locale, \n" +
- " java.util.Vector) {\n" +
- " int i;\n" +
- " if (i instanceof O) {\n" +
- " }\n" +
- " String s = \"hello\";\n" +
- " s.}\n" +
- "}\n";
-
- String testName = "<complete on methods/fields>";
- String completeBehind = "s.";
- String expectedCompletionNodeToString = "<CompleteOnName:s.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "s.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " {\n" +
- " int i;\n" +
- " String s;\n" +
- " <CompleteOnName:s.>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAA_1() {
- String str =
- "package p; \n" +
- "import something; \n" +
- "import p2.; \n" +
- "public class AA {\n" +
- " void foo() {\n" +
- " int maxUnits = 0;\n" +
- " for (int i = 0; \n" +
- " i < maxUnits; \n" +
- " i++) {\n" +
- " CompilationUnitResult unitResult = \n" +
- " new CompilationUnitResult(\n" +
- " null, \n" +
- " i, \n" +
- " maxUnits); \n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import something;\n" +
- "public class AA {\n" +
- " public AA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int maxUnits;\n" +
- " int i;\n" +
- " {\n" +
- " CompilationUnitResult unitResult = <CompleteOnName:n>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new";
- String testName = "<complete on initializer (new)>";
-
- int cursorLocation = str.indexOf("new CompilationUnitResult(") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAA_2() {
- String str =
- "package p; \n" +
- "import something; \n" +
- "import p2.; \n" +
- "public class AA {\n" +
- " void foo() {\n" +
- " int maxUnits = 0;\n" +
- " for (int i = 0; \n" +
- " i < maxUnits; \n" +
- " i++) {\n" +
- " CompilationUnitResult unitResult = \n" +
- " new CompilationUnitResult(\n" +
- " null, \n" +
- " i, \n" +
- " maxUnits); \n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method call argument>";
- String completeBehind = "n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedReplacedSource = "null";
- int cursorLocation = str.indexOf("null, ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import something;\n" +
- "public class AA {\n" +
- " public AA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int maxUnits;\n" +
- " int i;\n" +
- " {\n" +
- " CompilationUnitResult unitResult = new CompilationUnitResult(<CompleteOnName:n>);\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAA_3() {
- String str =
- "package p; \n" +
- "import something; \n" +
- "import p2.; \n" +
- "public class AA {\n" +
- " void foo() {\n" +
- " int maxUnits = 0;\n" +
- " for (int i = 0; \n" +
- " i < maxUnits; \n" +
- " i++) {\n" +
- " CompilationUnitResult unitResult = \n" +
- " new CompilationUnitResult(\n" +
- " null, \n" +
- " i, \n" +
- " maxUnits); \n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on call to constructor argument>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = "<CompleteOnName:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf("i, ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import something;\n" +
- "public class AA {\n" +
- " public AA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int maxUnits;\n" +
- " int i;\n" +
- " {\n" +
- " CompilationUnitResult unitResult = new CompilationUnitResult(null, <CompleteOnName:i>);\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAA_4() {
- String str =
- "package p; \n" +
- "import something; \n" +
- "import p2.; \n" +
- "public class AA {\n" +
- " void foo() {\n" +
- " int maxUnits = 0;\n" +
- " for (int i = 0; \n" +
- " i < maxUnits; \n" +
- " i++) {\n" +
- " CompilationUnitResult unitResult = \n" +
- " new CompilationUnitResult(\n" +
- " null, \n" +
- " i, \n" +
- " maxUnits); \n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on constructor call argument>";
- String completeBehind = "max";
- String expectedCompletionNodeToString = "<CompleteOnName:max>";
- String completionIdentifier = "max";
- String expectedReplacedSource = "maxUnits";
- int cursorLocation = str.indexOf("maxUnits); ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import something;\n" +
- "public class AA {\n" +
- " public AA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int maxUnits;\n" +
- " int i;\n" +
- " {\n" +
- " CompilationUnitResult unitResult = new CompilationUnitResult(null, i, <CompleteOnName:max>);\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAB_1FHU9LU() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHU9LU\n" +
- " */\n" +
- "class SuperClass {\n" +
- " static void eFooStatic() {\n" +
- " }\n" +
- " void eFoo() {\n" +
- " }\n" +
- "}\n" +
- "public class AB\n" +
- " extends SuperClass {\n" +
- " void eBar() {\n" +
- " super.eFoo();\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on methods/fields from super class>";
- String completeBehind = "super.";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:super.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "super.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class SuperClass {\n" +
- " SuperClass() {\n" +
- " }\n" +
- " static void eFooStatic() {\n" +
- " }\n" +
- " void eFoo() {\n" +
- " }\n" +
- "}\n" +
- "public class AB extends SuperClass {\n" +
- " public AB() {\n" +
- " }\n" +
- " void eBar() {\n" +
- " <CompleteOnMemberAccess:super.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAC_1FJ8D9Z_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ8D9Z\n" +
- " */\n" +
- "import java.io.*;\n" +
- "public class AC {\n" +
- " AC() {\n" +
- " }\n" +
- " AC(int i) {\n" +
- " }\n" +
- " AC(int i, String s) {\n" +
- " }\n" +
- " void foo() {\n" +
- " new AC(new File(\n" +
- " new java\n" +
- " .util\n" +
- " .Vector(}\n" +
- "}\n";
-
- String testName = "<complete on constructor argument>";
- String completeBehind = "new AC(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new AC()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.io.*;\n" +
- "public class AC {\n" +
- " AC() {\n" +
- " }\n" +
- " AC(int i) {\n" +
- " }\n" +
- " AC(int i, String s) {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new AC()>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAC_1FJ8D9Z_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ8D9Z\n" +
- " */\n" +
- "import java.io.*;\n" +
- "public class AC {\n" +
- " AC() {\n" +
- " }\n" +
- " AC(int i) {\n" +
- " }\n" +
- " AC(int i, String s) {\n" +
- " }\n" +
- " void foo() {\n" +
- " new AC(new File(\n" +
- " new java\n" +
- " .util\n" +
- " .Vector(}\n" +
- "}\n";
-
- String testName = "<complete on constructor argument>";
- String completeBehind = "new File(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new File()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.io.*;\n" +
- "public class AC {\n" +
- " AC() {\n" +
- " }\n" +
- " AC(int i) {\n" +
- " }\n" +
- " AC(int i, String s) {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new File()>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testAC_1FJ8D9Z_3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ8D9Z\n" +
- " */\n" +
- "import java.io.*;\n" +
- "public class AC {\n" +
- " AC() {\n" +
- " }\n" +
- " AC(int i) {\n" +
- " }\n" +
- " AC(int i, String s) {\n" +
- " }\n" +
- " void foo() {\n" +
- " new AC(new File(\n" +
- " new java.util.Vector(}\n" +
- "}\n";
-
- String testName = "<complete on constructor argument>";
- String completeBehind = "new java.util.Vector(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new java.util.Vector()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.io.*;\n" +
- "public class AC {\n" +
- " AC() {\n" +
- " }\n" +
- " AC(int i) {\n" +
- " }\n" +
- " AC(int i, String s) {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new java.util.Vector()>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testB() {
- String str =
- "package p; \n" +
- "public class B {\n" +
- " Object o = new Object }\n";
-
- String testName = "<complete on type into type creation>";
- String completeBehind = "new Object";
- String expectedCompletionNodeToString = "<CompleteOnType:Object>";
- String completionIdentifier = "Object";
- String expectedReplacedSource = "Object";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class B {\n" +
- " Object o = new <CompleteOnType:Object>();\n" +
- " public B() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testBA_1() {
- String str =
- "package p; \n" +
- "public class BA {\n" +
- " void foo() {\n" +
- " java.util.Vector v2;\n" +
- " java.util.Vector v1;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on package name>";
- String completeBehind = "java.";
- String expectedCompletionNodeToString = "<CompleteOnName:java.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "java.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class BA {\n" +
- " public BA() {\n" +
-
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:java.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testBA_2() {
- String str =
- "package p; \n" +
- "public class BA {\n" +
- " void foo() {\n" +
- " java.util.Vector v2;\n" +
- " java.util.Vector v1;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on package contents>";
- String completeBehind = "java.util.";
- String expectedCompletionNodeToString = "<CompleteOnName:java.util.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "java.util.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class BA {\n" +
- " public BA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:java.util.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testBB_1FHJ8H9() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHJ8H9\n" +
- " */\n" +
- "public class BB {\n" +
- " void bar() {\n" +
- " f }\n" +
- "}\n";
-
- String testName = "<complete on method/field from implicit method call>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class BB {\n" +
- " public BB() {\n" +
- " }\n" +
- " void bar() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testBC_1FJ4GSG_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ4GSG\n" +
- " */\n" +
- "import java.util.Vector;\n" +
- "public class BC {\n" +
- " int Value1 = 0;\n" +
- " interface Constants {\n" +
- " int OK = 1;\n" +
- " int CANCEL = 2;\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v = \n" +
- " new Vector(\n" +
- " Value1, \n" +
- " BC.Constants.OK\n" +
- " | BC.Constants.CANCEL); \n" +
- " Object ans = v.elementAt(1);\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on member type>";
- String completeBehind = "BC.";
- String expectedCompletionNodeToString = "<CompleteOnName:BC.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "BC.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.Vector;\n" +
- "public class BC {\n" +
- " interface Constants {\n" +
- " int OK;\n" +
- " int CANCEL;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " }\n" +
- " int Value1;\n" +
- " public BC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v = new Vector(Value1, <CompleteOnName:BC.>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testBC_1FJ4GSG_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ4GSG\n" +
- " */\n" +
- "import java.util.Vector;\n" +
- "public class BC {\n" +
- " int Value1 = 0;\n" +
- " interface Constants {\n" +
- " int OK = 1;\n" +
- " int CANCEL = 2;\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v = \n" +
- " new Vector(\n" +
- " Value1, \n" +
- " BC.Constants.OK\n" +
- " | BC.Constants.CANCEL); \n" +
- " Object ans = v.elementAt(1);\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on member type method/field>";
- String completeBehind = "| BC.Constants.";
- String expectedCompletionNodeToString = "<CompleteOnName:BC.Constants.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "BC.Constants.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.Vector;\n" +
- "public class BC {\n" +
- " interface Constants {\n" +
- " int OK;\n" +
- " int CANCEL;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " }\n" +
- " int Value1;\n" +
- " public BC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v = (BC.Constants.OK | <CompleteOnName:BC.Constants.>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testBC_1FJ4GSG_3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ4GSG\n" +
- " */\n" +
- "import java.util.Vector;\n" +
- "public class BC {\n" +
- " int Value1 = 0;\n" +
- " interface Constants {\n" +
- " int OK = 1;\n" +
- " int CANCEL = 2;\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v = \n" +
- " new Vector(\n" +
- " Value1, \n" +
- " BC.Constants.OK\n" +
- " | BC.Constants.CANCEL); \n" +
- " Object ans = v.elementAt(1);\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "v.";
- String expectedCompletionNodeToString = "<CompleteOnName:v.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "v.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.Vector;\n" +
- "public class BC {\n" +
- " interface Constants {\n" +
- " int OK;\n" +
- " int CANCEL;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " }\n" +
- " int Value1;\n" +
- " public BC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v;\n" +
- " Object ans = <CompleteOnName:v.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testC() {
- String str =
- "package p; \n" +
- "public class C {\n" +
- " void foo() {\n" +
- " String string = n;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "= n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class C {\n" +
- " public C() {\n" +
- " }\n" +
- " void foo() {\n" +
- " String string = <CompleteOnName:n>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "n";
- String testName = "<complete on local variable initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testCA_1FGPJQZ() {
- String str =
- "package p; \n" +
- "import p2.X; \n" +
- "/**\n" +
- " * 1FGPJQZ\n" +
- " */\n" +
- "public class CA {\n" +
- " void moo() {\n" +
- " unknownField.}\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "unknownField.";
- String expectedCompletionNodeToString = "<CompleteOnName:unknownField.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "unknownField.";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.X;\n" +
- "public class CA {\n" +
- " public CA() {\n" +
- " }\n" +
- " void moo() {\n" +
- " <CompleteOnName:unknownField.>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testCB_1FHSKQ9_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSKQ9\n" +
- " */\n" +
- "public class CB {\n" +
- " void foo() {\n" +
- " int i = 0;\n" +
- " int[] tab1 = new int[10];\n" +
- " int j = tab1[i];\n" +
- " System.out.println(\n" +
- " \" \" + (i + 1)); \n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method call argument>";
- String completeBehind = "+ (i";
- String expectedCompletionNodeToString = "<CompleteOnName:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class CB {\n" +
- " public CB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " int[] tab1;\n" +
- " int j;\n" +
- " (\" \" + <CompleteOnName:i>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testCB_1FHSKQ9_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSKQ9\n" +
- " */\n" +
- "public class CB {\n" +
- " void foo() {\n" +
- " int i = 0;\n" +
- " int[] tab1 = new int[10];\n" +
- " int j = tab1[i];\n" +
- " System.out.println(\n" +
- " \" \" + (i + 1)); \n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "i + 1";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedUnitDisplayString = null;
- String expectedReplacedSource = NONE;
- String testName = "<complete on digit into method call argument>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER);
- }
-}
-public void testCC_1FJ64I9() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ64I9\n" +
- " */\n" +
- "class CCHelper {\n" +
- " class Member1 {\n" +
- " }\n" +
- " class Member2 {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class CC {\n" +
- " void foo() {\n" +
- " new CCHelper()\n" +
- " .new CCHelper()\n" +
- " .new M }\n" +
- "}\n";
-
- String testName = "<complete on qualified member type>";
- String completeBehind = ".new M";
- String expectedCompletionNodeToString = "<CompleteOnType:M>";
- String completionIdentifier = "M";
- String expectedReplacedSource = "M";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class CCHelper {\n" +
- " class Member1 {\n" +
- " Member1() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " CCHelper() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class CC {\n" +
- " public CC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new CCHelper().new CCHelper().new <CompleteOnType:M>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testD_1() {
- String str =
- "package p; \n" +
- "import java.util.*;\n" +
- "public class D {\n" +
- " static int i;\n" +
- " static {\n" +
- " i = 5;\n" +
- " }\n" +
- " public int j;\n" +
- " Vector a = new Vector();\n" +
- " void foo(String s) {\n" +
- " String string = null;\n" +
- " int soso;\n" +
- " float f;\n" +
- " string.regionMatches(\n" +
- " 0, \n" +
- " \"\", \n" +
- " 0, \n" +
- " 0); \n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on variable into type initializer>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = "<CompleteOnName:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf("i = 5;") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.*;\n" +
- "public class D {\n" +
- " static int i;\n" +
- " static {\n" +
- " <CompleteOnName:i>;\n" +
- " }\n" +
- " public int j;\n" +
- " Vector a;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public D() {\n" +
- " }\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testD_2() {
- String str =
- "package p; \n" +
- "import java.util.*;\n" +
- "public class D {\n" +
- " static int i;\n" +
- " static {\n" +
- " i = 5;\n" +
- " }\n" +
- " public int j;\n" +
- " Vector a = new Vector();\n" +
- " void foo(String s) {\n" +
- " String string = null;\n" +
- " int soso;\n" +
- " float f;\n" +
- " string.regionMatches(\n" +
- " 0, \n" +
- " \"\", \n" +
- " 0, \n" +
- " 0); \n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "string.";
- String expectedCompletionNodeToString = "<CompleteOnName:string.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "string.";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.*;\n" +
- "public class D {\n" +
- " static int i;\n" +
- " static {\n" +
- " }\n" +
- " public int j;\n" +
- " Vector a;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public D() {\n" +
- " }\n" +
- " void foo(String s) {\n" +
- " String string;\n" +
- " int soso;\n" +
- " float f;\n" +
- " <CompleteOnName:string.>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDA_1() {
- String str =
- "package p; \n" +
- "public class DA {\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field into anonymous declaration>";
- String completeBehind = "v";
- String expectedCompletionNodeToString = "<CompleteOnName:v>";
- String completionIdentifier = "v";
- String expectedReplacedSource = "v";
- int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DA {\n" +
- " public DA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " () {\n" +
- " }\n" +
- " protected void runTest() {\n" +
- " Vector v11111;\n" +
- " <CompleteOnName:v>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDA_2() {
- String str =
- "package p; \n" +
- "public class DA {\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "protected v";
- String expectedCompletionNodeToString = "<CompleteOnType:v>";
- String completionIdentifier = "v";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DA {\n" +
- " public DA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " <CompleteOnType:v>;\n" +
- " () {\n" +
- " }\n" +
- " runTest() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "void";
- String testName = "<complete on return type into anonymous declaration>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDA_3() {
- String str =
- "package p; \n" +
- "public class DA {\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method selector into anonymous declaration>";
- String completeBehind = "r";
- String expectedCompletionNodeToString = "<CompleteOnFieldName:void r>";
- String completionIdentifier = "r";
- String expectedReplacedSource = "runTest";
- int cursorLocation = str.indexOf("runTest") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DA {\n" +
- " public DA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " <CompleteOnFieldName:void r>;\n" +
- " {\n" +
- " }\n" +
- " () {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDA_4() {
- String str =
- "package p; \n" +
- "public class DA {\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on local variable type into anonymous declaration>";
- String completeBehind = "V";
- String expectedCompletionNodeToString = "<CompleteOnName:V>";
- String completionIdentifier = "V";
- String expectedReplacedSource = "Vector";
- int cursorLocation = str.indexOf("Vector v11111") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DA {\n" +
- " public DA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " () {\n" +
- " }\n" +
- " protected void runTest() {\n" +
- " <CompleteOnName:V>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDA_5() {
- String str =
- "package p; \n" +
- "public class DA {\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on local type into anonymous declaration>";
- String completeBehind = "v";
- String expectedCompletionNodeToString = "<CompleteOnName:v>";
- String completionIdentifier = "v";
- String expectedReplacedSource = "v";
- int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DA {\n" +
- " public DA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new TestCase(\"error\") {\n" +
- " () {\n" +
- " }\n" +
- " protected void runTest() {\n" +
- " Vector v11111;\n" +
- " <CompleteOnName:v>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDB_1FHSLDR() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSLDR\n" +
- " */\n" +
- "public class DB {\n" +
- " void foo() {\n" +
- " try {\n" +
- " System.out.println(\"\");\n" +
- " }\n" +
- " fi }\n" +
- "}\n";
-
- String testName = "<complete on finally keyword>";
- String completeBehind = "fi";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fi>";
- String completionIdentifier = "fi";
- String expectedReplacedSource = "fi";
- int cursorLocation = str.indexOf("fi }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DB {\n" +
- " public DB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:fi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testDC_1FJJ0JR_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJJ0JR\n" +
- " */\n" +
- "public class DC\n" +
- " extends ModelChangeOperation {\n" +
- " ISec public SetSecondarySourceOperation(\n" +
- " ISecondarySourceContainer element, \n" +
- " VersionID id) {\n" +
- " }\n" +
- " protected abstract void doExecute(IProgressMonitor monitor)\n" +
- " throws OperationFailedException {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method return type>";
- String completeBehind = "ISec";
- String expectedCompletionNodeToString = "<CompleteOnType:ISec>";
- String completionIdentifier = "ISec";
- String expectedReplacedSource = "ISec";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class DC extends ModelChangeOperation {\n" +
- " <CompleteOnType:ISec>;\n" +
- " public DC() {\n" +
- " }\n" +
- " public SetSecondarySourceOperation(ISecondarySourceContainer element, VersionID id) {\n" +
- " }\n" +
- " protected abstract void doExecute(IProgressMonitor monitor) throws OperationFailedException;\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testE_1FG1YDS_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FG1YDS\n" +
- " */\n" +
- "public class E {\n" +
- " {\n" +
- " new Y()\n" +
- " }\n" +
- " {\n" +
- " new Y().}\n" +
- " class Y\n" +
- " extends java.util.Vector {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on type into type creation>";
- String completeBehind = "Y";
- String expectedCompletionNodeToString = "<CompleteOnType:Y>";
- String completionIdentifier = "Y";
- String expectedReplacedSource = "Y";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class E {\n" +
- " class Y extends java.util.Vector {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " new <CompleteOnType:Y>();\n" +
- " }\n" +
- " {\n" +
- " }\n" +
- " public E() {\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("Y()\n") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testE_1FG1YDS_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FG1YDS\n" +
- " */\n" +
- "public class E {\n" +
- " {\n" +
- " new Y()\n" +
- " }\n" +
- " {\n" +
- " new Y().}\n" +
- " class Y\n" +
- " extends java.util.Vector {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on implicit method call into intializer>";
- String completeBehind = "new Y().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class E {\n" +
- " class Y extends java.util.Vector {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " }\n" +
- " {\n" +
- " <CompleteOnMemberAccess:new Y().>;\n" +
- " }\n" +
- " public E() {\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testE_1FG1YDS_3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FG1YDS\n" +
- " */\n" +
- "public class E {\n" +
- " {\n" +
- " new Y()\n" +
- " }\n" +
- " {\n" +
- " new Y().}\n" +
- " class Y\n" +
- " extends java.util.Vector {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on extend type>";
- String completeBehind = "java.util.";
- String expectedCompletionNodeToString = "<CompleteOnClass:java.util.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "java.util.Vector";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class E {\n" +
- " class Y extends <CompleteOnClass:java.util.> {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " }\n" +
- " {\n" +
- " }\n" +
- " public E() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testEA_1() {
- String str =
- "package p; \n" +
- "public class EA {\n" +
- " void foo() {\n" +
- " try {\n" +
- " throw new Error();\n" +
- " } catch (Exception eeee) {\n" +
- " eeee.}\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on catch block exception type declaration>";
- String completeBehind = "E";
- String expectedCompletionNodeToString = "<CompleteOnException:E>";
- String completionIdentifier = "E";
- String expectedReplacedSource = "Exception";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class EA {\n" +
- " public EA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnException:E>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("Exception eeee") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testEA_2() {
- String str =
- "package p; \n" +
- "public class EA {\n" +
- " void foo() {\n" +
- " try {\n" +
- " throw new Error();\n" +
- " } catch (Exception eeee) {\n" +
- " eeee.}\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of thrown exception into catch block>";
- String completeBehind = "eeee.";
- String expectedCompletionNodeToString = "<CompleteOnName:eeee.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "eeee.";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class EA {\n" +
- " public EA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " Exception eeee;\n" +
- " <CompleteOnName:eeee.>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testEB_1FI74S3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FI74S3\n" +
- " */\n" +
- "public class EB {\n" +
- " int[] table;\n" +
- " void foo() {\n" +
- " int x = table.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "table.";
- String expectedCompletionNodeToString = "<CompleteOnName:table.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "table.";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class EB {\n" +
- " int[] table;\n" +
- " public EB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = <CompleteOnName:table.>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testEC_1FSBZ2Y() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSBZ2Y\n" +
- " */\n" +
- "class EC {\n" +
- " void foo() {\n" +
- " EC\n" +
- " }\n" +
- "}\n" +
- "class ECOtherTopLevel {\n" +
- "}\n";
-
- String testName = "<complete on local variable decaration type>";
- String completeBehind = "EC";
- String expectedCompletionNodeToString = "<CompleteOnName:EC>";
- String completionIdentifier = "EC";
- String expectedReplacedSource = "EC";
- String expectedUnitDisplayString =
- "package p;\n" +
- "class EC {\n" +
- " EC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:EC>;\n" +
- " }\n" +
- "}\n" +
- "class ECOtherTopLevel {\n" +
- " ECOtherTopLevel() {\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("EC\n") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testF() {
- String str =
- "package p; \n" +
- "public class F {\n" +
- " void bar() {\n" +
- " }\n" +
- " class Y {\n" +
- " void foo() {\n" +
- " ba }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field explicit access>";
- String completeBehind = "ba";
- String expectedCompletionNodeToString = "<CompleteOnName:ba>";
- String completionIdentifier = "ba";
- String expectedReplacedSource = "ba";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class F {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ba>;\n" +
- " }\n" +
- " }\n" +
- " public F() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("ba }") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testFA_1() {
- String str =
- "package p; \n" +
- "public class FA {\n" +
- " byte value;\n" +
- " public float foo() {\n" +
- " return (float) value;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on cast expression type>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "float";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class FA {\n" +
- " byte value;\n" +
- " public FA() {\n" +
- " }\n" +
- " public float foo() {\n" +
- " return <CompleteOnName:f>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("float)") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testFA_2() {
- String str =
- "package p; \n" +
- "public class FA {\n" +
- " byte value;\n" +
- " public float foo() {\n" +
- " return (float) value; \n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on returned value>";
- String completeBehind = "v";
- String expectedCompletionNodeToString = "<CompleteOnName:v>";
- String completionIdentifier = "v";
- String expectedReplacedSource = "value";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class FA {\n" +
- " byte value;\n" +
- " public FA() {\n" +
- " }\n" +
- " public float foo() {\n" +
- " (float) <CompleteOnName:v>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("value; \n") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testFB_1FI74S3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FI74S3\n" +
- " */\n" +
- "public class FB {\n" +
- " int[] table;\n" +
- " void foo() {\n" +
- " int x = table[1].}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array element>";
- String completeBehind = "table[1].";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:table[1].>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class FB {\n" +
- " int[] table;\n" +
- " public FB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = <CompleteOnMemberAccess:table[1].>;\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testFC_1FSBZ9B() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSBZ9B\n" +
- " */\n" +
- "class FC {\n" +
- " UNKOWNTYPE field;\n" +
- " void foo() {\n" +
- " f\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field implicit access>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf("f\n") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class FC {\n" +
- " UNKOWNTYPE field;\n" +
- " FC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testG() {
- String str =
- "package p; \n" +
- "public class G {\n" +
- " int bar() {\n" +
- " }\n" +
- " class Y {\n" +
- " void foo(int b) {\n" +
- " return b }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on return value>";
- String completeBehind = "b";
- String expectedCompletionNodeToString = "<CompleteOnName:b>";
- String completionIdentifier = "b";
- String expectedReplacedSource = "b";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class G {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo(int b) {\n" +
- " return <CompleteOnName:b>;\n" +
- " }\n" +
- " }\n" +
- " public G() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- int cursorLocation = str.indexOf("b }") + completeBehind.length() - 1;
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testGA() {
- String str =
- "package p; \n" +
- "public class GA {\n" +
- " void foo(String s) {\n" +
- " String string = s;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on local variable initializer>";
- String completeBehind = "s";
- String expectedCompletionNodeToString = "<CompleteOnName:s>";
- String completionIdentifier = "s";
- String expectedReplacedSource = "s";
- int cursorLocation = str.indexOf("s;") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class GA {\n" +
- " public GA() {\n" +
- " }\n" +
- " void foo(String s) {\n" +
- " String string = <CompleteOnName:s>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testGB_1FI74S3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FI74S3\n" +
- " */\n" +
- "public class GB {\n" +
- " String[] table;\n" +
- " void foo() {\n" +
- " int x = table[1].}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array element>";
- String completeBehind = "table[1].";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:table[1].>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class GB {\n" +
- " String[] table;\n" +
- " public GB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = <CompleteOnMemberAccess:table[1].>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testGC_1FSHLHV_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSHLHV\n" +
- " */\n" +
- "public class GC {\n" +
- "public static void main(String[] args) {\n" +
- " Object l = new Object() {\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s = new String();\n" +
- " s.\n" +
- " try {\n" +
- " event.;\n" +
- " }\n" +
- " catch (Exception e) {\n" +
- " e.\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "}\n";
-
- String testName = "<complete on anonymous declaration type>";
- String completeBehind = "O";
- String expectedCompletionNodeToString = "<CompleteOnType:O>";
- String completionIdentifier = "O";
- String expectedReplacedSource = "Object";
- int cursorLocation = str.indexOf("Object()") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class GC {\n" +
- " public GC() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " Object l = new <CompleteOnType:O>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testGC_1FSHLHV_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSHLHV\n" +
- " */\n" +
- "public class GC {\n" +
- "public static void main(String[] args) {\n" +
- " Object l = new Object() {\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s = new String();\n" +
- " s.\n" +
- " try {\n" +
- " event.;\n" +
- " }\n" +
- " catch (Exception e) {\n" +
- " e.\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "}\n";
-
- String testName = "<complete on method/field of local variable into anonymous declaration>";
- String completeBehind = "s.";
- String expectedCompletionNodeToString = "<CompleteOnName:s.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "s.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class GC {\n" +
- " public GC() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " Object l;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s;\n" +
- " <CompleteOnName:s.>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testGC_1FSHLHV_3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSHLHV\n" +
- " */\n" +
- "public class GC {\n" +
- "public static void main(String[] args) {\n" +
- " Object l = new Object() {\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s = new String();\n" +
- " s.\n" +
- " try {\n" +
- " event.;\n" +
- " }\n" +
- " catch (Exception e) {\n" +
- " e.\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "event.";
- String expectedCompletionNodeToString = "<CompleteOnName:event.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "event.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class GC {\n" +
- " public GC() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " Object l;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s;\n" +
- " {\n" +
- " <CompleteOnName:event.>;\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testGC_1FSHLHV_4() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSHLHV\n" +
- " */\n" +
- "public class GC {\n" +
- "public static void main(String[] args) {\n" +
- " Object l = new Object() {\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s = new String();\n" +
- " s.\n" +
- " try {\n" +
- " event.;\n" +
- " }\n" +
- " catch (Exception e) {\n" +
- " e.\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "}\n";
-
- String testName = "<complete on method/field of thrown exception into catch block into anonymous declaration>";
- String completeBehind = "e.";
- String expectedCompletionNodeToString = "<CompleteOnName:e.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "e.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class GC {\n" +
- " public GC() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " Object l;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " public void handleEvent(String[] event) {\n" +
- " String s;\n" +
- " {\n" +
- " Exception e;\n" +
- " <CompleteOnName:e.>;\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testH() {
- String str =
- "package p; \n" +
- "public class H {\n" +
- " void foo(boolean bbbb) {\n" +
- " while (Xbm }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on while keyword argument>";
- String completeBehind = "Xbm";
- String expectedCompletionNodeToString = "<CompleteOnName:Xbm>";
- String completionIdentifier = "Xbm";
- String expectedReplacedSource = "Xbm";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class H {\n" +
- " public H() {\n" +
- " }\n" +
- " void foo(boolean bbbb) {\n" +
- " <CompleteOnName:Xbm>;\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testHA_1() {
- String str =
- "package p; \n" +
- "public class HA {\n" +
- " void foo() {\n" +
- " x.y.Z[] field1; \n" +
- " field1[1].}\n" +
- "}\n";
-
- String testName = "<complete on package member type>";
- String completeBehind = "x.y.";
- String expectedCompletionNodeToString = "<CompleteOnName:x.y.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "x.y.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class HA {\n" +
- " public HA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:x.y.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testHA_2() {
- String str =
- "package p; \n" +
- "public class HA {\n" +
- " void foo() {\n" +
- " x.y.Z[] field1; \n" +
- " field1[1].}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array element>";
- String completeBehind = "field1[1].";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:field1[1].>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class HA {\n" +
- " public HA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " x.y.Z[] field1;\n" +
- " <CompleteOnMemberAccess:field1[1].>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testHB_1FHSLDR() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSLDR\n" +
- " */\n" +
- "public class HB {\n" +
- " void foo() {\n" +
- " for (; i < totalUnits; i++) {\n" +
- " unit = unitsToProcess[i];\n" +
- " try {\n" +
- " if (options.verbose) {\n" +
- " System.out.println(\n" +
- " \"process \"\n" +
- " + (i + 1)\n" +
- " + \"/\"\n" +
- " + totalUnits\n" +
- " + \" : \"\n" +
- " + unitsToProcess[i]\n" +
- " .sourceFileName()); \n" +
- " }\n" +
- " process(unit, i);\n" +
- " }\n" +
- " fi }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on finally keyword>";
- String completeBehind = "fi";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fi>";
- String completionIdentifier = "fi";
- String expectedReplacedSource = "fi";
- int cursorLocation = str.indexOf("fi }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class HB {\n" +
- " public HB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnKeyword:fi>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testHC_1FMPYO3_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FMPYO3\n" +
- " */\n" +
- "class HC {\n" +
- " HC(Object o){}\n" +
- " void foo(){\n" +
- " HC a = new HC(new Object()).\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new HC(new Object()).";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new HC(new Object()).>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class HC {\n" +
- " HC(Object o) {\n" +
- " }\n" +
- " void foo() {\n" +
- " HC a = <CompleteOnMemberAccess:new HC(new Object()).>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testHC_1FMPYO3_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FMPYO3\n" +
- " */\n" +
- "class HC {\n" +
- " HC(Object o){}\n" +
- " void foo(){\n" +
- " A a = new A(new Object()).\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on object of nested object creation declaration>";
- String completeBehind = "O";
- String expectedCompletionNodeToString = "<CompleteOnType:O>";
- String completionIdentifier = "O";
- String expectedReplacedSource = "Object";
- int cursorLocation = str.indexOf("Object()") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class HC {\n" +
- " HC(Object o) {\n" +
- " }\n" +
- " void foo() {\n" +
- " A a = new A(new <CompleteOnType:O>());\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testI() {
- String str =
- "package p; \n" +
- "public class I {\n" +
- " Component }\n";
-
- String testName = "<complete on incomplete field declaration type>";
- String completeBehind = "C";
- String expectedCompletionNodeToString = "<CompleteOnType:C>";
- String completionIdentifier = "C";
- String expectedReplacedSource = "Component";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class I {\n" +
- " <CompleteOnType:C>;\n" +
- " public I() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testIA_1FGNBPR_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGNBPR\n" +
- " */\n" +
- "public class IA {\n" +
- " void foo1() {\n" +
- " label1 : while (true) {\n" +
- " class A {\n" +
- " void foo2() {\n" +
- " label2 : while (true) {\n" +
- " break la }\n" +
- " }\n" +
- " }\n" +
- " A a = new A();\n" +
- " break la }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on label name>";
- String completeBehind = "la";
- String expectedCompletionNodeToString = "<CompleteOnName:la>";
- String completionIdentifier = "la";
- String expectedReplacedSource = "la";
- int cursorLocation = str.indexOf("la }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class IA {\n" +
- " public IA() {\n" +
- " }\n" +
- " void foo1() {\n" +
- " {\n" +
- " class A {\n" +
- " A() {\n" +
- " }\n" +
- " void foo2() {\n" +
- " <CompleteOnName:la>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testIA_1FGNBPR_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGNBPR\n" +
- " */\n" +
- "public class IA {\n" +
- " void foo1() {\n" +
- " label1 : while (true) {\n" +
- " class A {\n" +
- " void foo2() {\n" +
- " label2 : while (true) {\n" +
- " break la }\n" +
- " }\n" +
- " }\n" +
- " A a = new A();\n" +
- " break la }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on label name>";
- String completeBehind = "la";
- String expectedCompletionNodeToString = "<CompleteOnName:la>";
- String completionIdentifier = "la";
- String expectedReplacedSource = "la";
- int cursorLocation = str.indexOf("la }", str.indexOf("la }") + 1) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class IA {\n" +
- " public IA() {\n" +
- " }\n" +
- " void foo1() {\n" +
- " {\n" +
- " class A {\n" +
- " A() {\n" +
- " super();\n" + // could be optimized out ?
- " }\n" +
- " void foo2() {\n" +
- " }\n" +
- " };\n" +
- " A a;\n" +
- " <CompleteOnName:la>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testIB() {
- String str =
- "package p; \n" +
- "public class IB {\n" +
- " UnknownFieldTYPE field;\n" +
- " void foo() {\n" +
- " field.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of field of unkown type>";
- String completeBehind = "field.";
- String expectedCompletionNodeToString = "<CompleteOnName:field.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "field.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class IB {\n" +
- " UnknownFieldTYPE field;\n" +
- " public IB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:field.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testIC_1FMGUPR() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FMGUPR\n" +
- " */\n" +
- "public class IC {\n" +
- " void foo(){\n" +
- " new String().toString().\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on multiple method/field call>";
- String completeBehind = "new String().toString().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String().toString().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class IC {\n" +
- " public IC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new String().toString().>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testJ() {
- String str =
- "package p; \n" +
- "public class J {\n" +
- " int foo1()[void foo2() int i;\n" +
- " void foo3() {\n" +
- " f }\n";
-
- String testName = "<complete on method/field access into corrupted method declaration>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class J {\n" +
- " public J() {\n" +
- " }\n" +
- " int foo1() {\n" +
- " }\n" +
- " void foo2() {\n" +
- " }\n" +
- " void foo3() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testJA_1FGQVW2_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGQVW2\n" +
- " */\n" +
- "public class JA {\n" +
- " void foo() {\n" +
- " \"abc.txt\". 'a'.}\n" +
- "}\n";
-
- String testName = "<complete on string literal>";
- String completeBehind = "\"abc.txt\".";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:\"abc.txt\".>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class JA {\n" +
- " public JA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:\"abc.txt\".>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testJA_1FGQVW2_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGQVW2\n" +
- " */\n" +
- "public class JA {\n" +
- " void foo() {\n" +
- " \"abc.txt\". 'a'.}\n" +
- "}\n";
-
- String testName = "<complete on char literal>";
- String completeBehind = "'a'.";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:'a'.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class JA {\n" +
- " public JA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:'a'.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testJB() {
- String str =
- "package p; \n" +
- "public class JB\n" +
- " extends UnknownSUPERCLASS\n" +
- " implements UnknownSUPERINTERFACE {\n" +
- " void foo() {\n" +
- " f }\n" +
- "}\n";
-
- String testName = "<complete into method declared into corrupted class declaration>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class JB extends UnknownSUPERCLASS implements UnknownSUPERINTERFACE {\n" +
- " public JB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testJC_1FLG1ZC() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FLG1ZC\n" +
- " */\n" +
- "public class JC {\n" +
- " void foo() {\n" +
- " new String ().\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation with dummy spaces>";
- String completeBehind = "new String ().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class JC {\n" +
- " public JC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new String().>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testK_1() {
- String str =
- "package p; \n" +
- "class Other {\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public static void main(\n" +
- " java.lang.String[] args) {\n" +
- " java.io.File bbbb = \n" +
- " new File(\"c:\\abc.txt\"); \n" +
- " O bb bbbb.}\n" +
- "}\n";
-
-// str =
-// "public class K {\n" +
-// " void foo() {\n" +
-// " new X(\"c:abc.txt\"); \n" +
-// " O" +
-// " }\n" +
-// "}\n";
-
- String testName = "<complete on corrupted local variable declaration>";
- String completeBehind = " O";
- String expectedCompletionNodeToString = "<CompleteOnName:O>";
- String completionIdentifier = "O";
- String expectedReplacedSource = "O";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class Other {\n" +
- " Other() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public K() {\n" +
- " }\n" +
- " public static void main(java.lang.String[] args) {\n" +
- " java.io.File bbbb;\n" +
- " <CompleteOnName:O>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testK_2() {
- String str =
- "package p; \n" +
- "class Other {\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public static void main(\n" +
- " java.lang.String[] args) {\n" +
- " java.io.File bbbb = \n" +
- " new File(\"c:\\abc.txt\"); \n" +
- " O bb bbbb.}\n" +
- "}\n";
-
- String testName = "<complete on corrupted local variable declaration name>";
- String completeBehind = "bb";
- String expectedCompletionNodeToString = "<CompleteOnLocalName:O bb>";
- String completionIdentifier = "bb";
- String expectedReplacedSource = "bb";
- int cursorLocation = str.indexOf("bb bbbb.") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class Other {\n" +
- " Other() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public K() {\n" +
- " }\n" +
- " public static void main(java.lang.String[] args) {\n" +
- " java.io.File bbbb;\n" +
- " <CompleteOnLocalName:O bb>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testK_3() {
- String str =
- "package p; \n" +
- "class Other {\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public static void main(\n" +
- " java.lang.String[] args) {\n" +
- " java.io.File bbbb = \n" +
- " new File(\"c:\\abc.txt\"); \n" +
- " O bb bbbb.}\n" +
- "}\n";
-
- String testName = "<complete on corrupted local variable declaration>";
- String completeBehind = "bbbb";
- String expectedCompletionNodeToString = "<CompleteOnName:bbbb>";
- String completionIdentifier = "bbbb";
- String expectedReplacedSource = "bbbb";
- int cursorLocation = str.indexOf("bbbb.}") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class Other {\n" +
- " Other() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public K() {\n" +
- " }\n" +
- " public static void main(java.lang.String[] args) {\n" +
- " java.io.File bbbb;\n" +
- " O bb;\n" +
- " <CompleteOnName:bbbb>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testK_4() {
- String str =
- "package p; \n" +
- "class Other {\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public static void main(\n" +
- " java.lang.String[] args) {\n" +
- " java.io.File bbbb = \n" +
- " new File(\"c:\\abc.txt\"); \n" +
- " O bb bbbb.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of local variable with corrupted declaration>";
- String completeBehind = "bbbb.";
- String expectedCompletionNodeToString = "<CompleteOnName:bbbb.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "bbbb.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class Other {\n" +
- " Other() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class K {\n" +
- " public K() {\n" +
- " }\n" +
- " public static void main(java.lang.String[] args) {\n" +
- " java.io.File bbbb;\n" +
- " O bb;\n" +
- " <CompleteOnName:bbbb.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testKA_1FH5SU5() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FH5SU5\n" +
- " */\n" +
- "class KAHelper\n" +
- " extends java.util.Vector {\n" +
- "}\n" +
- "public class KA {\n" +
- " public int hashCode() {\n" +
- " return 10;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " KA a = new KA;\n" +
- " a.has }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "a.has";
- String expectedCompletionNodeToString = "<CompleteOnName:a.has>";
- String completionIdentifier = "has";
- String expectedReplacedSource = "a.has";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class KAHelper extends java.util.Vector {\n" +
- " KAHelper() {\n" +
- " }\n" +
- "}\n" +
- "public class KA {\n" +
- " public KA() {\n" +
- " }\n" +
- " public int hashCode() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " KA a;\n" +
- " <CompleteOnName:a.has>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testKB() {
- String str =
- "package p; \n" +
- "public class KB {\n" +
- " void foo()[i }\n" +
- "}\n";
-
- String testName = "<complete on corrupted method header>";
- String completeBehind = "void foo()[i";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class KB {\n" +
- " public KB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testKC_1FLG1ZC() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FLG1ZC\n" +
- " */\n" +
- "import java.io.*;\n" +
- "public class KC {\n" +
- "private static char[] read(String fileName){\n" +
- " try {\n" +
- " File file = new File(fileName);\n" +
- " FileReader reader =\n" +
- " new FileReader(file);\n" +
- " int length;\n" +
- " char[] contents =\n" +
- " new char[\n" +
- " length =\n" +
- " (int) file.length()];\n" +
- " int len = 0;\n" +
- " int readSize = 0;\n" +
- " while ((readSize != -1)\n" +
- " && (len != length)) {\n" +
- " readSize = reader.read(\n" +
- " contents,\n" +
- " len,\n" +
- " length - len);\n" +
- " len += readSize;\n" +
- " }\n" +
- " reader. t\n";
-
- String testName = "<complete on method/field with dummy spaces>";
- String completeBehind = "reader. t";
- String expectedCompletionNodeToString = "<CompleteOnName:reader.t>";
- String completionIdentifier = "t";
- String expectedReplacedSource = "reader. t";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.io.*;\n" +
- "public class KC {\n" +
- " public KC() {\n" +
- " }\n" +
- " private static char[] read(String fileName) {\n" +
- " {\n" +
- " File file;\n" +
- " FileReader reader;\n" +
- " int length;\n" +
- " char[] contents;\n" +
- " int len;\n" +
- " int readSize;\n" +
- " <CompleteOnName:reader.t>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testL_1() {
- String str =
- "package p; \n" +
- "public class L {\n" +
- " void foo() {\n" +
- " x.y.Z[] field1, \n" +
- " field2; \n" +
- " field1.if (int[].class }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "field1.";
- String expectedCompletionNodeToString = "<CompleteOnName:field1.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "field1.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class L {\n" +
- " public L() {\n" +
- " }\n" +
- " void foo() {\n" +
- " x.y.Z[] field1;\n" +
- " x.y.Z[] field2;\n" +
- " <CompleteOnName:field1.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testL_2() {
- String str =
- "package p; \n" +
- "public class L {\n" +
- " void foo() {\n" +
- " x.y.Z[] field1, \n" +
- " field2; \n" +
- " field1.if (int[].class }\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "int[].";
- String expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int[].>";
- String completionIdentifier = "";
- String expectedReplacedSource = "int[].";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class L {\n" +
- " public L() {\n" +
- " }\n" +
- " void foo() {\n" +
- " x.y.Z[] field1;\n" +
- " x.y.Z[] field2;\n" +
- " <CompleteOnClassLiteralAccess:int[].>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testL_3() {
- String str =
- "package p; \n" +
- "public class L {\n" +
- " void foo() {\n" +
- " x.y.Z[] field1, \n" +
- " field2; \n" +
- " field1.if (int[].class }\n" +
- "}\n";
-
- String testName = "<complete on argument of corrupted if statement>";
- String completeBehind = "int";
- String expectedCompletionNodeToString = "<CompleteOnName:int>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class L {\n" +
- " public L() {\n" +
- " }\n" +
- " void foo() {\n" +
- " x.y.Z[] field1;\n" +
- " x.y.Z[] field2;\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testLA_1FGLMOF() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGLMOF\n" +
- " */\n" +
- "public class LA {\n" +
- " void[] foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " f }\n" +
- "}\n";
-
- String testName = "<complete on method/field with corrupted method header>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class LA {\n" +
- " public LA() {\n" +
- " }\n" +
- " void[] foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testLB() {
- String str =
- "package p; \n" +
- "public class LB {\n" +
- " void foo() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " i }\n" +
- "}\n";
-
- String testName = "<complete on method/field with duplicate method declaration>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = "<CompleteOnName:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf("i }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class LB {\n" +
- " public LB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " <CompleteOnName:i>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testLC_1FLG1E2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FLG1E2\n" +
- " */\n" +
- "public class LC {\n" +
- " void foo() {\n" +
- " Object[] x = new Object[10];\n" +
- " x [1].\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of array element with dummy spaces>";
- String completeBehind = "x [1].";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:x[1].>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class LC {\n" +
- " public LC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] x;\n" +
- " <CompleteOnMemberAccess:x[1].>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testM_1FGGLMT() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGGLMT\n" +
- " */\n" +
- "public class M {\n" +
- " class Member {\n" +
- " void fooMember() {\n" +
- " }\n" +
- " }\n" +
- " void foo() {\n" +
- " new Member().}\n" +
- "}\n" +
- "class MemberOfCU {\n" +
- "}\n";
-
- String testName = "<complete on method/field of explicit object creation>";
- String completeBehind = "new Member().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Member().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class M {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " }\n" +
- " public M() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new Member().>;\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCU {\n" +
- " MemberOfCU() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testMA_1() {
- String str =
- "package p; \n" +
- "public class MA {\n" +
- " class Member\n" +
- " extends java.util.Vector {\n" +
- " static void fooStaticMember() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " class MemberMember {\n" +
- " void fooMemberMember() {\n" +
- " MemberOfCUMA m = \n" +
- " new MemberOfCUMA(); \n" +
- " }\n" +
- " }\n" +
- " class MemberMember2 {\n" +
- " }\n" +
- " }\n" +
- " void foo() {\n" +
- " Membe }\n" +
- " void foobar() {\n" +
- " new Member().}\n" +
- " class Member2 {\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCUMA {\n" +
- "}\n";
-
- String testName = "<complete on local variable declaration type>";
- String completeBehind = "Membe";
- String expectedCompletionNodeToString = "<CompleteOnName:Membe>";
- String completionIdentifier = "Membe";
- String expectedReplacedSource = "Membe";
- int cursorLocation = str.indexOf("Membe }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class MA {\n" +
- " class Member extends java.util.Vector {\n" +
- " class MemberMember {\n" +
- " MemberMember() {\n" +
- " }\n" +
- " void fooMemberMember() {\n" +
- " }\n" +
- " }\n" +
- " class MemberMember2 {\n" +
- " MemberMember2() {\n" +
- " }\n" +
- " }\n" +
- " Member() {\n" +
- " }\n" +
- " static void fooStaticMember() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " public MA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:Membe>;\n" +
- " }\n" +
- " void foobar() {\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCUMA {\n" +
- " MemberOfCUMA() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testMA_2() {
- String str =
- "package p; \n" +
- "public class MA {\n" +
- " class Member\n" +
- " extends java.util.Vector {\n" +
- " static void fooStaticMember() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " class MemberMember {\n" +
- " void fooMemberMember() {\n" +
- " MemberOfCUMA m = \n" +
- " new MemberOfCUMA(); \n" +
- " }\n" +
- " }\n" +
- " class MemberMember2 {\n" +
- " }\n" +
- " }\n" +
- " void foo() {\n" +
- " Membe }\n" +
- " void foobar() {\n" +
- " new Member().}\n" +
- " class Member2 {\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCUMA {\n" +
- "}\n";
-
- String testName = "<complete on object creation type>";
- String completeBehind = "MemberOfCU";
- String expectedCompletionNodeToString = "<CompleteOnType:MemberOfCU>";
- String completionIdentifier = "MemberOfCU";
- String expectedReplacedSource = "MemberOfCUMA";
- int cursorLocation = str.indexOf("MemberOfCUMA();") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class MA {\n" +
- " class Member extends java.util.Vector {\n" +
- " class MemberMember {\n" +
- " MemberMember() {\n" +
- " }\n" +
- " void fooMemberMember() {\n" +
- " MemberOfCUMA m = new <CompleteOnType:MemberOfCU>();\n" +
- " }\n" +
- " }\n" +
- " class MemberMember2 {\n" +
- " MemberMember2() {\n" +
- " }\n" +
- " }\n" +
- " Member() {\n" +
- " }\n" +
- " static void fooStaticMember() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " public MA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void foobar() {\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCUMA {\n" +
- " MemberOfCUMA() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testMA_3() {
- String str =
- "package p; \n" +
- "public class MA {\n" +
- " class Member\n" +
- " extends java.util.Vector {\n" +
- " static void fooStaticMember() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " class MemberMember {\n" +
- " void fooMemberMember() {\n" +
- " MemberOfCUMA m = \n" +
- " new MemberOfCUMA(); \n" +
- " }\n" +
- " }\n" +
- " class MemberMember2 {\n" +
- " }\n" +
- " }\n" +
- " void foo() {\n" +
- " Membe }\n" +
- " void foobar() {\n" +
- " new Member().}\n" +
- " class Member2 {\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCUMA {\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new Member().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Member().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class MA {\n" +
- " class Member extends java.util.Vector {\n" +
- " class MemberMember {\n" +
- " MemberMember() {\n" +
- " }\n" +
- " void fooMemberMember() {\n" +
- " }\n" +
- " }\n" +
- " class MemberMember2 {\n" +
- " MemberMember2() {\n" +
- " }\n" +
- " }\n" +
- " Member() {\n" +
- " }\n" +
- " static void fooStaticMember() {\n" +
- " }\n" +
- " void fooMember() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " public MA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void foobar() {\n" +
- " <CompleteOnMemberAccess:new Member().>;\n" +
- " }\n" +
- "}\n" +
- "class MemberOfCUMA {\n" +
- " MemberOfCUMA() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testMB_1FHSLMQ_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSLMQ\n" +
- " */\n" +
- "public class MB {\n" +
- " void foo() {\n" +
- " try {\n" +
- " System.out.println(\"\");\n" +
- " } catch (Exception eFirst) {\n" +
- " e } catch (Exception eSecond) {\n" +
- " e }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on local variable name into catch block>";
- String completeBehind = "e";
- String expectedCompletionNodeToString = "<CompleteOnName:e>";
- String completionIdentifier = "e";
- String expectedReplacedSource = "e";
- int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class MB {\n" +
- " public MB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " Exception eFirst;\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testMB_1FHSLMQ_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSLMQ\n" +
- " */\n" +
- "public class MB {\n" +
- " void foo() {\n" +
- " try {\n" +
- " System.out.println(\"\");\n" +
- " } catch (Exeption eFirst) {\n" +
- " e } catch (Exception eSecond) {\n" +
- " e }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on local variable name into catch block>";
- String completeBehind = "e";
- String expectedCompletionNodeToString = "<CompleteOnName:e>";
- String completionIdentifier = "e";
- String expectedReplacedSource = "e";
- int cursorLocation = str.indexOf("e }\n") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class MB {\n" +
- " public MB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " Exception eSecond;\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testMC_1FJ8D9Z() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ8D9Z\n" +
- " */\n" +
- "public class MC {\n" +
- " p2.X someField;\n" +
- " public void foo() {\n" +
- " new p2.X(\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on object creation argument>";
- String completeBehind = "new p2.X(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new p2.X()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class MC {\n" +
- " p2.X someField;\n" +
- " public MC() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " <CompleteOnAllocationExpression:new p2.X()>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testN() {
- String str =
- "package p; \n" +
- "public class N extends p.M {\n" +
- " void foo() {\n" +
- " class MLocal\n" +
- " extends Schmurz {\n" +
- " void foo() {\n" +
- " }\n" +
- " int field1;\n" +
- " class MLocalMember\n" +
- " extends myInnerC {\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " new M }\n" +
- " }\n" +
- " class MLocalMember2 {\n" +
- " void fooMyInnerC() {\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on object creation type>";
- String completeBehind = "new M";
- String expectedCompletionNodeToString = "<CompleteOnType:M>";
- String completionIdentifier = "M";
- String expectedReplacedSource = "M";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class N extends p.M {\n" +
- " public N() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class MLocal extends Schmurz {\n" +
- " class MLocalMember extends myInnerC {\n" +
- " MLocalMember() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " new <CompleteOnType:M>();\n" +
- " }\n" +
- " }\n" +
- " class MLocalMember2 {\n" +
- " MLocalMember2() {\n" +
- " }\n" +
- " void fooMyInnerC() {\n" +
- " }\n" +
- " }\n" +
- " int field1;\n" +
- " MLocal() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testNA_1() {
- String str =
- "package p; \n" +
- "class NException2\n" +
- " extends NoClassDefFoundError {\n" +
- "}\n" +
- "interface NInterface {\n" +
- " void foo();\n" +
- "}\n" +
- "class DAB {\n" +
- " public DA foo() {\n" +
- " }\n" +
- " public int foufou;\n" +
- "}\n" +
- "class DANA {\n" +
- " public int f;\n" +
- " N fieldC;\n" +
- "}\n" +
- "public class NA\n" +
- " extends NException2\n" +
- " implements N {\n" +
- " DA fieldB;\n" +
- " class freak {\n" +
- " }\n" +
- " void dede() {\n" +
- " DA local;\n" +
- " local.fieldC.foo();\n" +
- " }\n" +
- "}\n" +
- "interface NCool {\n" +
- "}\n";
-
- String testName = "<complete on local variable name>";
- String completeBehind = "l";
- String expectedCompletionNodeToString = "<CompleteOnName:l>";
- String completionIdentifier = "l";
- String expectedReplacedSource = "local";
- int cursorLocation = str.indexOf("local.") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class NException2 extends NoClassDefFoundError {\n" +
- " NException2() {\n" +
- " }\n" +
- "}\n" +
- "interface NInterface {\n" +
- " void foo();\n" +
- "}\n" +
- "class DAB {\n" +
- " public int foufou;\n" +
- " DAB() {\n" +
- " }\n" +
- " public DA foo() {\n" +
- " }\n" +
- "}\n" +
- "class DANA {\n" +
- " public int f;\n" +
- " N fieldC;\n" +
- " DANA() {\n" +
- " }\n" +
- "}\n" +
- "public class NA extends NException2 implements N {\n" +
- " class freak {\n" +
- " freak() {\n" +
- " }\n" +
- " }\n" +
- " DA fieldB;\n" +
- " public NA() {\n" +
- " }\n" +
- " void dede() {\n" +
- " DA local;\n" +
- " <CompleteOnName:l>;\n" +
- " }\n" +
- "}\n" +
- "interface NCool {\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testNA_2() {
- String str =
- "package p; \n" +
- "class NException2\n" +
- " extends NoClassDefFoundError {\n" +
- "}\n" +
- "interface NInterface {\n" +
- " void foo();\n" +
- "}\n" +
- "class DAB {\n" +
- " public DA foo() {\n" +
- " }\n" +
- " public int foufou;\n" +
- "}\n" +
- "class DANA {\n" +
- " public int f;\n" +
- " N fieldC;\n" +
- "}\n" +
- "public class NA\n" +
- " extends NException2\n" +
- " implements N {\n" +
- " DA fieldB;\n" +
- " class freak {\n" +
- " }\n" +
- " void dede() {\n" +
- " DA local;\n" +
- " local.fieldC.foo();\n" +
- " }\n" +
- "}\n" +
- "interface NCool {\n" +
- "}\n";
-
- String testName = "<complete on method/field of local variable>";
- String completeBehind = "local.f";
- String expectedCompletionNodeToString = "<CompleteOnName:local.f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "local.fieldC";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class NException2 extends NoClassDefFoundError {\n" +
- " NException2() {\n" +
- " }\n" +
- "}\n" +
- "interface NInterface {\n" +
- " void foo();\n" +
- "}\n" +
- "class DAB {\n" +
- " public int foufou;\n" +
- " DAB() {\n" +
- " }\n" +
- " public DA foo() {\n" +
- " }\n" +
- "}\n" +
- "class DANA {\n" +
- " public int f;\n" +
- " N fieldC;\n" +
- " DANA() {\n" +
- " }\n" +
- "}\n" +
- "public class NA extends NException2 implements N {\n" +
- " class freak {\n" +
- " freak() {\n" +
- " }\n" +
- " }\n" +
- " DA fieldB;\n" +
- " public NA() {\n" +
- " }\n" +
- " void dede() {\n" +
- " DA local;\n" +
- " <CompleteOnName:local.f>;\n" +
- " }\n" +
- "}\n" +
- "interface NCool {\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testNA_3() {
- String str =
- "package p; \n" +
- "class NException2\n" +
- " extends NoClassDefFoundError {\n" +
- "}\n" +
- "interface NInterface {\n" +
- " void foo();\n" +
- "}\n" +
- "class DAB {\n" +
- " public DA foo() {\n" +
- " }\n" +
- " public int foufou;\n" +
- "}\n" +
- "class DANA {\n" +
- " public int f;\n" +
- " N fieldC;\n" +
- "}\n" +
- "public class NA\n" +
- " extends NException2\n" +
- " implements N {\n" +
- " DA fieldB;\n" +
- " class freak {\n" +
- " }\n" +
- " void dede() {\n" +
- " DA local;\n" +
- " local.fieldC.foo();\n" +
- " }\n" +
- "}\n" +
- "interface NCool {\n" +
- "}\n";
-
- String testName = "<complete on method/field of local variable>";
- String completeBehind = "local.fieldC.";
- String expectedCompletionNodeToString = "<CompleteOnName:local.fieldC.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "local.fieldC.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class NException2 extends NoClassDefFoundError {\n" +
- " NException2() {\n" +
- " }\n" +
- "}\n" +
- "interface NInterface {\n" +
- " void foo();\n" +
- "}\n" +
- "class DAB {\n" +
- " public int foufou;\n" +
- " DAB() {\n" +
- " }\n" +
- " public DA foo() {\n" +
- " }\n" +
- "}\n" +
- "class DANA {\n" +
- " public int f;\n" +
- " N fieldC;\n" +
- " DANA() {\n" +
- " }\n" +
- "}\n" +
- "public class NA extends NException2 implements N {\n" +
- " class freak {\n" +
- " freak() {\n" +
- " }\n" +
- " }\n" +
- " DA fieldB;\n" +
- " public NA() {\n" +
- " }\n" +
- " void dede() {\n" +
- " DA local;\n" +
- " <CompleteOnName:local.fieldC.>;\n" +
- " }\n" +
- "}\n" +
- "interface NCool {\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testNB() {
- String str =
- "package p; \n" +
- "public class NB {\n" +
- " void foo() {\n" +
- " int iOutside;\n" +
- " if (i != 0) {\n" +
- " for (int i = 10; --i >= 0;)\n" +
- " unit[i].parseMethod(\n" +
- " parser, \n" +
- " unit); \n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on variable name into for statement>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = "<CompleteOnName:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf("i >=") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class NB {\n" +
- " public NB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int iOutside;\n" +
- " {\n" +
- " int i;\n" +
- " -- <CompleteOnName:i>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testNC_1FJ8D9Z() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ8D9Z\n" +
- " */\n" +
- "public class NC {\n" +
- " String s = new String(\n";
-
- String testName = "<complete on field intializer into corrupted class declaration>";
- String completeBehind = "new String(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new String()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class NC {\n" +
- " String s = <CompleteOnAllocationExpression:new String()>;\n" +
- " public NC() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testO_1FG1YU0() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FG1YU0\n" +
- " */\n" +
- "public class O\n" +
- " extends java.util.Vector {\n" +
- " void bar(boolean bbbb) {\n" +
- " this.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of explicit this>";
- String completeBehind = "this.";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "this.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class O extends java.util.Vector {\n" +
- " public O() {\n" +
- " }\n" +
- " void bar(boolean bbbb) {\n" +
- " <CompleteOnMemberAccess:this.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testOA_1() {
- String str =
- "package p; \n" +
- "public class OA {\n" +
- " void proc() {\n" +
- " int[] a = new int[10];\n" +
- " Object b = a;\n" +
- " Class c = a.getClass();\n" +
- " String s = a.toString();\n" +
- " boolean l = a.equals(b);\n" +
- " int h = a.hashCode();\n" +
- " try {\n" +
- " a.wait();\n" +
- " a.wait(3);\n" +
- " a.wait(4, 5);\n" +
- " } catch (Exception e) {\n" +
- " }\n" +
- " a.notify();\n" +
- " a.notifyAll();\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "a.n";
- String expectedCompletionNodeToString = "<CompleteOnName:a.n>";
- String completionIdentifier = "n";
- String expectedReplacedSource = "a.notify";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class OA {\n" +
- " public OA() {\n" +
- " }\n" +
- " void proc() {\n" +
- " int[] a;\n" +
- " Object b;\n" +
- " Class c;\n" +
- " String s;\n" +
- " boolean l;\n" +
- " int h;\n" +
- " <CompleteOnName:a.n>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testOA_2() {
- String str =
- "package p; \n" +
- "public class OA {\n" +
- " void proc() {\n" +
- " int[] a = new int[10];\n" +
- " Object b = a;\n" +
- " Class c = a.getClass();\n" +
- " String s = a.toString();\n" +
- " boolean l = a.equals(b);\n" +
- " int h = a.hashCode();\n" +
- " try {\n" +
- " a.wait();\n" +
- " a.wait(3);\n" +
- " a.wait(4, 5);\n" +
- " } catch (Exception e) {\n" +
- " }\n" +
- " a.notify();\n" +
- " a.notifyAll();\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "a.w";
- String expectedCompletionNodeToString = "<CompleteOnName:a.w>";
- String completionIdentifier = "w";
- String expectedReplacedSource = "a.wait";
- int cursorLocation = str.indexOf("a.wait(4, 5)") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class OA {\n" +
- " public OA() {\n" +
- " }\n" +
- " void proc() {\n" +
- " int[] a;\n" +
- " Object b;\n" +
- " Class c;\n" +
- " String s;\n" +
- " boolean l;\n" +
- " int h;\n" +
- " {\n" +
- " <CompleteOnName:a.w>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testOB_1() {
- String str =
- "package p; \n" +
- "public class OB {\n" +
- " void foo() {\n" +
- " label : while (true) {\n" +
- " System.out.println(\"\");\n" +
- " break label;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on keyword>";
- String completeBehind = "b";
- String expectedCompletionNodeToString = "<CompleteOnName:b>";
- String completionIdentifier = "b";
- String expectedReplacedSource = "break";
- int cursorLocation = str.indexOf("break") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class OB {\n" +
- " public OB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:b>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testOB_2() {
- String str =
- "package p; \n" +
- "public class OB {\n" +
- " void foo() {\n" +
- " label : while (true) {\n" +
- " System.out.println(\"\");\n" +
- " break label;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on label name>";
- String completeBehind = "l";
- String expectedCompletionNodeToString = "<CompleteOnName:l>";
- String completionIdentifier = "l";
- String expectedReplacedSource = "label";
- int cursorLocation = str.indexOf("label") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class OB {\n" +
- " public OB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:l>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testOC_1FM7J7F() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FM7J7F\n" +
- " */\n" +
- "class OC {\n" +
- " String s = new String(\n" +
- "}\n";
-
- String testName = "<complete on field initializer>";
- String completeBehind = "new String(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new String()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class OC {\n" +
- " String s = <CompleteOnAllocationExpression:new String()>;\n" +
- " OC() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testP_1FG1YU0() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FG1YU0\n" +
- " */\n" +
- "public class P {\n" +
- " {\n" +
- " void bar() {\n" +
- " f }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class P {\n" +
- " {\n" +
- " }\n" +
- " public P() {\n" +
- " }\n" +
- " void bar() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName); }
-public void testPA_1() {
- String str =
- "package p; \n" +
- "class PAHelper {\n" +
- " public int fieldPublic;\n" +
- " protected int fieldProtected;\n" +
- " private int fieldPrivate;\n" +
- " int fieldDefault;\n" +
- " static void staticFoo() {\n" +
- " }\n" +
- " static int i = 1;\n" +
- " int neuneu1() {\n" +
- " return 0;\n" +
- " }\n" +
- " void neuneu2() {\n" +
- " }\n" +
- "}\n" +
- "public class PA\n" +
- " extends PAHelper {\n" +
- " void foo() {\n" +
- " B[] b = \n" +
- " new java.lang.Number[]; \n" +
- " java.lang.Short s;\n" +
- " // b[1].;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on comment>";
- String completeBehind = "b[1].";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedReplacedSource = NONE;
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString = null;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT);
- }
-}
-public void testPA_2() {
- String str =
- "package p; \n" +
- "class PAHelper {\n" +
- " public int fieldPublic;\n" +
- " protected int fieldProtected;\n" +
- " private int fieldPrivate;\n" +
- " int fieldDefault;\n" +
- " static void staticFoo() {\n" +
- " }\n" +
- " static int i = 1;\n" +
- " int neuneu1() {\n" +
- " return 0;\n" +
- " }\n" +
- " void neuneu2() {\n" +
- " }\n" +
- "}\n" +
- "public class PA\n" +
- " extends PAHelper {\n" +
- " void foo() {\n" +
- " B[] b = \n" +
- " new java.lang.Number[]; \n" +
- " java.lang.Short s;\n" +
- " // b[1].;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on new keyword>";
- String completeBehind = "n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedReplacedSource = "new";
- int cursorLocation = str.indexOf("new ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class PAHelper {\n" +
- " public int fieldPublic;\n" +
- " protected int fieldProtected;\n" +
- " private int fieldPrivate;\n" +
- " int fieldDefault;\n" +
- " static int i;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " PAHelper() {\n" +
- " }\n" +
- " static void staticFoo() {\n" +
- " }\n" +
- " int neuneu1() {\n" +
- " }\n" +
- " void neuneu2() {\n" +
- " }\n" +
- "}\n" +
- "public class PA extends PAHelper {\n" +
- " public PA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " B[] b = <CompleteOnName:n>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testPB() {
- String str =
- "package p; \n" +
- "public class PB {\n" +
- " void foo() {\n" +
- " class Local {\n" +
- " void foo() {\n" +
- " }\n" +
- " class LocalMember1 {\n" +
- " void foo() {\n" +
- " class LocalMemberLocal {\n" +
- " void foo() {\n" +
- " f\n"+
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " class LocalMember2 {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field into nested local type>";
- String completeBehind = "f";
- String expectedCompletionNodeToString = "<CompleteOnName:f>";
- String completionIdentifier = "f";
- String expectedReplacedSource = "f";
- int cursorLocation = str.indexOf("f\n") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class PB {\n" +
- " public PB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class Local {\n" +
- " class LocalMember1 {\n" +
- " LocalMember1() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class LocalMemberLocal {\n" +
- " LocalMemberLocal() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:f>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " }\n" +
- " class LocalMember2 {\n" +
- " LocalMember2() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " Local() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testPC_1FSU4EF() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSU4EF\n" +
- " */\n" +
- "import java.util.Vector;\n" +
- "public class PC {\n" +
- " void foo() {\n" +
- " class Inner {\n" +
- " Vector v = new Vector();\n" +
- " void foo() {\n" +
- " Vector v = new Vector();\n" +
- " v.addElement();\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field into local type>";
- String completeBehind = "v.a";
- String expectedCompletionNodeToString = "<CompleteOnName:v.a>";
- String completionIdentifier = "a";
- String expectedReplacedSource = "v.addElement";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.Vector;\n" +
- "public class PC {\n" +
- " public PC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class Inner {\n" +
- " Vector v;\n" +
- " Inner() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v;\n" +
- " <CompleteOnName:v.a>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testQ_1FG1YU0() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FG1YU0\n" +
- " */\n" +
- "public class Q {\n" +
- " void bar(boolean bbbb) {\n" +
- " this.}\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "this.";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "this.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class Q {\n" +
- " public Q() {\n" +
- " }\n" +
- " void bar(boolean bbbb) {\n" +
- " <CompleteOnMemberAccess:this.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testQA_1() {
- String str =
- "package p; \n" +
- "class QAHelper {\n" +
- " int i = 10;\n" +
- " void f() {\n" +
- " Chk.chkIntVal(\n" +
- " \"err_0\", \n" +
- " \"i\", \n" +
- " this.i, \n" +
- " i); \n" +
- " }\n" +
- " static class Y\n" +
- " extends QAHelper {\n" +
- " public void f() {\n" +
- " super.f();\n" +
- " int j = super.i;\n" +
- " }\n" +
- " public static void main(String a[]) {\n" +
- " Y oy = new Y();\n" +
- " oy.f();\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String s[] = \n" +
- " {\"Dolby\", \"Thx\",}; \n" +
- " void check() {\n" +
- " new QAHelper().new Y().main(\n" +
- " s); \n" +
- " }\n" +
- " static public void main(String args[]) {\n" +
- " new QA().check();\n" +
- " Chk.endTest(\"ciner111\");\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "new QAHelper().new Y().m";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().new Y().m>";
- String completionIdentifier = "m";
- String expectedReplacedSource = "main";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class QAHelper {\n" +
- " static class Y extends QAHelper {\n" +
- " Y() {\n" +
- " }\n" +
- " public void f() {\n" +
- " }\n" +
- " public static void main(String[] a) {\n" +
- " }\n" +
- " }\n" +
- " int i;\n" +
- " QAHelper() {\n" +
- " }\n" +
- " void f() {\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String[] s;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public QA() {\n" +
- " }\n" +
- " void check() {\n" +
- " <CompleteOnMemberAccess:new QAHelper().new Y().m>;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testQA_2() {
- String str =
- "package p; \n" +
- "class QAHelper {\n" +
- " int i = 10;\n" +
- " void f() {\n" +
- " Chk.chkIntVal(\n" +
- " \"err_0\", \n" +
- " \"i\", \n" +
- " this.i, \n" +
- " i); \n" +
- " }\n" +
- " static class Y\n" +
- " extends QAHelper {\n" +
- " public void f() {\n" +
- " super.f();\n" +
- " int j = super.i;\n" +
- " }\n" +
- " public static void main(String a[]) {\n" +
- " Y oy = new Y();\n" +
- " oy.f();\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String s[] = \n" +
- " {\"Dolby\", \"Thx\",}; \n" +
- " void check() {\n" +
- " new QAHelper().new Y().main(\n" +
- " s); \n" +
- " }\n" +
- " static public void main(String args[]) {\n" +
- " new QA().check();\n" +
- " Chk.endTest(\"ciner111\");\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new QAHelper().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class QAHelper {\n" +
- " static class Y extends QAHelper {\n" +
- " Y() {\n" +
- " }\n" +
- " public void f() {\n" +
- " }\n" +
- " public static void main(String[] a) {\n" +
- " }\n" +
- " }\n" +
- " int i;\n" +
- " QAHelper() {\n" +
- " }\n" +
- " void f() {\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String[] s;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public QA() {\n" +
- " }\n" +
- " void check() {\n" +
- " <CompleteOnMemberAccess:new QAHelper().>;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testQA_3() {
- String str =
- "package p; \n" +
- "class QAHelper {\n" +
- " int i = 10;\n" +
- " void f() {\n" +
- " Chk.chkIntVal(\n" +
- " \"err_0\", \n" +
- " \"i\", \n" +
- " this.i, \n" +
- " i); \n" +
- " }\n" +
- " static class Y\n" +
- " extends QAHelper {\n" +
- " public void f() {\n" +
- " super.f();\n" +
- " int j = super.i;\n" +
- " }\n" +
- " public static void main(String a[]) {\n" +
- " Y oy = new Y();\n" +
- " oy.f();\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String s[] = \n" +
- " {\"Dolby\", \"Thx\",}; \n" +
- " void check() {\n" +
- " new QAHelper().new Y().main(\n" +
- " s); \n" +
- " }\n" +
- " static public void main(String args[]) {\n" +
- " new QA().check();\n" +
- " Chk.endTest(\"ciner111\");\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new QAHelper().new Y().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().new Y().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class QAHelper {\n" +
- " static class Y extends QAHelper {\n" +
- " Y() {\n" +
- " }\n" +
- " public void f() {\n" +
- " }\n" +
- " public static void main(String[] a) {\n" +
- " }\n" +
- " }\n" +
- " int i;\n" +
- " QAHelper() {\n" +
- " }\n" +
- " void f() {\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String[] s;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public QA() {\n" +
- " }\n" +
- " void check() {\n" +
- " <CompleteOnMemberAccess:new QAHelper().new Y().>;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testQA_4() {
- String str =
- "package p; \n" +
- "class QAHelper {\n" +
- " int i = 10;\n" +
- " void f() {\n" +
- " Chk.chkIntVal(\n" +
- " \"err_0\", \n" +
- " \"i\", \n" +
- " this.i, \n" +
- " i); \n" +
- " }\n" +
- " static class Y\n" +
- " extends QAHelper {\n" +
- " public void f() {\n" +
- " super.f();\n" +
- " int j = super.i;\n" +
- " }\n" +
- " public static void main(String a[]) {\n" +
- " Y oy = new Y();\n" +
- " oy.f();\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String s[] = \n" +
- " {\"Dolby\", \"Thx\",}; \n" +
- " void check() {\n" +
- " new QAHelper().new Y().main(\n" +
- " s); \n" +
- " }\n" +
- " static public void main(String args[]) {\n" +
- " new QA().check();\n" +
- " Chk.endTest(\"ciner111\");\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new QA().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QA().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class QAHelper {\n" +
- " static class Y extends QAHelper {\n" +
- " Y() {\n" +
- " }\n" +
- " public void f() {\n" +
- " }\n" +
- " public static void main(String[] a) {\n" +
- " }\n" +
- " }\n" +
- " int i;\n" +
- " QAHelper() {\n" +
- " }\n" +
- " void f() {\n" +
- " }\n" +
- "}\n" +
- "public class QA {\n" +
- " static String[] s;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public QA() {\n" +
- " }\n" +
- " void check() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " <CompleteOnMemberAccess:new QA().>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testQB_1FIK820() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FIK820\n" +
- " */\n" +
- "public class QB {\n" +
- " void foo() {\n" +
- " {\n" +
- " }\n" +
- " .}\n" +
- "}\n";
-
- String testName = "<complete on block (no answers wanted)>";
- String completeBehind = ".";
- String expectedCompletionNodeToString = "<CompleteOnName:>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(".}") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class QB {\n" +
- " public QB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testR_1FGD31E() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGD31E\n" +
- " */\n" +
- "public class R {\n" +
- " void moo() {\n" +
- " b }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "b";
- String expectedCompletionNodeToString = "<CompleteOnName:b>";
- String completionIdentifier = "b";
- String expectedReplacedSource = "b";
- int cursorLocation = str.indexOf("b }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class R {\n" +
- " public R() {\n" +
- " }\n" +
- " void moo() {\n" +
- " <CompleteOnName:b>;\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testRA_1() {
- String str =
- "package p; \n" +
- "public class RA extends A {\n" +
- " private int f = 5;\n" +
- " int i(int k) {\n" +
- " }\n" +
- " class B extends I {\n" +
- " void foo();\n" +
- " class C extends Z {\n" +
- " }\n" +
- " final int fo;\n" +
- " }\n" +
- " final void foo(k j) {\n" +
- " }\n" +
- " o o() throws Exc, Exc {\n" +
- " }\n" +
- " static {\n" +
- " this.ff = 5;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on incorrect this call>";
- String completeBehind = "t";
- String expectedCompletionNodeToString = "<CompleteOnName:t>";
- String completionIdentifier = "t";
- String expectedReplacedSource = "this";
- int cursorLocation = str.indexOf("this.ff") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class RA extends A {\n" +
- " class B extends I {\n" +
- " class C extends Z {\n" +
- " C() {\n" +
- " }\n" +
- " }\n" +
- " final int fo;\n" +
- " B() {\n" +
- " }\n" +
- " void foo();\n" +
- " }\n" +
- " private int f;\n" +
- " static {\n" +
- " <CompleteOnName:t>;\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public RA() {\n" +
- " }\n" +
- " int i(int k) {\n" +
- " }\n" +
- " final void foo(k j) {\n" +
- " }\n" +
- " o o() throws Exc, Exc {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testRA_2() {
- String str =
- "package p; \n" +
- "public class RA extends A {\n" +
- " private int f = 5;\n" +
- " int i(int k) {\n" +
- " }\n" +
- " class B extends I {\n" +
- " void foo();\n" +
- " class C extends Z {\n" +
- " }\n" +
- " final int fo;\n" +
- " }\n" +
- " final void foo(k j) {\n" +
- " }\n" +
- " o o() throws Exc, Exc {\n" +
- " }\n" +
- " static {\n" +
- " this.ff = 5;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on t>";
- String completeBehind = "t";
- String expectedCompletionNodeToString = "<CompleteOnName:t>";
- String completionIdentifier = "t";
- String expectedReplacedSource = "this";
- int cursorLocation = str.indexOf("this") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class RA extends A {\n" +
- " class B extends I {\n" +
- " class C extends Z {\n" +
- " C() {\n" +
- " }\n" +
- " }\n" +
- " final int fo;\n" +
- " B() {\n" +
- " }\n" +
- " void foo();\n" +
- " }\n" +
- " private int f;\n" +
- " static {\n" +
- " <CompleteOnName:t>;\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public RA() {\n" +
- " }\n" +
- " int i(int k) {\n" +
- " }\n" +
- " final void foo(k j) {\n" +
- " }\n" +
- " o o() throws Exc, Exc {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testRA_3() {
- String str =
- "package p; \n" +
- "public class RA extends A {\n" +
- " private int f = 5;\n" +
- " int i(int k) {\n" +
- " }\n" +
- " class B extends I {\n" +
- " void foo();\n" +
- " class C extends Z {\n" +
- " }\n" +
- " final int fo;\n" +
- " }\n" +
- " final void foo(k j) {\n" +
- " }\n" +
- " o o() throws Exc, Exc {\n" +
- " }\n" +
- " static {\n" +
- " this.ff = 5;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on exception type>";
- String completeBehind = "Exc";
- String expectedCompletionNodeToString = "<CompleteOnException:Exc>";
- String completionIdentifier = "Exc";
- String expectedReplacedSource = "Exc";
- int cursorLocation = str.indexOf("Exc {") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class RA extends A {\n" +
- " class B extends I {\n" +
- " class C extends Z {\n" +
- " C() {\n" +
- " }\n" +
- " }\n" +
- " final int fo;\n" +
- " B() {\n" +
- " }\n" +
- " void foo();\n" +
- " }\n" +
- " private int f;\n" +
- " static {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public RA() {\n" +
- " }\n" +
- " int i(int k) {\n" +
- " }\n" +
- " final void foo(k j) {\n" +
- " }\n" +
- " o o() throws Exc, <CompleteOnException:Exc> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testRB_1FI74S3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FI74S3\n" +
- " */\n" +
- "public class RB {\n" +
- " int[] table;\n" +
- " void foo() {\n" +
- " int x = table.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of arry>";
- String completeBehind = "table.";
- String expectedCompletionNodeToString = "<CompleteOnName:table.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "table.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class RB {\n" +
- " int[] table;\n" +
- " public RB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = <CompleteOnName:table.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testS_1FGF64P_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGF64P\n" +
- " */\n" +
- "public class S {\n" +
- " {\n" +
- " new Y()..}\n" +
- " class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on incorrect call>";
- String completeBehind = "new Y()..";
- String expectedCompletionNodeToString = "<CompleteOnName:>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class S {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- " }\n" +
- " public S() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testS_1FGF64P_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGF64P\n" +
- " */\n" +
- "public class S {\n" +
- " {\n" +
- " new Y()..}\n" +
- " class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new Y().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class S {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " <CompleteOnMemberAccess:new Y().>;\n" +
- " }\n" +
- " public S() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testS_1FGF64P_3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGF64P\n" +
- " */\n" +
- "public class S {\n" +
- " {\n" +
- " new Y()..}\n" +
- " class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on incorrect call>";
- String completeBehind = "new Y()..";
- String expectedCompletionNodeToString = "<CompleteOnName:>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class S {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- " }\n" +
- " public S() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testSA() {
- String str =
- "package p; \n" +
- "public class SA {\n" +
- " public sy void foo() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method modifier>";
- String completeBehind = "sy";
- String expectedCompletionNodeToString = "<CompleteOnType:sy>";
- String completionIdentifier = "sy";
- String expectedReplacedSource = "sy";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class SA {\n" +
- " <CompleteOnType:sy>;\n" +
- " public SA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testSB_1FILFDG() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FILFDG\n" +
- " */\n" +
- "public class SB {\n" +
- " public void foo() {\n" +
- " String s = \"hello\n" +
- " int}\n" +
- "}\n";
-
- String testName = "<complete on field declaration type>";
- String completeBehind = "int";
- String expectedCompletionNodeToString = "<CompleteOnName:int>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class SB {\n" +
- " public SB() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " String s;\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testT_1FGF64P() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGF64P\n" +
- " */\n" +
- "public class T {\n" +
- " {\n" +
- " new Y().}\n" +
- " class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on object creation>";
- String completeBehind = "new Y().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class T {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " <CompleteOnMemberAccess:new Y().>;\n" +
- " }\n" +
- " public T() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testTA_1FHISJJ_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class TA {\n" +
- " void foo() {\n" +
- " Object[] items = \n" +
- " {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .;\n" +
- " items.}\n" +
- "}\n";
-
- String testName = "<complete on array intializer value>";
- String completeBehind = "n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedReplacedSource = "null";
- int cursorLocation = str.indexOf("null, ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class TA {\n" +
- " public TA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] items = {<CompleteOnName:n>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testTA_1FHISJJ_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class TA {\n" +
- " void foo() {\n" +
- " Object[] items = \n" +
- " {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .;\n" +
- " items.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array intializer>";
- String completeBehind =
- " {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .";
- String expectedCompletionNodeToString = "<CompleteOnName:>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class TA {\n" +
- " public TA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] items;\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testTA_1FHISJJ_3() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class TA {\n" +
- " void foo() {\n" +
- " Object[] items = \n" +
- " {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .;\n" +
- " items.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "items.";
- String expectedCompletionNodeToString = "<CompleteOnName:items.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "items.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class TA {\n" +
- " public TA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] items;\n" +
- " <CompleteOnName:items.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testTB_1FHSLMQ() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHSLMQ\n" +
- " */\n" +
- "public class TB {\n" +
- " void foo() {\n" +
- " if (true)\n" +
- " System.out.println(\"\");\n" +
- " e }\n" +
- "}\n";
-
- String testName = "<complete on else keyword>";
- String completeBehind = "e";
- String expectedCompletionNodeToString = "<CompleteOnName:e>";
- String completionIdentifier = "e";
- String expectedReplacedSource = "e";
- int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class TB {\n" +
- " public TB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testU_1FGGUME() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGGUME\n" +
- " */\n" +
- "public class U {\n" +
- " public static final int Source = \n" +
- " 5; \n" +
- "}\n";
-
- String testName = "<complete on digit>";
- String completeBehind = "5";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedReplacedSource = NONE;
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString = null;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER);
- }
-}
-public void testUA_1FHISJJ_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class UA {\n" +
- " void foo() {\n" +
- " Object[] items = \n" +
- " new String[] {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .;\n" +
- " items.}\n" +
- "}\n";
-
- String testName = "<complete on array initializer>";
- String completeBehind =
- "new String[] {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String[]{\"Mark unublishable\",null,\"Properties...\",}.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class UA {\n" +
- " public UA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] items = <CompleteOnMemberAccess:new String[]{\"Mark unublishable\",null,\"Properties...\",}.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testUA_1FHISJJ_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class UA {\n" +
- " void foo() {\n" +
- " Object[] items = \n" +
- " new String[] {\n" +
- " \"Mark unublishable\", \n" +
- " null, \n" +
- " \"Properties...\"}\n" +
- " .;\n" +
- " items.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of array>";
- String completeBehind = "items.";
- String expectedCompletionNodeToString = "<CompleteOnName:items.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "items.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class UA {\n" +
- " public UA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] items;\n" +
- " <CompleteOnName:items.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testUB_1FSBZ02() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FSBZ02\n" +
- " */\n" +
- "class UB {\n" +
- " void bar() {\n" +
- " }\n" +
- " class UBMember {\n" +
- " void bar2() {\n" +
- " }\n" +
- " void foo() {\n" +
- " b\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on keyword>";
- String completeBehind = "b";
- String expectedCompletionNodeToString = "<CompleteOnName:b>";
- String completionIdentifier = "b";
- String expectedReplacedSource = "b";
- int cursorLocation = str.indexOf("b\n") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class UB {\n" +
- " class UBMember {\n" +
- " UBMember() {\n" +
- " }\n" +
- " void bar2() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:b>;\n" +
- " }\n" +
- " }\n" +
- " UB() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testV_1FGGUOO_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGGUOO\n" +
- " */\n" +
- "public class V i java\n" +
- " .io\n" +
- " .Serializable {\n" +
- "}\n";
-
- String testName = "<complete on implements keyword>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "i";
- int cursorLocation = str.indexOf("i java") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class V extends <CompleteOnKeyword:i> {\n" +
- " {\n" +
- " }\n" +
- " public V() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testV_1FGGUOO_2() {
- String str =
- "package x.y.z; \n" +
- "/**\n" +
- " * 1FGGUOO\n" +
- " */\n" +
- "public class V implements java.io.Serializable {\n" +
- "}\n";
-
- String testName = "<complete on package>";
- String completeBehind = "y";
- String expectedCompletionNodeToString = "<CompleteOnPackage:x.y>";
- String completionIdentifier = "y";
- String expectedReplacedSource =
- "x.y.z";
- int cursorLocation = str.indexOf("y") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package <CompleteOnPackage:x.y>;\n" +
- "public class V implements java.io.Serializable {\n" +
- " public V() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVA_1FHISJJ_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class VA {\n" +
- " void foo() {\n" +
- " Object item = new String() {\n" +
- " public boolean equals() {\n" +
- " return false;\n" +
- " }\n" +
- " }\n" +
- " .;\n" +
- " item.}\n" +
- "}\n";
-
- String testName = "<complete on anonymous type declaration>";
- String completeBehind =
- "new String() {\n" +
- " public boolean equals() {\n" +
- " return false;\n" +
- " }\n" +
- " }\n" +
- " .";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String() {\n" +
- " public boolean equals() {\n" +
- " return false;\n" +
- " }\n" +
- "}.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VA {\n" +
- " public VA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object item = <CompleteOnMemberAccess:new String() {\n" +
- " public boolean equals() {\n" +
- " return false;\n" +
- " }\n" +
- "}.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVA_1FHISJJ_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FHISJJ\n" +
- " */\n" +
- "public class VA {\n" +
- " void foo() {\n" +
- " Object item = new String() {\n" +
- " public boolean equals() {\n" +
- " return false;\n" +
- " }\n" +
- " }\n" +
- " .;\n" +
- " item.}\n" +
- "}\n";
-
- String testName = "<complete on local variable>";
- String completeBehind = "item.";
- String expectedCompletionNodeToString = "<CompleteOnName:item.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "item.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VA {\n" +
- " public VA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object item;\n" +
- " <CompleteOnName:item.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVB_1() {
- String str =
- "package p; \n" +
- "public class VB {\n" +
- " void foo() {\n" +
- " new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }\n" +
- " .;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on local variable name into anonymous declaration>";
- String completeBehind = "v";
- String expectedCompletionNodeToString = "<CompleteOnName:v>";
- String completionIdentifier = "v";
- String expectedReplacedSource = "v";
- int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VB {\n" +
- " public VB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new java.io.File(\"error\") {\n" +
- " () {\n" +
- " }\n" +
- " protected void runTest() {\n" +
- " Vector v11111;\n" +
- " <CompleteOnName:v>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVB_2() {
- String str =
- "package p; \n" +
- "public class VB {\n" +
- " void foo() {\n" +
- " new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }.\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on anonymous type declaration>";
- String completeBehind =
- "new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }.";
- String expectedCompletionNodeToString =
- "<CompleteOnMemberAccess:new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " }\n" +
- "}.>";
- String completionIdentifier = "";
- String expectedReplacedSource =
- "new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VB {\n" +
- " public VB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " }\n" +
- "}.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVB_3() {
- String str =
- "package p; \n" +
- "public class VB {\n" +
- " void foo() {\n" +
- " new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }\n" +
- " .;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on constructor>";
- String completeBehind = "new java.io.File(";
- String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new java.io.File()>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VB {\n" +
- " public VB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new java.io.File()>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVB_4() {
- String str =
- "package p; \n" +
- "public class VB {\n" +
- " void foo() {\n" +
- " new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }\n" +
- " .;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on anonymous type declaration with dummy spaces>";
- String completeBehind =
- "new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }\n" +
- " .";
- String expectedCompletionNodeToString =
- "<CompleteOnName:new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " }\n" +
- "}.>";
- String completionIdentifier = "";
- String expectedReplacedSource =
- "new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }\n" +
- " .";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VB {\n" +
- " public VB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " }\n" +
- "}.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testVB_5() {
- String str =
- "package p; \n" +
- "public class VB {\n" +
- " void foo() {\n" +
- " new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }.;\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on anonymous type declaration with trailing semi-colon>";
- String completeBehind =
- "new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }.";
- String expectedCompletionNodeToString =
- "<CompleteOnMemberAccess:new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " }\n" +
- "}.>";
- String completionIdentifier = "";
- String expectedReplacedSource =
- "new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " Vector v11111 = new Vector();\n" +
- " v }\n" +
- " }.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class VB {\n" +
- " public VB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" +
- " protected void runTest() {\n" +
- " }\n" +
- "}.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testW_1FGGUS4() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGGUS4\n" +
- " */\n" +
- "public class W {\n" +
- " public static final int LA = \n" +
- " 1; \n" +
- " public static final int LAB = \n" +
- " 2; \n" +
- " public static final int LABO = \n" +
- " 4; \n" +
- " public int produceDebugAttributes = \n" +
- " LABO; \n" +
- "}\n";
-
- String testName = "<complete on field initializer>";
- String completeBehind = "L";
- String expectedCompletionNodeToString = "<CompleteOnName:L>";
- String completionIdentifier = "L";
- String expectedReplacedSource = "LABO";
- int cursorLocation = str.indexOf("LABO;") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class W {\n" +
- " public static final int LA;\n" +
- " public static final int LAB;\n" +
- " public static final int LABO;\n" +
- " public int produceDebugAttributes = <CompleteOnName:L>;\n" +
- " public W() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testWA_1() {
- String str =
- "package p; \n" +
- "public class WA {\n" +
- " void foo() {\n" +
- " int value = 10;\n" +
- " v int[] tab = new int[value];\n" +
- " }\n";
-
- String testName = "<complete on array size value>";
- String completeBehind = "v";
- String expectedCompletionNodeToString = "<CompleteOnName:v>";
- String completionIdentifier = "v";
- String expectedReplacedSource = "value";
- int cursorLocation = str.indexOf("value];") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class WA {\n" +
- " public WA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int value;\n" +
- " int[] tab = new int[<CompleteOnName:v>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testWA_2() {
- String str =
- "package p; \n" +
- "public class WA {\n" +
- " void foo() {\n" +
- " int value = 10;\n" +
- " v int[] tab = new int[value];\n" +
- " }\n";
-
- String testName = "<complete on corrupter local variable declaration>";
- String completeBehind = "v";
- String expectedCompletionNodeToString = "<CompleteOnName:v>";
- String completionIdentifier = "v";
- String expectedReplacedSource = "v";
- int cursorLocation = str.indexOf("v int[]") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class WA {\n" +
- " public WA() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int value;\n" +
- " <CompleteOnName:v>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testWB_1FI313C() {
- String str =
- "package p; \n" +
- "/*\n" +
- " * 1FI313C\n" +
- " */\n" +
- "class WBHelper {\n" +
- " public int fieldPublic;\n" +
- " protected int fieldProtected;\n" +
- " private int fieldPrivate;\n" +
- " int fieldDefault;\n" +
- " static void staticFoo() {\n" +
- " }\n" +
- " static int i = d;\n" +
- " int neuneu1() {\n" +
- " }\n" +
- " void neuneu2() {\n" +
- " }\n" +
- "}\n" +
- "public class WB\n" +
- " extends WBHelper {\n" +
- " void foo() {\n" +
- " BIJOUR[] b = \n" +
- " new java.lang.Number[]; \n" +
- " java.lang.Short s;\n" +
- " b[1].}\n" +
- " B() {\n" +
- " }\n" +
- " B(int) {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of array element>";
- String completeBehind = "b[1].";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:b[1].>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "class WBHelper {\n" +
- " public int fieldPublic;\n" +
- " protected int fieldProtected;\n" +
- " private int fieldPrivate;\n" +
- " int fieldDefault;\n" +
- " static int i;\n" +
- " WBHelper() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " static void staticFoo() {\n" +
- " }\n" +
- " int neuneu1() {\n" +
- " }\n" +
- " void neuneu2() {\n" +
- " }\n" +
- "}\n" +
- "public class WB extends WBHelper {\n" +
- " public WB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " BIJOUR[] b;\n" +
- " java.lang.Short s;\n" +
- " <CompleteOnMemberAccess:b[1].>;\n" +
- " }\n" +
- " B() {\n" +
- " }\n" +
- " B() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testX_1FGGV8C_1() {
- String str =
- "package p; \n" +
- "import p2.Y; \n" +
- "/**\n" +
- " * 1FGGV8C and 1FGPE8E\n" +
- " */\n" +
- "public class X {\n" +
- " public static final float Vars; \n" +
- " public static final float Lines; \n" +
- " public static final float Source; \n" +
- " public static final float UnreachableCode; \n" +
- " public static final float produceDebugAttributes; \n" +
- " void foo() {\n" +
- " int locale, \n" +
- " errorThreshold, \n" +
- " preserveAllLocalVariables; \n" +
- " return new Y[] {\n" +
- " new Y(\n" +
- " \"debug.vars\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Vars)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.lines\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Lines)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.source\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Source)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.preserveAllLocals\", \n" +
- " this, \n" +
- " locale, \n" +
- " preserveAllLocalVariables\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"optionalError.unReachableCode\", \n" +
- " this, \n" +
- " locale, \n" +
- " (errorThreshold\n" +
- " & UnreachableCode)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1)\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on argument of anonymous type declaration>";
- String completeBehind = "t";
- String expectedCompletionNodeToString = "<CompleteOnName:t>";
- String completionIdentifier = "t";
- String expectedReplacedSource = "this";
- int cursorLocation = str.indexOf("this, ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.Y;\n" +
- "public class X {\n" +
- " public static final float Vars;\n" +
- " public static final float Lines;\n" +
- " public static final float Source;\n" +
- " public static final float UnreachableCode;\n" +
- " public static final float produceDebugAttributes;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int locale;\n" +
- " int errorThreshold;\n" +
- " int preserveAllLocalVariables;\n" +
- " new Y(\"debug.vars\", <CompleteOnName:t>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testX_1FGGV8C_2() {
- String str =
- "package p; \n" +
- "import p2.YZA; \n" +
- "/**\n" +
- " * 1FGGV8C and 1FGPE8E\n" +
- " */\n" +
- "public class X {\n" +
- " public static final float Vars; \n" +
- " public static final float Lines; \n" +
- " public static final float Source; \n" +
- " public static final float UnreachableCode; \n" +
- " public static final float produceDebugAttributes; \n" +
- " void foo() {\n" +
- " int locale, \n" +
- " errorThreshold, \n" +
- " preserveAllLocalVariables; \n" +
- " return new YZA[] {\n" +
- " new YZA(\n" +
- " \"debug.vars\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Vars)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"debug.lines\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Lines)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"debug.source\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Source)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"debug.preserveAllLocals\", \n" +
- " this, \n" +
- " locale, \n" +
- " preserveAllLocalVariables\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"optionalError.unReachableCode\", \n" +
- " this, \n" +
- " locale, \n" +
- " (errorThreshold\n" +
- " & UnreachableCode)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1)\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on anonymous type declaration into a return statement>";
- String completeBehind = "Y";
- String expectedCompletionNodeToString = "<CompleteOnType:Y>";
- String completionIdentifier = "Y";
- String expectedReplacedSource = "YZA";
- int cursorLocation = str.indexOf("YZA[]") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.YZA;\n" +
- "public class X {\n" +
- " public static final float Vars;\n" +
- " public static final float Lines;\n" +
- " public static final float Source;\n" +
- " public static final float UnreachableCode;\n" +
- " public static final float produceDebugAttributes;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int locale;\n" +
- " int errorThreshold;\n" +
- " int preserveAllLocalVariables;\n" +
- " return new <CompleteOnType:Y>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testX_1FGGV8C_3() {
- String str =
- "package p; \n" +
- "import p2.YZA; \n" +
- "/**\n" +
- " * 1FGGV8C and 1FGPE8E\n" +
- " */\n" +
- "public class X {\n" +
- " public static final float Vars; \n" +
- " public static final float Lines; \n" +
- " public static final float Source; \n" +
- " public static final float UnreachableCode; \n" +
- " public static final float produceDebugAttributes; \n" +
- " void foo() {\n" +
- " int locale, \n" +
- " errorThreshold, \n" +
- " preserveAllLocalVariables; \n" +
- " return new YZA[] {\n" +
- " new YZA(\n" +
- " \"debug.vars\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Vars)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"debug.lines\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Lines)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"debug.source\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Source)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"debug.preserveAllLocals\", \n" +
- " this, \n" +
- " locale, \n" +
- " preserveAllLocalVariables\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new YZA(\n" +
- " \"optionalError.unReachableCode\", \n" +
- " this, \n" +
- " locale, \n" +
- " (errorThreshold\n" +
- " & UnreachableCode)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1)\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on anonymous type declaration nested into an array initializer>";
- String completeBehind = "Y";
- String expectedCompletionNodeToString = "<CompleteOnType:Y>";
- String completionIdentifier = "Y";
- String expectedReplacedSource = "YZA";
- int cursorLocation = str.indexOf("YZA(") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.YZA;\n" +
- "public class X {\n" +
- " public static final float Vars;\n" +
- " public static final float Lines;\n" +
- " public static final float Source;\n" +
- " public static final float UnreachableCode;\n" +
- " public static final float produceDebugAttributes;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int locale;\n" +
- " int errorThreshold;\n" +
- " int preserveAllLocalVariables;\n" +
- " new YZA[]{new <CompleteOnType:Y>(),};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testX_1FGGV8C_4() {
- String str =
- "package p; \n" +
- "import p2.Y; \n" +
- "/**\n" +
- " * 1FGGV8C and 1FGPE8E\n" +
- " */\n" +
- "public class X {\n" +
- " public static final float Vars; \n" +
- " public static final float Lines; \n" +
- " public static final float Source; \n" +
- " public static final float UnreachableCode; \n" +
- " public static final float produceDebugAttributes; \n" +
- " void foo() {\n" +
- " int locale, \n" +
- " errorThreshold, \n" +
- " preserveAllLocalVariables; \n" +
- " return new Y[] {\n" +
- " new Y(\n" +
- " \"debug.vars\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Vars)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.lines\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Lines)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.source\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Source)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.preserveAllLocals\", \n" +
- " this, \n" +
- " locale, \n" +
- " preserveAllLocalVariables\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"optionalError.unReachableCode\", \n" +
- " this, \n" +
- " locale, \n" +
- " (errorThreshold\n" +
- " & UnreachableCode)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1)\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field into array intializer>";
- String completeBehind = "n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedReplacedSource = "new";
- int cursorLocation = str.indexOf("new Y(") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.Y;\n" +
- "public class X {\n" +
- " public static final float Vars;\n" +
- " public static final float Lines;\n" +
- " public static final float Source;\n" +
- " public static final float UnreachableCode;\n" +
- " public static final float produceDebugAttributes;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int locale;\n" +
- " int errorThreshold;\n" +
- " int preserveAllLocalVariables;\n" +
- " new Y[]{<CompleteOnName:n>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testX_1FGPE8E() {
- String str =
- "package p; \n" +
- "import p2.Y; \n" +
- "/**\n" +
- " * 1FGGV8C and 1FGPE8E\n" +
- " */\n" +
- "public class X {\n" +
- " public static final float Vars; \n" +
- " public static final float Lines; \n" +
- " public static final float Source; \n" +
- " public static final float UnreachableCode; \n" +
- " public static final float produceDebugAttributes; \n" +
- " void foo() {\n" +
- " int locale, \n" +
- " errorThreshold, \n" +
- " preserveAllLocalVariables; \n" +
- " return new Y[] {\n" +
- " new Y(\n" +
- " \"debug.vars\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Vars)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.lines\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Lines)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.source\", \n" +
- " this, \n" +
- " locale, \n" +
- " (produceDebugAttributes\n" +
- " & Source)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"debug.preserveAllLocals\", \n" +
- " this, \n" +
- " locale, \n" +
- " preserveAllLocalVariables\n" +
- " ? 0\n" +
- " : 1), \n" +
- " new Y(\n" +
- " \"optionalError.unReachableCode\", \n" +
- " this, \n" +
- " locale, \n" +
- " (errorThreshold\n" +
- " & UnreachableCode)\n" +
- " != 0\n" +
- " ? 0\n" +
- " : 1)\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field into return statement>";
- String completeBehind = "n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedReplacedSource = "new";
- int cursorLocation = str.indexOf("new Y[]") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.Y;\n" +
- "public class X {\n" +
- " public static final float Vars;\n" +
- " public static final float Lines;\n" +
- " public static final float Source;\n" +
- " public static final float UnreachableCode;\n" +
- " public static final float produceDebugAttributes;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int locale;\n" +
- " int errorThreshold;\n" +
- " int preserveAllLocalVariables;\n" +
- " return <CompleteOnName:n>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testXA_1FGGUQF_1FHSL8H_1() {
- String str =
- "// int\n" +
- "package p; \n" +
- "/**\n" +
- " * 1FGGUQF and 1FHSL8H\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "/*\n" +
- " * int\n" +
- " */\n" +
- "// int\n" +
- "/**\n" +
- "int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "public class XA {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " void /* int */\n" +
- " foo() {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " }\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " int field /* int */\n" +
- " ;\n" +
- " /*\n" +
- " int\n" +
- " */\n" +
- " static {\n" +
- " // int\n" +
- " }\n" +
- "}\n" +
- "// int\n" +
- "/* int */\n" +
- "/** int */\n";
-
- String testName = "<complete on comment>";
- String completeBehind = "int.";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedReplacedSource = NONE;
- int cursorLocation = str.indexOf("int.\n") + completeBehind.length() - 1;
- String expectedUnitDisplayString = null;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT);
- }
-}
-public void testXA_1FGGUQF_1FHSL8H_2() {
- String str =
- "// int\n" +
- "package p; \n" +
- "/**\n" +
- " * 1FGGUQF and 1FHSL8H\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "/*\n" +
- " * int\n" +
- " */\n" +
- "// int\n" +
- "/**\n" +
- "int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "public class XA {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " void /* int */\n" +
- " foo() {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " }\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " int field /* int */\n" +
- " ;\n" +
- " /*\n" +
- " int\n" +
- " */\n" +
- " static {\n" +
- " // int\n" +
- " }\n" +
- "}\n" +
- "// int\n" +
- "/* int */\n" +
- "/** int */\n";
-
- String testName = "<complete on comment>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedReplacedSource = NONE;
- int cursorLocation = str.indexOf("int\n") + completeBehind.length() - 1;
- String expectedUnitDisplayString = null;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT);
- }
-}
-public void testXA_1FGGUQF_1FHSL8H_3() {
- String str =
- "// int\n" +
- "package p; \n" +
- "/**\n" +
- " * 1FGGUQF and 1FHSL8H\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "/*\n" +
- " * int\n" +
- " */\n" +
- "// int\n" +
- "/**\n" +
- "int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "public class XA {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " void /* int */ foo() {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " }\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " int field /* int */\n" +
- " ;\n" +
- " /*\n" +
- " int\n" +
- " */\n" +
- " static {\n" +
- " // int\n" +
- " }\n" +
- "}\n" +
- "// int\n" +
- "/* int */\n" +
- "/** int */\n";
-
- String testName = "<complete on comment>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedReplacedSource = NONE;
- int cursorLocation = str.indexOf("int */") + completeBehind.length() - 1;
- String expectedUnitDisplayString = null;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT);
- }
-}
-public void testXA_1FGGUQF_1FHSL8H_4() {
- String str =
- "// int\n" +
- "package p; \n" +
- "/**\n" +
- " * 1FGGUQF and 1FHSL8H\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "/*\n" +
- " * int\n" +
- " */\n" +
- "// int\n" +
- "/**\n" +
- "int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- "/**\n" +
- " * int\n" +
- " */\n" +
- "public class XA {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " void /* int */ foo() {\n" +
- " // int\n" +
- " /* int */\n" +
- " /** int */\n" +
- " }\n" +
- " /**\n" +
- " int.\n" +
- " * Internal API used to resolve a compilation unit minimally for code assist engine\n" +
- " */\n" +
- " int field /* int */\n" +
- " ;\n" +
- " /*\n" +
- " int\n" +
- " */\n" +
- " static {\n" +
- " // int\n" +
- " }\n" +
- "}\n" +
- "// int\n" +
- "/* int */\n" +
- "/** int */\n";
-
- String testName = "<complete on comment>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "";
- String expectedReplacedSource = NONE;
- int cursorLocation = str.indexOf("int */ foo()") + completeBehind.length() - 1;
- String expectedUnitDisplayString = null;
-
- try {
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT);
- }
-}
-public void testXB_1FIYM5I_1() {
- String str =
- "package p; \n" +
- "/*\n" +
- " * 1FIYM5I\n" +
- " */\n" +
- "public class XB\n" +
- " extends java.io.File {\n" +
- " void foo() {\n" +
- " XB xb = new XB();\n" +
- " this.separator.;\n" +
- " this.bar().;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of explicit this access>";
- String completeBehind = "this.s";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.s>";
- String completionIdentifier = "s";
- String expectedReplacedSource = "this.separator";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class XB extends java.io.File {\n" +
- " public XB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " XB xb;\n" +
- " <CompleteOnMemberAccess:this.s>;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testXB_1FIYM5I_2() {
- String str =
- "package p; \n" +
- "/*\n" +
- " * 1FIYM5I\n" +
- " */\n" +
- "public class XB\n" +
- " extends java.io.File {\n" +
- " void foo() {\n" +
- " XB xb = new XB();\n" +
- " this.separator.;\n" +
- " this.bar().;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of explicitly accessed field>";
- String completeBehind = "this.separator.";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.separator.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class XB extends java.io.File {\n" +
- " public XB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " XB xb;\n" +
- " <CompleteOnMemberAccess:this.separator.>;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testXB_1FIYM5I_3() {
- String str =
- "package p; \n" +
- "/*\n" +
- " * 1FIYM5I\n" +
- " */\n" +
- "public class XB\n" +
- " extends java.io.File {\n" +
- " void foo() {\n" +
- " XB xb = new XB();\n" +
- " this.separator.;\n" +
- " this.bar().;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of explicit this access>";
- String completeBehind = "this.b";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.b>";
- String completionIdentifier = "b";
- String expectedReplacedSource = "this.bar";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class XB extends java.io.File {\n" +
- " public XB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " XB xb;\n" +
- " <CompleteOnMemberAccess:this.b>;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testXB_1FIYM5I_4() {
- String str =
- "package p; \n" +
- "/*\n" +
- " * 1FIYM5I\n" +
- " */\n" +
- "public class XB\n" +
- " extends java.io.File {\n" +
- " void foo() {\n" +
- " XB xb = new XB();\n" +
- " this.separator.;\n" +
- " this.bar().;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field of explicitly accessed method>";
- String completeBehind = "this.bar().";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.bar().>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class XB extends java.io.File {\n" +
- " public XB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " XB xb;\n" +
- " <CompleteOnMemberAccess:this.bar().>;\n" +
- " }\n" +
- " String bar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testY_1FGPESI() {
- String str =
- "package p; \n" +
- "import p2.; \n" +
- "/**\n" +
- " * 1FGPESI\n" +
- " */\n" +
- "public class Y {\n" +
- "}\n";
-
- String testName = "<complete on imports>";
- String completeBehind = "p2.";
- String expectedCompletionNodeToString = "<CompleteOnImport:p2.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "p2.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnImport:p2.>;\n" +
- "public class Y {\n" +
- " public Y() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testYA_1FGRIUH() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGRIUH\n" +
- " */\n" +
- "public class YA\n" +
- " extends YASecondTopLevel {\n" +
- " void eFoo() {\n" +
- " }\n" +
- " class YAMember {\n" +
- " void eFoo() {\n" +
- " }\n" +
- " void eBar() {\n" +
- " e }\n" +
- " }\n" +
- "}\n" +
- "class YASecondTopLevel {\n" +
- " public boolean equals(YA yaya) {\n" +
- " return true;\n" +
- " }\n" +
- " public eFoo() {\n" +
- " }\n" +
- " public void eFooBar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete on method/field>";
- String completeBehind = "e";
- String expectedCompletionNodeToString = "<CompleteOnName:e>";
- String completionIdentifier = "e";
- String expectedReplacedSource = "e";
- int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class YA extends YASecondTopLevel {\n" +
- " class YAMember {\n" +
- " YAMember() {\n" +
- " }\n" +
- " void eFoo() {\n" +
- " }\n" +
- " void eBar() {\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- " }\n" +
- " public YA() {\n" +
- " }\n" +
- " void eFoo() {\n" +
- " }\n" +
- "}\n" +
- "class YASecondTopLevel {\n" +
- " YASecondTopLevel() {\n" +
- " }\n" +
- " public boolean equals(YA yaya) {\n" +
- " }\n" +
- " public eFoo() {\n" +
- " }\n" +
- " public void eFooBar() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testYB_1FJ4D46_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ4D46\n" +
- " */\n" +
- "public class YB {\n" +
- " void foo() {\n" +
- " new String(\"asdf\".getBytes()).}\n" +
- "}\n";
-
- String testName = "<complete on method/field of object creation>";
- String completeBehind = "new String(\"asdf\".getBytes()).";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String(\"asdf\".getBytes()).>";
- String completionIdentifier = "";
- String expectedReplacedSource = "";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class YB {\n" +
- " public YB() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new String(\"asdf\".getBytes()).>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZ_1FGPF3D_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGPF3D\n" +
- " */\n" +
- "public class Z imp Pro.Sev, \n" +
- " Bla.Blo {\n" +
- "}\n";
-
- String testName = "<complete on implements keyword>";
- String completeBehind = "imp";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:imp>";
- String completionIdentifier = "imp";
- String expectedReplacedSource = "imp";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class Z extends <CompleteOnKeyword:imp> {\n" +
- " {\n" +
- " }\n" +
- " public Z() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZ_1FGPF3D_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FGPF3D\n" +
- " */\n" +
- "public class Z implements Pro.Sev, \n" +
- " Bla.Blo {\n" +
- "}\n";
-
- String testName = "<complete on implented interface>";
- String completeBehind = "P";
- String expectedCompletionNodeToString = "<CompleteOnInterface:P>";
- String completionIdentifier = "P";
- String expectedReplacedSource = "Pro";
- int cursorLocation = str.indexOf("Pro.Sev") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class Z implements <CompleteOnInterface:P>, Bla.Blo {\n" +
- " public Z() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZA_1() {
- String str =
- "package p; \n" +
- "import java.util.Vector;\n";
-
- String testName = "<complete on import keyword>";
- String completeBehind = "i";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:i>";
- String completionIdentifier = "i";
- String expectedReplacedSource = "import";
- int cursorLocation = str.indexOf("import") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:i>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZA_2() {
- String str =
- "package p; \n" +
- "import java.util.Vector;\n";
-
- String testName = "<complete on imported package>";
- String completeBehind = "jav";
- String expectedCompletionNodeToString = "<CompleteOnImport:jav>";
- String completionIdentifier = "jav";
- String expectedReplacedSource = "java.util.Vector";
- int cursorLocation = str.indexOf("java.util.Vector") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnImport:jav>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZA_3() {
- String str =
- "package p; \n" +
- "import java.util.Vector;\n";
-
- String testName = "<complete on imported type>";
- String completeBehind = "java.util.V";
- String expectedCompletionNodeToString = "<CompleteOnImport:java.util.V>";
- String completionIdentifier = "V";
- String expectedReplacedSource = "java.util.Vector";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnImport:java.util.V>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZB_1FJ4D46_1() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ4D46\n" +
- " */\n" +
- "import java.util.zip.CRC32;\n" +
- "import java.io.*;\n" +
- "public class ZB {\n" +
- " public static void main(\n" +
- " java.lang.String[] args) {\n" +
- " File file = \n" +
- " new File(\"d:\\\\314\"); \n" +
- " CRC32 crc = new CRC32();\n" +
- " file.}\n" +
- "}\n";
-
- String testName = "<complete on method/field of local variable>";
- String completeBehind = "file.";
- String expectedCompletionNodeToString = "<CompleteOnName:file.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "file.";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.zip.CRC32;\n" +
- "import java.io.*;\n" +
- "public class ZB {\n" +
- " public ZB() {\n" +
- " }\n" +
- " public static void main(java.lang.String[] args) {\n" +
- " File file;\n" +
- " CRC32 crc;\n" +
- " <CompleteOnName:file.>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-public void testZB_1FJ4D46_2() {
- String str =
- "package p; \n" +
- "/**\n" +
- " * 1FJ4D46\n" +
- " */\n" +
- "import java.util.zip.CRC32;\n" +
- "import java.io.*;\n" +
- "public class ZB {\n" +
- " public static void main(\n" +
- " java.lang.String[] args) {\n" +
- " File file = \n" +
- " new File(\"d:\\\\314\"); \n" +
- " CRC32 crc = new CRC32();\n" +
- " file.}\n" +
- "}\n";
-
- String testName = "<complete on local variable type>";
- String completeBehind = "CRC";
- String expectedCompletionNodeToString = "<CompleteOnName:CRC>";
- String completionIdentifier = "CRC";
- String expectedReplacedSource = "CRC32";
- int cursorLocation = str.indexOf("CRC32 crc") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "import java.util.zip.CRC32;\n" +
- "import java.io.*;\n" +
- "public class ZB {\n" +
- " public ZB() {\n" +
- " }\n" +
- " public static void main(java.lang.String[] args) {\n" +
- " File file;\n" +
- " <CompleteOnName:CRC>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in initializer
- */
-public void test001(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int v1;\n" +
- " {\n" +
- " Obj\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete in initializer>";
- String completeBehind = "Obj";
- String expectedCompletionNodeToString = "<CompleteOnName:Obj>";
- String completionIdentifier = "Obj";
- String expectedReplacedSource = "Obj";
- int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int v1;\n" +
- " {\n" +
- " <CompleteOnName:Obj>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete after initializer
- */
-public void test002(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int v1;\n" +
- " {\n" +
- " int v2\n" +
- " }\n" +
- " Obj" +
- " }\n" +
- "}\n";
-
- String testName = "<complete after initializer>";
- String completeBehind = "Obj";
- String expectedCompletionNodeToString = "<CompleteOnName:Obj>";
- String completionIdentifier = "Obj";
- String expectedReplacedSource = "Obj";
- int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int v1;\n" +
- " <CompleteOnName:Obj>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in initializer
- */
-public void test003(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int v1;\n" +
- " {\n" +
- " this.\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete in initializer>";
- String completeBehind = "this.";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>";
- String completionIdentifier = "";
- String expectedReplacedSource = "this.";
- int cursorLocation = str.indexOf("this.") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int v1;\n" +
- " {\n" +
- " <CompleteOnMemberAccess:this.>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-
-/**
- * Complete in switch
- */
-public void test004(){
- String str =
- "public class X {\n" +
- " final static int ZZZ = 1;\n"+
- " void foo(){\n" +
- " switch(2)\n" +
- " case 0 + ZZZ :\n" +
- " case 1 + ZZZ :\n" +
- " bar(ZZZ)\n" +
- " }\n" +
- " void bar(int y) {}\n"+
- "}\n";
-
- String testName = "<complete in switch>";
- String completeBehind = "ZZZ";
- String expectedCompletionNodeToString = "<CompleteOnName:ZZZ>";
- String completionIdentifier = "ZZZ";
- String expectedReplacedSource = "ZZZ";
- int cursorLocation = str.lastIndexOf("ZZZ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " static final int ZZZ;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " bar(<CompleteOnName:ZZZ>);\n" +
- " }\n" +
- " void bar(int y) {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in method type.
- */
-public void test005(){
- String str =
- "public class X {\n" +
- " clon foo(){\n" +
- " }\n" +
- "}\n";
-
- String testName = "<complete in method type>";
- String completeBehind = "clon";
- String expectedCompletionNodeToString = "<CompleteOnType:clon>";
- String completionIdentifier = "clon";
- String expectedReplacedSource = "clon";
- int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " <CompleteOnType:clon>\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in method type.
- */
-public void test006(){
- String str =
- "public class X {\n" +
- " clon\n" +
- " foo();\n" +
- "}\n";
-
- String testName = "<complete in method type>";
- String completeBehind = "clon";
- String expectedCompletionNodeToString = "<CompleteOnType:clon>";
- String completionIdentifier = "clon";
- String expectedReplacedSource = "clon";
- int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:clon>;\n" +
- " public X() {\n" +
- " }\n" +
- " foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in field type.
- */
-public void test007(){
- String str =
- "public class X {\n" +
- " clon x;\n" +
- "}\n";
-
- String testName = "<complete in field type>";
- String completeBehind = "clon";
- String expectedCompletionNodeToString = "<CompleteOnType:clon>";
- String completionIdentifier = "clon";
- String expectedReplacedSource = "clon";
- int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:clon>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in field type.
- */
-public void test008(){
- String str =
- "public class X {\n" +
- " clon\n" +
- " x;\n" +
- "}\n";
-
- String testName = "<complete in field type>";
- String completeBehind = "clon";
- String expectedCompletionNodeToString = "<CompleteOnType:clon>";
- String completionIdentifier = "clon";
- String expectedReplacedSource = "clon";
- int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:clon>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in field type.
- */
-public void test009(){
- String str =
- "public class X {\n" +
- " clon\n" +
- " x y;\n" +
- "}\n";
-
- String testName = "<complete in field tpye>";
- String completeBehind = "clon";
- String expectedCompletionNodeToString = "<CompleteOnType:clon>";
- String completionIdentifier = "clon";
- String expectedReplacedSource = "clon";
- int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:clon>;\n" +
- " x y;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Complete in method type.
- */
-public void test010(){
- String str =
- "public class X {\n" +
- " clon\n" +
- " x y(){}\n" +
- "}\n";
-
- String testName = "<complete in method type>";
- String completeBehind = "clon";
- String expectedCompletionNodeToString = "<CompleteOnType:clon>";
- String completionIdentifier = "clon";
- String expectedReplacedSource = "clon";
- int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:clon>;\n" +
- " public X() {\n" +
- " }\n" +
- " x y() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=25233
- */
-public void test011(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " new Object[]{\n" +
- " bar(zzz)\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String testName = "<bug 25233>";
- String completeBehind = "zzz";
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new bar(<CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=27370
- */
-public void test012(){
- String str =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " Object o = new ZZZ\n" +
- "}\n";
-
- String testName = "<bug 27370>";
- String completeBehind = "ZZZ";
- String expectedCompletionNodeToString = "<CompleteOnType:ZZZ>";
- String completionIdentifier = "ZZZ";
- String expectedReplacedSource = "ZZZ";
- int cursorLocation = str.lastIndexOf("ZZZ") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " Object o = new <CompleteOnType:ZZZ>();\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=27735
- */
-public void test013(){
- String str =
- "public class Bar {\n" +
- " #\n" +
- " Bar foo1 = new Bar(){};\n" +
- " {int i;}\n" +
- " synchronized void foo3() {}\n" +
- " zzz\n" +
- "}\n";
-
- String testName = "<bug 27735>";
- String completeBehind = "zzz";
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class Bar {\n" +
- " Bar foo1;\n" +
- " {\n" +
- " }\n" +
- " <CompleteOnType:zzz>;\n" +
- " public Bar() {\n" +
- " }\n" +
- " synchronized void foo3() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=27941
- */
-public void test014(){
- String str =
- "public class Bar {\n" +
- " void foo() {\n" +
- " String s = \"a\" + \"b\";\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String testName = "<bug 27941>";
- String completeBehind = "zzz";
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1;
- String expectedUnitDisplayString =
- "public class Bar {\n" +
- " public Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " String s;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
deleted file mode 100644
index 7481e47..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
+++ /dev/null
@@ -1,7281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class CompletionParserTest2 extends AbstractCompletionTest {
-public CompletionParserTest2(String testName) {
- super(testName);
-}
-public void test0001(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "Object o = <CompleteOnName:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = <CompleteOnName:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0002(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0003(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0004(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "Object o = <CompleteOnName:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = <CompleteOnName:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0005(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0006(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0007(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>()";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new <CompleteOnType:zzz>();\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0008(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>()";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new <CompleteOnType:zzz>();\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0009(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = new zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>()";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new <CompleteOnType:zzz>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0010(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = new zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>()";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new <CompleteOnType:zzz>();\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0011(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = new zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>()";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o = new <CompleteOnType:zzz>();\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0012(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = new zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>()";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new <CompleteOnType:zzz>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0013(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = yyy;\n" +
- " zzz\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " <CompleteOnType:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0014(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0015(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0016(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = yyy;\n" +
- " zzz\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " <CompleteOnType:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0017(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0018(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0019(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = bar(zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "bar(<CompleteOnName:zzz>)";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = bar(<CompleteOnName:zzz>);\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0020(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = bar(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "bar(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = bar(<CompleteOnName:zzz>);\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0021(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = bar(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "bar(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = bar(<CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0022(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = bar(zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "bar(<CompleteOnName:zzz>)";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = bar(<CompleteOnName:zzz>);\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0023(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = bar(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "bar(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o = bar(<CompleteOnName:zzz>);\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0024(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = bar(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "bar(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = bar(<CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0025(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X(zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X(<CompleteOnName:zzz>)";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X(<CompleteOnName:zzz>);\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0026(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new X(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new X(<CompleteOnName:zzz>);\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0027(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = new X(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new X(<CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0028(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = new X(zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X(<CompleteOnName:zzz>)";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X(<CompleteOnName:zzz>);\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0029(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = new X(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o = new X(<CompleteOnName:zzz>);\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0030(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = new X(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X(<CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new X(<CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0031(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = {zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0032(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0033(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0034(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = {zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0035(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0036(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0037(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = {zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = {<CompleteOnName:zzz>,};\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0038(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = {<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0039(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object[] o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = {<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0040(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object[] o = {zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = {<CompleteOnName:zzz>,};\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0041(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object[] o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object[] o = {<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0042(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object[] o = {zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = {<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0043(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = new X[zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = new X[<CompleteOnName:zzz>];\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-
-public void test0044(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-
-public void test0045(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object[] o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-
-public void test0046(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object[] o = new X[zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = new X[<CompleteOnName:zzz>];\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-
-public void test0047(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object[] o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object[] o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-
-public void test0048(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object[] o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0049(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = new X[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = new X[]{<CompleteOnName:zzz>,};\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0050(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0051(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object[] o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0052(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object[] o = new X[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = new X[]{<CompleteOnName:zzz>,};\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0053(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object[] o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object[] o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0054(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object[] o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0055(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = <CompleteOnName:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0056(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object[] o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0057(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object[] o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0058(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object[] o = zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object[] o = <CompleteOnName:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0059(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object[] o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object[] o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0060(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object[] o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object[] o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0061(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X[zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X[<CompleteOnName:zzz>];\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0062(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0063(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0064(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = new X[zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X[<CompleteOnName:zzz>];\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-public void test0065(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0066(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = new X[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new X[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0067(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = new X[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0068(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0069(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0070(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = new X[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0071(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0072(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " Object o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0073(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " int o = new int[zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new int[<CompleteOnName:zzz>]";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " int o = new int[<CompleteOnName:zzz>];\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0074(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " int o = new int[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new int[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " int o = new int[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0075(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int o = new int[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new int[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int o = new int[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0076(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " int o = new int[zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new int[<CompleteOnName:zzz>]";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " int o = new int[<CompleteOnName:zzz>];\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0077(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " int o = new int[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new int[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " int o = new int[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0078(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " int o = new int[zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new int[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int o = new int[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0079(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " int o = new int[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " int o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " int o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0080(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " int o = new int[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " int o = new int[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0081(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int o = new int[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new int[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int o = new int[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0082(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " int o = new int[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " int o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " int o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0083(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " int o = new int[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " int o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0084(){
-
-
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " int o = new int[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new int[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0085(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " X o = new X[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " X o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " X o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0086(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " X o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " X o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0087(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " X o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X o = new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0088(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " X o = new X[]{zzz;\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " X o;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " X o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0089(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " X o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " X o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0090(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " X o = new X[]{zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>,}";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " new X[]{<CompleteOnName:zzz>,};\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X o;\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0091(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " Object o = \"yyy;\n" +
- " zzz\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " <CompleteOnType:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0092(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o = \"yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0093(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o = \"yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0094(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " #\n" +
- " Object o = \"yyy;\n" +
- " zzz\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "zzz";
- String expectedReplacedSource = "zzz";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " Object o;\n" +
- " <CompleteOnType:zzz>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-
-
-public void test0095(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = \"yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-
-public void test0096(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " #\n" +
- " Object o = \"yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " {\n" +
- " {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0097(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0098(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "o = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " o = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0099(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = new zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- expectedParentNodeToString = "o = new <CompleteOnType:zzz>()";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " o = new <CompleteOnType:zzz>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0100(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = new zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:zzz>";
- expectedParentNodeToString = "o = new <CompleteOnType:zzz>()";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " o = new <CompleteOnType:zzz>();\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0101(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0102(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0103(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = \"yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0104(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " Object o;\n" +
- " o = \"yyy;\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-
-public void test0105(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int x = 1 + zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "(1 + <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = (1 + <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0106(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int x = 1 + (zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "(1 + <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = (1 + <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0107(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int x = 0;\n" +
- " int y = 1 + x;\n" +
- " zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x;\n" +
- " int y;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0108(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int x = -zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "(- <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = (- <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0109(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int x = -(zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "(- <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x = (- <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0110(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int x = 0;\n" +
- " int y = -x;\n" +
- " zzz;\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int x;\n" +
- " int y;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0111(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " if(1 == zzz) {}\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "(1 == <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (1 == <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0112(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " if(1 == (zzz)) {}\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "(1 == <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (1 == <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0113(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(Object x){\n" +
- " if(x instanceof ZZZ) {}\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ZZZ";
- int cursorLocation = str.indexOf("ZZZ") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo(Object x) {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnType:ZZZ>";
- expectedParentNodeToString = "(x instanceof <CompleteOnType:ZZZ>)";
- completionIdentifier = "ZZZ";
- expectedReplacedSource = "ZZZ";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo(Object x) {\n" +
- " (x instanceof <CompleteOnType:ZZZ>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0114(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " boolean a, b, c;\n" +
- " c = a == b ? zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "c = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " boolean a;\n" +
- " boolean b;\n" +
- " boolean c;\n" +
- " c = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0115(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " boolean a, b;\n" +
- " a == b ? zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " boolean a;\n" +
- " boolean b;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0116(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " boolean a, b, c;\n" +
- " c = a == b ? a : zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "c = ((a == b) ? a : <CompleteOnName:zzz>)";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " boolean a;\n" +
- " boolean b;\n" +
- " boolean c;\n" +
- " c = ((a == b) ? a : <CompleteOnName:zzz>);\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0117(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " boolean a, b, c;\n" +
- " c = a == b ? a : (zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "c = <CompleteOnName:zzz>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " boolean a;\n" +
- " boolean b;\n" +
- " boolean c;\n" +
- " c = <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0118(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " boolean a, b, c;\n" +
- " c = a# == b ? a : zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " boolean a;\n" +
- " boolean b;\n" +
- " boolean c;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0119(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " switch(1) {\n" +
- " case zzz\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0120(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " switch(1) {\n" +
- " case Something :\n" +
- " case zzz\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0121(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " tab[zzz]\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "tab[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " tab[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0122(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " tab[].zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:tab[].zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "tab[].zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:tab[].zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0123(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " tab[0].zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnMemberAccess:tab[0].zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:tab[0].zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0124(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " foo()[zzz]\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "foo()[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " foo()[<CompleteOnName:zzz>];\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0125(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " foo()[].zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0126(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " foo()[1].zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnMemberAccess:foo()[1].zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:foo()[1].zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0127(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " if (zzz() == null) bar = null;\n" +
- " }\n" +
- " Object o = new O();\n" +
- "}\n";
-
- String completeBehind = "O";
- int cursorLocation = str.lastIndexOf("O") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:O>";
- String expectedParentNodeToString = "Object o = new <CompleteOnType:O>()";
- String completionIdentifier = "O";
- String expectedReplacedSource = "O";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " Object o = new <CompleteOnType:O>();\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-public void test0128(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " new Object() {\n" +
- " void bar() {\n" +
- " a[zzz\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "a[<CompleteOnName:zzz>]";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void bar() {\n" +
- " a[<CompleteOnName:zzz>];\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-public void test0129(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " Object local;\n" +
- " double bar;\n" +
- " for(;;) {\n" +
- " bar = (double)0;\n" +
- " }\n" +
- " zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "zzz";
- int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:zzz>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "zzz";
- expectedReplacedSource = "zzz";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object local;\n" +
- " double bar;\n" +
- " <CompleteOnName:zzz>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTestKeyword.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTestKeyword.java
deleted file mode 100644
index 81fffd2..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTestKeyword.java
+++ /dev/null
@@ -1,15515 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class CompletionParserTestKeyword extends AbstractCompletionTest {
-public CompletionParserTestKeyword(String testName) {
- super(testName);
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0001(){
- String str =
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0002(){
- String str =
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0003(){
- String str =
- "package p;\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0004(){
- String str =
- "package p;\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0005(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0006(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0007(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "public abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0008(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "public abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0009(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "abstract abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0010(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "abstract abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0011(){
- String str =
- "package p;\n" +
- "import \n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnImport:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnImport:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0012(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "public class X {}\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0013(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "public class X {}\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0014(){
- String str =
- "package p;\n" +
- "import yyy;\n" +
- "final abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0015(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0016(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " abst zzz\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0017(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " public abst zzz\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0018(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " final abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0019(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " abstract abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0020(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " static abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0021(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " abst\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:abst>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "abst";
- expectedReplacedSource = "abst";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:abst>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0022(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " abst zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:abst>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "abst";
- expectedReplacedSource = "abst";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:abst>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'break' keyword.
- */
-public void test0023(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bre\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf("bre") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:bre>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "bre";
- expectedReplacedSource = "bre";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:bre>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'break' keyword.
- */
-public void test0024(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " for(int i; i < 10; i++) {\n" +
- " bre\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf("bre") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:bre>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "bre";
- expectedReplacedSource = "bre";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnName:bre>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'case' keyword.
- */
-public void test0025(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " cas\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf("cas") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:cas>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cas";
- expectedReplacedSource = "cas";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cas>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'case' keyword.
- */
-public void test0026(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " switch(0) {\n" +
- " cas\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf("cas") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:cas>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cas";
- expectedReplacedSource = "cas";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:cas>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'catch' keyword.
- */
-public void test0027(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " cat\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf("cat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:cat>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cat";
- expectedReplacedSource = "cat";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cat>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'catch' keyword.
- */
-public void test0028(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " try {\n" +
- " } cat\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf("cat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:cat>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cat";
- expectedReplacedSource = "cat";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:cat>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0029(){
- String str =
- "cla";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0030(){
- String str =
- "public cla";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0031(){
- String str =
- "public final cla";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0032(){
- String str =
- "public final cla X";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0033(){
- String str =
- "public class X {\n" +
- " cla\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0034(){
- String str =
- "public class X {\n" +
- " public cla\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0035(){
- String str =
- "public class X {\n" +
- " public final cla\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0036(){
- String str =
- "public class X {\n" +
- " public final cla Y\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0037(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " cla\n" +
- " }\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:cla>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cla";
- expectedReplacedSource = "cla";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cla>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0038(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " final cla\n" +
- " }\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:cla>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cla";
- expectedReplacedSource = "cla";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cla>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0039(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " final cla Y\n" +
- " }\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:cla>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cla";
- expectedReplacedSource = "cla";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cla>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'continue' keyword.
- */
-public void test0040(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " con\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "con";
- int cursorLocation = str.lastIndexOf("con") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:con>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "con";
- expectedReplacedSource = "con";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:con>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'continue' keyword.
- */
-public void test0041(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " for(int i; i < 5; i++) {\n" +
- " con\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "con";
- int cursorLocation = str.lastIndexOf("con") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:con>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "con";
- expectedReplacedSource = "con";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnName:con>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'default' keyword.
- */
-public void test0042(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " def\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf("def") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:def>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "def";
- expectedReplacedSource = "def";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:def>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'default' keyword.
- */
-public void test0043(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " switch(0) {\n" +
- " case 1 : break;\n" +
- " def\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf("def") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:def>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "def";
- expectedReplacedSource = "def";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:def>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'do' keyword.
- */
-public void test0044(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " do\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf("do") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:do>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "do";
- expectedReplacedSource = "do";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:do>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'else' keyword.
- */
-public void test0045(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " els\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf("els") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:els>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "els";
- expectedReplacedSource = "els";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:els>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'else' keyword.
- */
-public void test0046(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " if(true) {\n" +
- " } els\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf("els") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:els>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "els";
- expectedReplacedSource = "els";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:els>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0047(){
- String str =
- "ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0048(){
- String str =
- "X ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0049(){
- String str =
- "ext Y";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0050(){
- String str =
- "class X ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0051(){
- String str =
- "class X ext Y";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0052(){
- String str =
- "class X ext Y {";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0053(){
- String str =
- "class X extends Y ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0054(){
- String str =
- "class X implements Y ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X implements Y {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0055(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0056(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " try {" +
- " } fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'for' keyword.
- */
-public void test0057(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " for" +
- " }\n" +
- "}\n";
-
- String completeBehind = "for";
- int cursorLocation = str.lastIndexOf("for") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:for>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "for";
- expectedReplacedSource = "for";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:for>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'if' keyword.
- */
-public void test0058(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " if" +
- " }\n" +
- "}\n";
-
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf("if") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:if>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "if";
- expectedReplacedSource = "if";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:if>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'switch' keyword.
- */
-public void test0059(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " swi" +
- " }\n" +
- "}\n";
-
- String completeBehind = "swi";
- int cursorLocation = str.lastIndexOf("swi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:swi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "swi";
- expectedReplacedSource = "swi";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:swi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0060(){
- String str =
- "impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0061(){
- String str =
- "X impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0062(){
- String str =
- "impl Y";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0063(){
- String str =
- "class X impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0064(){
- String str =
- "class X impl Y";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0065(){
- String str =
- "class X impl Y {";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0066(){
- String str =
- "class X extends Y impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0067(){
- String str =
- "class X implements Y impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X implements Y {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0068(){
- String str =
- "impo";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0069(){
- String str =
- "package p;\n" +
- "impo";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0070(){
- String str =
- "package p;\n" +
- "import p2.Y;\n" +
- "impo";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.Y;\n" +
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0071(){
- String str =
- "impo p2.Y";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0072(){
- String str =
- "int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0073(){
- String str =
- "public int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0074(){
- String str =
- "public abstract int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0075(){
- String str =
- "public abstract int X";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0076(){
- String str =
- "public class X {\n" +
- " int\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0077(){
- String str =
- "public class X {\n" +
- " public int\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0078(){
- String str =
- "public class X {\n" +
- " public abstract int\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0079(){
- String str =
- "public class X {\n" +
- " public abstract int Y\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0080(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " int\n" +
- " }\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:int>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "int";
- expectedReplacedSource = "int";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0081(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " abstract int\n" +
- " }\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:int>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "int";
- expectedReplacedSource = "int";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0082(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " abstract int Y\n" +
- " }\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:int>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "int";
- expectedReplacedSource = "int";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0083(){
- String str =
- "public final int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0084(){
- String str =
- "public final int X";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0085(){
- String str =
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pac>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0086(){
- String str =
- "pac p";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pac>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0087(){
- String str =
- "package p;" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "package p;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0088(){
- String str =
- "import p;" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "import p;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0089(){
- String str =
- "class X {}" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'return' keyword.
- */
-public void test0090(){
- String str =
- "public class X {\n" +
- " int foo() {\n" +
- " ret\n" +
- " }\n" +
- "}";
-
- String completeBehind = "ret";
- int cursorLocation = str.lastIndexOf("ret") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:ret>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ret";
- expectedReplacedSource = "ret";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <CompleteOnName:ret>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'throw' keyword.
- */
-public void test0091(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:thr>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "thr";
- expectedReplacedSource = "thr";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:thr>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'try' keyword.
- */
-public void test0092(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " try\n" +
- " }\n" +
- "}";
-
- String completeBehind = "try";
- int cursorLocation = str.lastIndexOf("try") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:try>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "try";
- expectedReplacedSource = "try";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:try>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'try' keyword.
- */
-public void test0093(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(try\n" +
- " }\n" +
- "}";
-
- String completeBehind = "try";
- int cursorLocation = str.lastIndexOf("try") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:try>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "try";
- expectedReplacedSource = "try";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:try>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'do' keyword.
- */
-public void test0094(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(do\n" +
- " }\n" +
- "}";
-
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf("do") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:do>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "do";
- expectedReplacedSource = "do";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:do>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'for' keyword.
- */
-public void test0095(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(for\n" +
- " }\n" +
- "}";
-
- String completeBehind = "for";
- int cursorLocation = str.lastIndexOf("for") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:for>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "for";
- expectedReplacedSource = "for";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:for>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'if' keyword.
- */
-public void test0096(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(if\n" +
- " }\n" +
- "}";
-
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf("if") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:if>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "if";
- expectedReplacedSource = "if";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:if>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'switch' keyword.
- */
-public void test0097(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(swi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "swi";
- int cursorLocation = str.lastIndexOf("swi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:swi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "swi";
- expectedReplacedSource = "swi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:swi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'new' keyword.
- */
-public void test0098(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " new\n" +
- " }\n" +
- "}";
-
- String completeBehind = "new";
- int cursorLocation = str.lastIndexOf("new") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:new>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "new";
- expectedReplacedSource = "new";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:new>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'new' keyword.
- */
-public void test0099(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " new X\n" +
- " }\n" +
- "}";
-
- String completeBehind = "new";
- int cursorLocation = str.lastIndexOf("new") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:new>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "new";
- expectedReplacedSource = "new";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:new>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'new' keyword.
- */
-public void test0100(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " new X()\n" +
- " }\n" +
- "}";
-
- String completeBehind = "new";
- int cursorLocation = str.lastIndexOf("new") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:new>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "new";
- expectedReplacedSource = "new";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:new>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0101(){
- String str =
- "public class X {\n" +
- " void foo() thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0102(){
- String str =
- "public class X {\n" +
- " void foo() thr {\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0103(){
- String str =
- "public class X {\n" +
- " void foo() thr E {\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0104(){
- String str =
- "public class X {\n" +
- " void foo() throws E thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws E {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0105(){
- String str =
- "public class X {\n" +
- " X() thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " X() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0106(){
- String str =
- "public class X {\n" +
- " int foo()[] thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int[] foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'while' keyword.
- */
-public void test0107(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " whi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "whi";
- int cursorLocation = str.lastIndexOf("whi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:whi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "whi";
- expectedReplacedSource = "whi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:whi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'while' keyword.
- */
-public void test0108(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(whi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "whi";
- int cursorLocation = str.lastIndexOf("whi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:whi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "whi";
- expectedReplacedSource = "whi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:whi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'assert' keyword.
- */
-public void test0109(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " ass\n" +
- " }\n" +
- "}";
-
- String completeBehind = "ass";
- int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ass>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ass";
- expectedReplacedSource = "ass";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ass>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'assert' keyword.
- */
-public void test0110(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(ass\n" +
- " }\n" +
- "}";
-
- String completeBehind = "ass";
- int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ass>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ass";
- expectedReplacedSource = "ass";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ass>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0111(){
- String str =
- "fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0112(){
- String str =
- "public fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0113(){
- String str =
- "fin zzz";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0114(){
- String str =
- "final fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0115(){
- String str =
- "abstract fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0116(){
- String str =
- "public fin class X {}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n" +
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0117(){
- String str =
- "public class X {\n" +
- " fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0118(){
- String str =
- "public class X {\n" +
- " public fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0119(){
- String str =
- "public class X {\n" +
- " fin zzz\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0120(){
- String str =
- "public class X {\n" +
- " final fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0121(){
- String str =
- "public class X {\n" +
- " abstract fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0122(){
- String str =
- "public class X {\n" +
- " nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0123(){
- String str =
- "public class X {\n" +
- " public nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0124(){
- String str =
- "public class X {\n" +
- " transient nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0125(){
- String str =
- "public class X {\n" +
- " transient nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0126(){
- String str =
- "public class X {\n" +
- " volatile nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0127(){
- String str =
- "public class X {\n" +
- " str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0128(){
- String str =
- "public class X {\n" +
- " public str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0129(){
- String str =
- "public class X {\n" +
- " transient str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0130(){
- String str =
- "public class X {\n" +
- " transient str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0131(){
- String str =
- "public class X {\n" +
- " volatile str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0132(){
- String str =
- "public class X {\n" +
- " vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0133(){
- String str =
- "public class X {\n" +
- " public vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0134(){
- String str =
- "public class X {\n" +
- " transient vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0135(){
- String str =
- "public class X {\n" +
- " volatile vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0136(){
- String str =
- "public class X {\n" +
- " native vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0137(){
- String str =
- "public class X {\n" +
- " tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0138(){
- String str =
- "public class X {\n" +
- " public tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0139(){
- String str =
- "public class X {\n" +
- " transient tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0140(){
- String str =
- "public class X {\n" +
- " volatile tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0141(){
- String str =
- "public class X {\n" +
- " native tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0142(){
- String str =
- "public class X {\n" +
- " syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0143(){
- String str =
- "public class X {\n" +
- " public syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0144(){
- String str =
- "public class X {\n" +
- " transient syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0145(){
- String str =
- "public class X {\n" +
- " transient syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0146(){
- String str =
- "public class X {\n" +
- " volatile syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0147(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " syn\n" +
- " }\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:syn>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "syn";
- expectedReplacedSource = "syn";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:syn>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0148(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " if(syn\n" +
- " }\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:syn>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "syn";
- expectedReplacedSource = "syn";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:syn>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'static' keyword.
- */
-public void test0149(){
- String str =
- "public class X {\n" +
- " sta\n" +
- "}";
-
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:sta>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "sta";
- String expectedReplacedSource = "sta";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:sta>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'static' keyword.
- */
-public void test0150(){
- String str =
- "public class X {\n" +
- " public sta\n" +
- "}";
-
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:sta>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "sta";
- String expectedReplacedSource = "sta";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:sta>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0151(){
- String str =
- "pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pub>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0152(){
- String str =
- "final pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pub>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0153(){
- String str =
- "public pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0154(){
- String str =
- "private pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pub>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0155(){
- String str =
- "public class X{}\n" +
- "pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0156(){
- String str =
- "public class X{\n" +
- " pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0157(){
- String str =
- "public class X{\n" +
- " public pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0158(){
- String str =
- "public class X{\n" +
- " private pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0159(){
- String str =
- "public class X{\n" +
- " protected pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0160(){
- String str =
- "public class X{\n" +
- " abstract pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0161(){
- String str =
- "pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0162(){
- String str =
- "final pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0163(){
- String str =
- "public pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0164(){
- String str =
- "private pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0165(){
- String str =
- "public class X{}\n" +
- "pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0166(){
- String str =
- "public class X{\n" +
- " pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0167(){
- String str =
- "public class X{\n" +
- " public pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0168(){
- String str =
- "public class X{\n" +
- " private pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0169(){
- String str =
- "public class X{\n" +
- " protected pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0170(){
- String str =
- "public class X{\n" +
- " abstract pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0171(){
- String str =
- "pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0172(){
- String str =
- "final pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0173(){
- String str =
- "public pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0174(){
- String str =
- "private pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0175(){
- String str =
- "public class X{}\n" +
- "pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0176(){
- String str =
- "public class X{\n" +
- " pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0177(){
- String str =
- "public class X{\n" +
- " public pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0178(){
- String str =
- "public class X{\n" +
- " private pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0179(){
- String str =
- "public class X{\n" +
- " protected pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0180(){
- String str =
- "public class X{\n" +
- " abstract pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'super' keyword.
- */
-public void test0181(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " sup\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf("sup") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:sup>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "sup";
- expectedReplacedSource = "sup";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:sup>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'this' keyword.
- */
-public void test0182(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " thi\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf("thi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:thi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "thi";
- expectedReplacedSource = "thi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:thi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'true' keyword.
- */
-public void test0183(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " tru\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "tru";
- int cursorLocation = str.lastIndexOf("tru") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:tru>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "tru";
- expectedReplacedSource = "tru";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:tru>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'false' keyword.
- */
-public void test0184(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " fal\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fal";
- int cursorLocation = str.lastIndexOf("fal") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:fal>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fal";
- expectedReplacedSource = "fal";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fal>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'null' keyword.
- */
-public void test0185(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " nul\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "nul";
- int cursorLocation = str.lastIndexOf("nul") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:nul>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "nul";
- expectedReplacedSource = "nul";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:nul>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'instanceof' keyword.
- */
-public void test0186(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " if(zzz ins\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf("ins") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:ins>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ins";
- expectedReplacedSource = "ins";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:ins>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'instanceof' keyword.
- */
-public void test0187(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " ins\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf("ins") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ins>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ins";
- expectedReplacedSource = "ins";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ins>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'instanceof' keyword.
- */
-public void test0188(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " if(zzz zzz ins\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf("ins") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ins>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ins";
- expectedReplacedSource = "ins";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " zzz zzz;\n" +
- " <CompleteOnName:ins>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'while' keyword.
- */
-public void test0189(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " do{\n" +
- " } whi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "whi";
- int cursorLocation = str.lastIndexOf("whi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:whi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "whi";
- expectedReplacedSource = "whi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:whi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'catch' keyword.
- */
-public void test0190(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " try {\n" +
- " } catch(E e) {\n" +
- " } cat\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf("cat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:cat>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cat";
- expectedReplacedSource = "cat";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cat>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0191(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " try {" +
- " } catch(E e) {" +
- " } fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0192(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " try {" +
- " } finally {" +
- " } fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'this' keyword.
- */
-public void test0193(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " X.thi\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf("thi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:X.thi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "thi";
- expectedReplacedSource = "X.thi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X.thi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/*
- * Test for 'abstract' keyword.
- */
-public void test0194(){
- String str =
- "#\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0195(){
- String str =
- "#\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0196(){
- String str =
- "#\n" +
- "package p;\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0197(){
- String str =
- "#\n" +
- "package p;\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0198(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0199(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0200(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "public abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0201(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "public abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0202(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "abstract abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0203(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "abstract abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0204(){
- String str =
- "#\n" +
- "package p;\n" +
- "import \n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnImport:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnImport:abst>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0205(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "public class X {}\n" +
- "abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0206(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "public class X {}\n" +
- "abst zzz";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n" +
- "import <CompleteOnKeyword:abst>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0207(){
- String str =
- "#\n" +
- "package p;\n" +
- "import yyy;\n" +
- "final abst";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import yyy;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0208(){
- String str =
- "#\n" +
- "package p;\n" +
- "public class X {\n" +
- " abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0209(){
- String str =
- "#\n" +
- "package p;\n" +
- "public class X {\n" +
- " abst zzz\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0210(){
- String str =
- "#\n" +
- "package p;\n" +
- "public class X {\n" +
- " public abst zzz\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0211(){
- String str =
- "#\n" +
- "package p;\n" +
- "public class X {\n" +
- " final abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0212(){
- String str =
- "#\n" +
- "package p;\n" +
- "public class X {\n" +
- " abstract abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0213(){
- String str =
- "#\n" +
- "package p;\n" +
- "public class X {\n" +
- " static abst\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:abst>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "abst";
- String expectedReplacedSource = "abst";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " <CompleteOnType:abst>;\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0214(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " abst\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:abst>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "abst";
- expectedReplacedSource = "abst";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:abst>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'abstract' keyword.
- */
-public void test0216(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " abst zzz\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "abst";
- int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:abst>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "abst";
- expectedReplacedSource = "abst";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:abst>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'break' keyword.
- */
-public void test0217(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " bre\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf("bre") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:bre>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "bre";
- expectedReplacedSource = "bre";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:bre>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'break' keyword.
- */
-public void test0218(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " for(int i; i < 10; i++) {\n" +
- " bre\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf("bre") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:bre>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "bre";
- expectedReplacedSource = "bre";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnName:bre>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'case' keyword.
- */
-public void test0219(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " cas\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf("cas") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:cas>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cas";
- expectedReplacedSource = "cas";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cas>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'case' keyword.
- */
-public void test0220(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " switch(0) {\n" +
- " cas\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf("cas") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:cas>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cas";
- expectedReplacedSource = "cas";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnKeyword:cas>;\n" +
- " }\n"+
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'catch' keyword.
- */
-public void test0221(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " cat\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf("cat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:cat>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cat";
- expectedReplacedSource = "cat";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cat>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'catch' keyword.
- */
-public void test0222(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " try {\n" +
- " } cat\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf("cat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:cat>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cat";
- expectedReplacedSource = "cat";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:cat>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0223(){
- String str =
- "#\n" +
- "cla";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0224(){
- String str =
- "#\n" +
- "public cla";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0225(){
- String str =
- "#\n" +
- "public final cla";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0226(){
- String str =
- "#\n" +
- "public final cla X";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:cla>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0227(){
- String str =
- "#\n" +
- "public class X {\n" +
- " cla\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0228(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public cla\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0229(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public final cla\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0230(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public final cla Y\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:cla>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "cla";
- String expectedReplacedSource = "cla";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:cla>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0231(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " cla\n" +
- " }\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:cla>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cla";
- expectedReplacedSource = "cla";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cla>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0232(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " final cla\n" +
- " }\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:cla>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cla";
- expectedReplacedSource = "cla";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cla>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'class' keyword.
- */
-public void test0233(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " final cla Y\n" +
- " }\n" +
- "}";
-
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:cla>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cla";
- expectedReplacedSource = "cla";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cla>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'continue' keyword.
- */
-public void test0234(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " con\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "con";
- int cursorLocation = str.lastIndexOf("con") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:con>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "con";
- expectedReplacedSource = "con";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:con>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'continue' keyword.
- */
-public void test0235(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " for(int i; i < 5; i++) {\n" +
- " con\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "con";
- int cursorLocation = str.lastIndexOf("con") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:con>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "con";
- expectedReplacedSource = "con";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnName:con>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'default' keyword.
- */
-public void test0236(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " def\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf("def") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:def>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "def";
- expectedReplacedSource = "def";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:def>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'default' keyword.
- */
-public void test0237(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " switch(0) {\n" +
- " case 1 : break;\n" +
- " def\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf("def") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:def>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "def";
- expectedReplacedSource = "def";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:def>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'do' keyword.
- */
-public void test0238(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " do\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf("do") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:do>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "do";
- expectedReplacedSource = "do";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:do>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'else' keyword.
- */
-public void test0239(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " els\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf("els") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:els>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "els";
- expectedReplacedSource = "els";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:els>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'else' keyword.
- */
-public void test0240(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " if(true) {\n" +
- " } els\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf("els") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:els>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "els";
- expectedReplacedSource = "els";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:els>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0241(){
- String str =
- "#\n" +
- "ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0242(){
- String str =
- "#\n" +
- "X ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0243(){
- String str =
- "#\n" +
- "ext Y";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0244(){
- String str =
- "#\n" +
- "class X ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0245(){
- String str =
- "#\n" +
- "class X ext Y";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0246(){
- String str =
- "#\n" +
- "class X ext Y {";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0247(){
- String str =
- "#\n" +
- "class X extends Y ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:ext> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'extends' keyword.
- */
-public void test0248(){
- String str =
- "#\n" +
- "class X implements Y ext";
-
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "ext";
- String expectedReplacedSource = "ext";
- String expectedUnitDisplayString =
- "class X implements Y {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0249(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0250(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " try {" +
- " } fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'for' keyword.
- */
-public void test0251(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " for" +
- " }\n" +
- "}\n";
-
- String completeBehind = "for";
- int cursorLocation = str.lastIndexOf("for") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:for>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "for";
- expectedReplacedSource = "for";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:for>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'if' keyword.
- */
-public void test0252(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " if" +
- " }\n" +
- "}\n";
-
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf("if") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:if>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "if";
- expectedReplacedSource = "if";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:if>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'switch' keyword.
- */
-public void test0253(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " swi" +
- " }\n" +
- "}\n";
-
- String completeBehind = "swi";
- int cursorLocation = str.lastIndexOf("swi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:swi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "swi";
- expectedReplacedSource = "swi";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:swi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0254(){
- String str =
- "#\n" +
- "impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0255(){
- String str =
- "#\n" +
- "X impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0256(){
- String str =
- "#\n" +
- "impl Y";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0257(){
- String str =
- "#\n" +
- "class X impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0258(){
- String str =
- "#\n" +
- "class X impl Y";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0259(){
- String str =
- "#\n" +
- "class X impl Y {";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0260(){
- String str =
- "#\n" +
- "class X extends Y impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnKeyword:impl> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'implements' keyword.
- */
-public void test0261(){
- String str =
- "#\n" +
- "class X implements Y impl";
-
- String completeBehind = "impl";
- int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impl";
- String expectedReplacedSource = "impl";
- String expectedUnitDisplayString =
- "class X implements Y {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0262(){
- String str =
- "#\n" +
- "impo";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0263(){
- String str =
- "#\n" +
- "package p;\n" +
- "impo";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0264(){
- String str =
- "#\n" +
- "package p;\n" +
- "import p2.Y;\n" +
- "impo";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "package p;\n" +
- "import p2.Y;\n" +
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'import' keyword.
- */
-public void test0265(){
- String str =
- "#\n" +
- "impo p2.Y";
-
- String completeBehind = "impo";
- int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "impo";
- String expectedReplacedSource = "impo";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:impo>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0266(){
- String str =
- "#\n" +
- "int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0267(){
- String str =
- "#\n" +
- "public int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0268(){
- String str =
- "#\n" +
- "public abstract int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0269(){
- String str =
- "#\n" +
- "public abstract int X";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:int>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0270(){
- String str =
- "#\n" +
- "public class X {\n" +
- " int\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0271(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public int\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0272(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public abstract int\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0273(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public abstract int Y\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:int>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0274(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " int\n" +
- " }\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:int>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "int";
- expectedReplacedSource = "int";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0275(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " abstract int\n" +
- " }\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:int>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "int";
- expectedReplacedSource = "int";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0276(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " abstract int Y\n" +
- " }\n" +
- "}";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:int>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "int";
- expectedReplacedSource = "int";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:int>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0277(){
- String str =
- "#\n" +
- "public final int";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'interface' keyword.
- */
-public void test0278(){
- String str =
- "#\n" +
- "public final int X";
-
- String completeBehind = "int";
- int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "int";
- String expectedReplacedSource = "int";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0279(){
- String str =
- "#\n" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pac>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0280(){
- String str =
- "#\n" +
- "pac p";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pac>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0281(){
- String str =
- "#\n" +
- "package p;" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "package p;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test282(){
- String str =
- "#\n" +
- "import p;" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "import p;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'package' keyword.
- */
-public void test0283(){
- String str =
- "#\n" +
- "class X {}" +
- "pac";
-
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pac";
- String expectedReplacedSource = "pac";
- String expectedUnitDisplayString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'return' keyword.
- */
-public void test0284(){
- String str =
- "public class X {\n" +
- " int foo() {\n" +
- " #\n" +
- " ret\n" +
- " }\n" +
- "}";
-
- String completeBehind = "ret";
- int cursorLocation = str.lastIndexOf("ret") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:ret>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ret";
- expectedReplacedSource = "ret";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <CompleteOnName:ret>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'throw' keyword.
- */
-public void test0285(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:thr>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "thr";
- expectedReplacedSource = "thr";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:thr>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'try' keyword.
- */
-public void test0286(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " try\n" +
- " }\n" +
- "}";
-
- String completeBehind = "try";
- int cursorLocation = str.lastIndexOf("try") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:try>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "try";
- expectedReplacedSource = "try";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:try>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'try' keyword.
- */
-public void test0287(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(try\n" +
- " }\n" +
- "}";
-
- String completeBehind = "try";
- int cursorLocation = str.lastIndexOf("try") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:try>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "try";
- expectedReplacedSource = "try";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:try>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'do' keyword.
- */
-public void test0288(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(do\n" +
- " }\n" +
- "}";
-
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf("do") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:do>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "do";
- expectedReplacedSource = "do";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:do>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'for' keyword.
- */
-public void test0289(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(for\n" +
- " }\n" +
- "}";
-
- String completeBehind = "for";
- int cursorLocation = str.lastIndexOf("for") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:for>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "for";
- expectedReplacedSource = "for";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:for>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'if' keyword.
- */
-public void test0290(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(if\n" +
- " }\n" +
- "}";
-
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf("if") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:if>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "if";
- expectedReplacedSource = "if";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:if>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'switch' keyword.
- */
-public void test0291(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(swi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "swi";
- int cursorLocation = str.lastIndexOf("swi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:swi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "swi";
- expectedReplacedSource = "swi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:swi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'new' keyword.
- */
-public void test0292(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " new\n" +
- " }\n" +
- "}";
-
- String completeBehind = "new";
- int cursorLocation = str.lastIndexOf("new") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:new>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "new";
- expectedReplacedSource = "new";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:new>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'new' keyword.
- */
-public void test0293(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " new X\n" +
- " }\n" +
- "}";
-
- String completeBehind = "new";
- int cursorLocation = str.lastIndexOf("new") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:new>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "new";
- expectedReplacedSource = "new";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:new>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'new' keyword.
- */
-public void test0294(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " new X()\n" +
- " }\n" +
- "}";
-
- String completeBehind = "new";
- int cursorLocation = str.lastIndexOf("new") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:new>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "new";
- expectedReplacedSource = "new";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:new>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0295(){
- String str =
- "#\n" +
- "public class X {\n" +
- " void foo() thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0296(){
- String str =
- "#\n" +
- "public class X {\n" +
- " void foo() thr {\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0297(){
- String str =
- "#\n" +
- "public class X {\n" +
- " void foo() thr E {\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0298(){
- String str =
- "#\n" +
- "public class X {\n" +
- " void foo() throws E thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() throws E {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0299(){
- String str =
- "#\n" +
- "public class X {\n" +
- " X() thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " X() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'throws' keyword.
- */
-public void test0300(){
- String str =
- "#\n" +
- "public class X {\n" +
- " int foo()[] thr\n" +
- " }\n" +
- "}";
-
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "thr";
- String expectedReplacedSource = "thr";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int[] foo() throws <CompleteOnKeyword:thr> {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'while' keyword.
- */
-public void test0301(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " whi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "whi";
- int cursorLocation = str.lastIndexOf("whi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:whi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "whi";
- expectedReplacedSource = "whi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:whi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'while' keyword.
- */
-public void test0302(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(whi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "whi";
- int cursorLocation = str.lastIndexOf("whi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:whi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "whi";
- expectedReplacedSource = "whi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:whi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'assert' keyword.
- */
-public void test0303(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " ass\n" +
- " }\n" +
- "}";
-
- String completeBehind = "ass";
- int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ass>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ass";
- expectedReplacedSource = "ass";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ass>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'assert' keyword.
- */
-public void test0304(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(ass\n" +
- " }\n" +
- "}";
-
- String completeBehind = "ass";
- int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ass>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ass";
- expectedReplacedSource = "ass";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ass>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0305(){
- String str =
- "#\n" +
- "fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0306(){
- String str =
- "#\n" +
- "public fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0307(){
- String str =
- "#\n" +
- "fin zzz";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0308(){
- String str =
- "#\n" +
- "final fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0309(){
- String str =
- "#\n" +
- "abstract fin";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0310(){
- String str =
- "#\n" +
- "public fin class X {}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:fin>;\n" +
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0311(){
- String str =
- "#\n" +
- "public class X {\n" +
- " fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0312(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0313(){
- String str =
- "#\n" +
- "public class X {\n" +
- " fin zzz\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0314(){
- String str =
- "#\n" +
- "public class X {\n" +
- " final fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'final' keyword.
- */
-public void test0315(){
- String str =
- "#\n" +
- "public class X {\n" +
- " abstract fin\n" +
- "}";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:fin>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "fin";
- String expectedReplacedSource = "fin";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:fin>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0316(){
- String str =
- "#\n" +
- "public class X {\n" +
- " nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0317(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0318(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0319(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'native' keyword.
- */
-public void test0320(){
- String str =
- "#\n" +
- "public class X {\n" +
- " volatile nat\n" +
- "}";
-
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:nat>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "nat";
- String expectedReplacedSource = "nat";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:nat>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0321(){
- String str =
- "#\n" +
- "public class X {\n" +
- " str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0322(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0323(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0324(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'strictfp' keyword.
- */
-public void test0325(){
- String str =
- "#\n" +
- "public class X {\n" +
- " volatile str\n" +
- "}";
-
- String completeBehind = "str";
- int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:str>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "str";
- String expectedReplacedSource = "str";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:str>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0326(){
- String str =
- "#\n" +
- "public class X {\n" +
- " vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0327(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0328(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0329(){
- String str =
- "#\n" +
- "public class X {\n" +
- " volatile vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'volatile' keyword.
- */
-public void test0330(){
- String str =
- "#\n" +
- "public class X {\n" +
- " native vol\n" +
- "}";
-
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:vol>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "vol";
- String expectedReplacedSource = "vol";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:vol>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0331(){
- String str =
- "#\n" +
- "public class X {\n" +
- " tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0332(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0333(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0334(){
- String str =
- "#\n" +
- "public class X {\n" +
- " volatile tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'transient' keyword.
- */
-public void test0335(){
- String str =
- "#\n" +
- "public class X {\n" +
- " native tra\n" +
- "}";
-
- String completeBehind = "tra";
- int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:tra>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "tra";
- String expectedReplacedSource = "tra";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:tra>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0336(){
- String str =
- "#\n" +
- "public class X {\n" +
- " syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0337(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0338(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0339(){
- String str =
- "#\n" +
- "public class X {\n" +
- " transient syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0340(){
- String str =
- "#\n" +
- "public class X {\n" +
- " volatile syn\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:syn>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "syn";
- String expectedReplacedSource = "syn";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:syn>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0341(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " syn\n" +
- " }\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:syn>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "syn";
- expectedReplacedSource = "syn";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:syn>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'synchronized' keyword.
- */
-public void test0342(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " if(syn\n" +
- " }\n" +
- "}";
-
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:syn>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "syn";
- expectedReplacedSource = "syn";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:syn>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'static' keyword.
- */
-public void test0343(){
- String str =
- "#\n" +
- "public class X {\n" +
- " sta\n" +
- "}";
-
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:sta>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "sta";
- String expectedReplacedSource = "sta";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:sta>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'static' keyword.
- */
-public void test0344(){
- String str =
- "#\n" +
- "public class X {\n" +
- " public sta\n" +
- "}";
-
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:sta>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "sta";
- String expectedReplacedSource = "sta";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:sta>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0345(){
- String str =
- "#\n" +
- "pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pub>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0346(){
- String str =
- "#\n" +
- "final pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pub>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0347(){
- String str =
- "#\n" +
- "public pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0348(){
- String str =
- "#\n" +
- "private pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "import <CompleteOnKeyword:pub>;\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0349(){
- String str =
- "#\n" +
- "public class X{}\n" +
- "pub";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0350(){
- String str =
- "#\n" +
- "public class X{\n" +
- " pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0351(){
- String str =
- "#\n" +
- "public class X{\n" +
- " public pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0352(){
- String str =
- "#\n" +
- "public class X{\n" +
- " private pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0353(){
- String str =
- "#\n" +
- "public class X{\n" +
- " protected pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'public' keyword.
- */
-public void test0354(){
- String str =
- "#\n" +
- "public class X{\n" +
- " abstract pub\n" +
- "}";
-
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pub>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pub";
- String expectedReplacedSource = "pub";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pub>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0355(){
- String str =
- "#\n" +
- "pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0356(){
- String str =
- "#\n" +
- "final pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0357(){
- String str =
- "#\n" +
- "public pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0358(){
- String str =
- "#\n" +
- "private pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0359(){
- String str =
- "#\n" +
- "public class X{}\n" +
- "pro";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0360(){
- String str =
- "#\n" +
- "public class X{\n" +
- " pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0361(){
- String str =
- "#\n" +
- "public class X{\n" +
- " public pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0362(){
- String str =
- "#\n" +
- "public class X{\n" +
- " private pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0363(){
- String str =
- "#\n" +
- "public class X{\n" +
- " protected pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'protected' keyword.
- */
-public void test0364(){
- String str =
- "#\n" +
- "public class X{\n" +
- " abstract pro\n" +
- "}";
-
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pro>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pro";
- String expectedReplacedSource = "pro";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pro>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0365(){
- String str =
- "#\n" +
- "pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0366(){
- String str =
- "#\n" +
- "final pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0367(){
- String str =
- "#\n" +
- "public pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0368(){
- String str =
- "#\n" +
- "private pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0369(){
- String str =
- "#\n" +
- "public class X{}\n" +
- "pri";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0370(){
- String str =
- "#\n" +
- "public class X{\n" +
- " pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0371(){
- String str =
- "#\n" +
- "public class X{\n" +
- " public pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0372(){
- String str =
- "#\n" +
- "public class X{\n" +
- " private pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0373(){
- String str =
- "#\n" +
- "public class X{\n" +
- " protected pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'private' keyword.
- */
-public void test0374(){
- String str =
- "#\n" +
- "public class X{\n" +
- " abstract pri\n" +
- "}";
-
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<CompleteOnType:pri>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "pri";
- String expectedReplacedSource = "pri";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <CompleteOnType:pri>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-}
-/*
- * Test for 'super' keyword.
- */
-public void test0375(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " sup\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf("sup") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:sup>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "sup";
- expectedReplacedSource = "sup";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:sup>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'this' keyword.
- */
-public void test0376(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " thi\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf("thi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:thi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "thi";
- expectedReplacedSource = "thi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:thi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'true' keyword.
- */
-public void test0377(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " tru\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "tru";
- int cursorLocation = str.lastIndexOf("tru") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:tru>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "tru";
- expectedReplacedSource = "tru";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:tru>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'false' keyword.
- */
-public void test0378(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " fal\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fal";
- int cursorLocation = str.lastIndexOf("fal") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:fal>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fal";
- expectedReplacedSource = "fal";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fal>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'null' keyword.
- */
-public void test0379(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " nul\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "nul";
- int cursorLocation = str.lastIndexOf("nul") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:nul>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "nul";
- expectedReplacedSource = "nul";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:nul>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'instanceof' keyword.
- */
-public void test0380(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " if(zzz ins\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf("ins") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:ins>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ins";
- expectedReplacedSource = "ins";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:ins>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'instanceof' keyword.
- */
-public void test0381(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " ins\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf("ins") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ins>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ins";
- expectedReplacedSource = "ins";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:ins>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'instanceof' keyword.
- */
-public void test0382(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " if(zzz zzz ins\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf("ins") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:ins>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "ins";
- expectedReplacedSource = "ins";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " zzz zzz;\n" +
- " <CompleteOnName:ins>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'while' keyword.
- */
-public void test0384(){
- String str =
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " do{\n" +
- " } whi\n" +
- " }\n" +
- "}";
-
- String completeBehind = "whi";
- int cursorLocation = str.lastIndexOf("whi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnKeyword:whi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "whi";
- expectedReplacedSource = "whi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnKeyword:whi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'catch' keyword.
- */
-public void test0385(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " try {\n" +
- " } catch(E e) {\n" +
- " } cat\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf("cat") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:cat>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "cat";
- expectedReplacedSource = "cat";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:cat>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0386(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " try {" +
- " } catch(E e) {" +
- " } fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'finally' keyword.
- */
-public void test0387(){
- String str =
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " try {" +
- " } finally {" +
- " } fin" +
- " }\n" +
- "}\n";
-
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- String expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "diet ast");
-
- expectedCompletionNodeToString = "<CompleteOnName:fin>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "fin";
- expectedReplacedSource = "fin";
- expectedUnitDisplayString =
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:fin>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-/*
- * Test for 'this' keyword.
- */
-public void test0388(){
- String str =
- "public class X {\n" +
- " void foo(){\n" +
- " #\n" +
- " X.thi\n" +
- " }\n" +
- "}\n";
-
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf("thi") + completeBehind.length() - 1;
-
- String expectedCompletionNodeToString = "<NONE>";
- String expectedParentNodeToString = "<NONE>";
- String completionIdentifier = "<NONE>";
- String expectedReplacedSource = "<NONE>";
- 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");
-
- expectedCompletionNodeToString = "<CompleteOnName:X.thi>";
- expectedParentNodeToString = "<NONE>";
- completionIdentifier = "thi";
- expectedReplacedSource = "X.thi";
- expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X.thi>;\n" +
- " }\n" +
- "}\n";
-
- checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedParentNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- "full ast");
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java
deleted file mode 100644
index 96ebda8..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java
+++ /dev/null
@@ -1,1026 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class CompletionRecoveryTest extends AbstractCompletionTest {
-public CompletionRecoveryTest(String testName){
- super(testName);
-}
-/*
- * Complete on variable behind ill-formed declaration
- */
-public void test01() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo(){ \n" +
- " String str = ; \n" +
- " str. \n";
-
- String completeBehind = "str.";
- String expectedCompletionNodeToString = "<CompleteOnName:str.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " String str;\n" +
- " <CompleteOnName:str.>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str.";
- String testName = "<complete on variable behind ill-formed declaration>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable behind ill-formed declaration and nested block
- */
-public void test02() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo(){ \n" +
- " String str = ; \n" +
- " { \n" +
- " int i; \n" +
- " str. \n";
-
- String completeBehind = "str.";
- String expectedCompletionNodeToString = "<CompleteOnName:str.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " String str;\n" +
- " {\n" +
- " int i;\n" +
- " <CompleteOnName:str.>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str.";
- String testName = "<complete on variable behind ill-formed declaration and nested block>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable behind ill-formed declaration and inside local type field initialization
- */
-public void test03() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo(){ \n" +
- " final String str = ; \n" +
- " class L { \n" +
- " int i = str \n";
-
- String completeBehind = "i = str";
- String expectedCompletionNodeToString = "<CompleteOnName:str>";
- String completionIdentifier = "str";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " final String str;\n" +
- " class L {\n" +
- " int i = <CompleteOnName:str>;\n" +
- " L() {\n" +
- " super();\n" + // could be optimized out
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str";
- String testName = "<complete on variable behind ill-formed declaration and inside local type field initialization>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable behind closed scope
- */
-public void test04() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends \n" +
- " int foo(String str) \n" +
- " String variable = ; \n" +
- " { \n" +
- " String variableNotInScope; \n" +
- " } \n" +
- " foo(varia \n";
-
- String completeBehind = "foo(var";
- String expectedCompletionNodeToString = "<CompleteOnName:var>";
- String completionIdentifier = "var";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " String variable;\n" +
- " foo(<CompleteOnName:var>);\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "varia";
- String testName = "<complete on variable behind closed scope>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable str with sibling method stringAppend()
- */
-public void test05() {
-
- String str =
- "import java.io.*; \n"+
- " \n"+
- "public class X extends \n"+
- " int foo(String str) \n"+
- " String str = ; \n"+
- " { \n"+
- " String strNotInScope; \n"+
- " } \n"+
- " class L { \n"+
- " int bar(){ \n"+
- " foo(str \n"+
- " void stringAppend(String s1, String s2) \n";
-
- String completeBehind = "foo(str";
- String expectedCompletionNodeToString = "<CompleteOnName:str>";
- String completionIdentifier = "str";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " String str;\n" +
- " class L {\n" +
- " L() {\n" +
- " }\n" +
- " int bar() {\n" +
- " foo(<CompleteOnName:str>);\n" +
- " }\n" +
- " void stringAppend(String s1, String s2) {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str";
- String testName = "<complete on variable str with sibling method stringAppend()>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable str with sibling method stringAppend(), eliminating
- * uninteresting method bodies
- */
-public void test06() {
-
- String str =
- "import java.io.*; \n"+
- " \n"+
- "public class X extends \n"+
- " int foo(String str) \n"+
- " String str = ; \n"+
- " { \n"+
- " String strNotInScope; \n"+
- " } \n"+
- " class L { \n"+
- " int notInterestingBody(){ \n"+
- " System.out.println(); \n"+
- " } \n"+
- " int bar(){ \n"+
- " foo(str \n"+
- " void stringAppend(String s1, String s2) \n";
-
- String completeBehind = "foo(str";
- String expectedCompletionNodeToString = "<CompleteOnName:str>";
- String completionIdentifier = "str";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " String str;\n" +
- " class L {\n" +
- " L() {\n" +
- " }\n" +
- " int notInterestingBody() {\n" +
- " }\n" +
- " int bar() {\n" +
- " foo(<CompleteOnName:str>);\n" +
- " }\n" +
- " void stringAppend(String s1, String s2) {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "str";
- String testName = "<complete on variable eliminating other uninteresting method bodies>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on new keyword
- */
-public void test07(){
-
- String str =
- "import java.io.* \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo() { \n" +
- " X x = new X( \n" +
- "} \n";
-
- String completeBehind = "= n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " X x = <CompleteOnName:n>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new";
- String testName = "<complete on new keyword>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on field type in anonymous type.
- */
-public void test08() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "package test;\n" +
- "import java.util.Vector;\n" +
- "public class VA {\n" +
- " Object o1 = new Object() {\n" +
- " V\n" +
- " void foo2() {\n" +
- " int i = 1;\n" +
- " }\n" +
- " };\n" +
- " String s2;\n" +
- " void bar() {\n" +
- " }\n" +
- " void foo() { \n" +
- " new String[] {}..equals()\n" +
- " }\n" +
- "}\n",
- // completeBehind:
- " V",
- // expectedCompletionNodeToString:
- "<CompleteOnType:V>",
- // expectedUnitDisplayString:
- "package test;\n" +
- "import java.util.Vector;\n" +
- "public class VA {\n" +
- " Object o1 = new Object() {\n" +
- " <CompleteOnType:V>;\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- " void foo2() {\n" +
- " }\n" +
- " };\n" +
- " String s2;\n" +
- " public VA() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "V",
- // expectedReplacedSource:
- "V",
- // test name
- "<completion on field type in anonymous type>"
- );
-}
-/*
- * Complete on argument name
- */
-public void test09() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n",
- // completeBehind:
- "argv",
- // expectedCompletionNodeToString:
- "<CompleteOnArgumentName:String[] argv>",
- // expectedUnitDisplayString:
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "argv",
- // expectedReplacedSource:
- "argv",
- // test name
- "<completion on argument name>"
- );
-}
-/*
- * Complete on argument name
- */
-public void test10() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n",
- // completeBehind:
- "argv",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<completion on argument name>"
- );
-}
-/*
- * Complete inside method with incomplete signature
- */
-public void test11() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n",
- // completeBehind:
- "new Member().f",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:new Member().f>",
- // expectedUnitDisplayString:
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " <CompleteOnMemberAccess:new Member().f>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "f",
- // expectedReplacedSource:
- "f",
- // test name
- "<complete inside method with incomplete signature>"
- );
-}
-/*
- * Complete on argument name with class decl later on
- */
-public void test12() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class DD { \n"+
- " public static void main(String[] argv \n"+
- " \n"+
- "class D { \n"+
- " \n"+
- " int i; \n"+
- " class Mem1 {} \n"+
- " int dumb(String s) \n"+
- " int dumb(float fNum, double dNum) { \n"+
- " dumb(\"world\", i); \n"+
- " \n"+
- " if (i == 0) { \n"+
- " class Local { \n"+
- " \n"+
- " int hello() \n",
- // completeBehind:
- "argv",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class DD {\n" +
- " DD() {\n" +
- " }\n" +
- " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on argument name with class decl later on>"
- );
-}
-/*
- * Complete behind array type
- */
-public void test13() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class C { \n"+
- " void test() { \n"+
- " String[]. \n"+
- " } \n"+
- "} \n",
- // completeBehind:
- "String[].",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:String[].>",
- // expectedUnitDisplayString:
- "class C {\n" +
- " C() {\n" +
- " }\n" +
- " void test() {\n" +
- " <CompleteOnClassLiteralAccess:String[].>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "String[].",
- // test name
- "<complete behind array type>"
- );
-}
-/*
- * Complete inside array type
- */
-public void test14() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class B { \n"+
- " class Member {} \n"+
- " \n"+
- " int[] j; \n",
- // completeBehind:
- "int[",
- // expectedCompletionNodeToString:
- NONE,
- // expectedUnitDisplayString:
- "public class B {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " }\n" +
- " public B() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- NONE,
- // test name
- "<complete inside array type>"
- );
-}
-/*
- * Complete inside array type
- */
-public void test15() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class B { \n"+
- " class Member {} \n"+
- " \n"+
- " int[ \n",
- // completeBehind:
- "int[",
- // expectedCompletionNodeToString:
- NONE,
- // expectedUnitDisplayString:
- "public class B {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " }\n" +
- " public B() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- NONE,
- // test name
- "<complete inside array type>"
- );
-}
-/*
- * Complete behind invalid array type
- */
-public void test16() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class B { \n"+
- " class Member {} \n"+
- " \n"+
- " int[ \n"+
- " Obje \n",
- // completeBehind:
- "Obje",
- // expectedCompletionNodeToString:
- "<CompleteOnType:Obje>",
- // expectedUnitDisplayString:
- "public class B {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " }\n" +
- " <CompleteOnType:Obje>;\n" +
- " public B() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "Obje",
- // expectedReplacedSource:
- "Obje",
- // test name
- "<complete behind invalid array type>"
- );
-}
-/*
- * Complete behind invalid base type
- */
-public void test17() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class D { \n" +
- " class Member {} \n" +
- " \n" +
- " void test() { \n" +
- " int. \n" +
- " test(); \n" +
- " } \n",
- // completeBehind:
- "int.",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int.>",
- // expectedUnitDisplayString:
- "class D {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " }\n" +
- " D() {\n" +
- " }\n" +
- " void test() {\n" +
- " <CompleteOnClassLiteralAccess:int.>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "int.",
- // test name
- "<complete behind invalid base type>"
- );
-}
-/*
- * Complete behind incomplete local method header
- */
-public void test18() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class E { \n"+
- " int bar() { \n"+
- " class Local { \n"+
- " int hello() { \n",
- // completeBehind:
- "hello()",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class E {\n" +
- " E() {\n" +
- " }\n" +
- " int bar() {\n" +
- " class Local {\n" +
- " Local() {\n" +
- " }\n" +
- " int hello() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete behind incomplete local method header>"
- );
-}
-/*
- * Complete behind catch variable
- */
-public void test19() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Test { \n" +
- " void foo() { \n" +
- " try { \n" +
- " } catch (Exception e) { \n" +
- " } \n" +
- " e \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "\n\t\te",
- // expectedCompletionNodeToString:
- "<CompleteOnName:e>",
- // expectedUnitDisplayString:
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "e",
- // expectedReplacedSource:
- "e",
- // test name
- "<complete behind catch variable>"
- );
-}
-/*
- * Complete on catch variable
- */
-public void test20() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Test { \n" +
- " void foo() { \n" +
- " try { \n" +
- " } catch (Exception e) { \n" +
- " e \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "\n\t\t\te",
- // expectedCompletionNodeToString:
- "<CompleteOnName:e>",
- // expectedUnitDisplayString:
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " Exception e;\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "e",
- // expectedReplacedSource:
- "e",
- // test name
- "<complete on catch variable>"
- );
-}
-/*
- * Complete on catch variable after syntax error
- */
-public void test21() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Test { \n" +
- " void foo() { \n" +
- " try { \n" +
- " bar \n" +
- " } catch (Exception e) { \n" +
- " e \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "\n\t\t\te",
- // expectedCompletionNodeToString:
- "<CompleteOnName:e>",
- // expectedUnitDisplayString:
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " Exception e;\n" +
- " <CompleteOnName:e>;\n" +
- " }\n" +
- " }\n" +
- "}\n"
- ,
- // expectedCompletionIdentifier:
- "e",
- // expectedReplacedSource:
- "e",
- // test name
- "<complete on catch variable after syntax error>"
- );
-}
-/*
- * Complete on constructor type name
- * 1G1HF7P: ITPCOM:WIN98 - CodeAssist may not work in constructor signature
- */
-public void test22() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class SomeType {\n" +
- " public SomeType(int i){}\n" +
- "}\n" +
- "\n" +
- "class SomeOtherType extends SomeType {\n" +
- " SomeOtherType(int i){\n" +
- " super(i);\n" +
- " }\n" +
- "}\n",
- // completeBehind:
- " SomeOther",
- // expectedCompletionNodeToString:
- "<CompleteOnType:SomeOther>",
- // expectedUnitDisplayString:
- "public class SomeType {\n" +
- " public SomeType(int i) {\n" +
- " }\n" +
- "}\n" +
- "class SomeOtherType extends SomeType {\n" +
- " <CompleteOnType:SomeOther>;\n" +
- " int i;\n" +
- " {\n" +
- " }\n" +
- " SomeOtherType() {\n" +
- " }\n" +
- "}\n"
- ,
- // expectedCompletionIdentifier:
- "SomeOther",
- // expectedReplacedSource:
- "SomeOtherType",
- // test name
- "<complete on constructor type name>"
- );
-}
-/**
- * Complete in initializer in recovery mode
- */
-public void test23() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package p;\n" +
- "public class X {\n" +
- " void foo(){)\n" +
- " {\n" +
- " Obj\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // completeBehind:
- "Obj",
- // expectedCompletionNodeToString:
- "<CompleteOnName:Obj>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:Obj>;\n" +
- " }\n" +
- " }\n" +
- "}\n"
- ,
- // expectedCompletionIdentifier:
- "Obj",
- // expectedReplacedSource:
- "Obj",
- // test name
- "<complete in initializer>"
- );
-}
-/**
- * Complete after initializer in recovery mode
- */
-public void test24() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package p;\n" +
- "public class X {\n" +
- " void foo(){)\n" +
- " int v1;\n" +
- " {\n" +
- " int v2\n" +
- " }\n" +
- " Obj" +
- " }\n" +
- "}\n",
- // completeBehind:
- "Obj",
- // expectedCompletionNodeToString:
- "<CompleteOnName:Obj>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int v1;\n" +
- " <CompleteOnName:Obj>;\n" +
- " }\n" +
- "}\n"
- ,
- // expectedCompletionIdentifier:
- "Obj",
- // expectedReplacedSource:
- "Obj",
- // test name
- "<complete after initializer>"
- );
-}
-/**
- * Complete after dot, before a number .<|>12
- */
-public void test25() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package p;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " this.12\n" +
- " }\n" +
- "}\n",
- // completeBehind:
- "this.",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:this.>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:this.>;\n" +
- " }\n" +
- "}\n"
- ,
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "this.",
- // test name
- "<complete after dot number>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java
deleted file mode 100644
index 338304b..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java
+++ /dev/null
@@ -1,1940 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import org.eclipse.jdt.internal.codeassist.complete.InvalidCursorLocation;
-
-public class DietCompletionTest extends AbstractCompletionTest {
-public DietCompletionTest(String testName){
- super(testName);
-}
-/*
- * Complete on superclass
- */
-public void test01() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnClass:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnClass:IOEx> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOException";
- String testName = "<complete on superclass>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on superinterface
- */
-public void test02() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException implements Serializable { \n" +
- " int foo(){} \n" +
- "} \n";
-
- String completeBehind = "Seria";
- String expectedCompletionNodeToString = "<CompleteOnInterface:Seria>";
- String completionIdentifier = "Seria";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException implements <CompleteOnInterface:Seria> {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "Serializable";
- String testName = "<complete on superinterface>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on qualified superclass
- */
-public void test03() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends java.io.IOException { \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnClass:java.io.IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnClass:java.io.IOEx> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOException";
- String testName = "<complete on qualified superclass>";
-
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-
-}
-/*
- * Complete on qualified superinterface
- */
-public void test04() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException implements java.io.Serializable { \n" +
- "} \n";
-
- String completeBehind = "Seria";
- String expectedCompletionNodeToString = "<CompleteOnInterface:java.io.Seria>";
- String completionIdentifier = "Seria";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException implements <CompleteOnInterface:java.io.Seria> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.Serializable";
- String testName = "<complete on qualified superinterface>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on incomplete superclass
- */
-public void test05() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOEx { \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnClass:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnClass:IOEx> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete on incomplete superclass>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on incomplete superinterface
- */
-public void test06() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException implements Seria { \n" +
- "} \n";
-
- String completeBehind = "Seria";
- String expectedCompletionNodeToString = "<CompleteOnInterface:Seria>";
- String completionIdentifier = "Seria";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException implements <CompleteOnInterface:Seria> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "Seria";
- String testName = "<complete on incomplete superinterface>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on incomplete qualified superclass
- */
-public void test07() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends java.io.IOEx { \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnClass:java.io.IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString = "import java.io.*;\n" +
- "public class X extends <CompleteOnClass:java.io.IOEx> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOEx";
- String testName = "<complete on incomplete qualified superclass>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on incomplete qualified superinterface
- */
-public void test08() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException implements java.io.Seria { \n" +
- "} \n";
-
- String completeBehind = "Seria";
- String expectedCompletionNodeToString = "<CompleteOnInterface:java.io.Seria>";
- String completionIdentifier = "Seria";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException implements <CompleteOnInterface:java.io.Seria> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.Seria";
- String testName = "<complete on incomplete qualified superinterface>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete inside qualified superclass
- */
-public void test09() {
-
- String str =
- " \n" +
- "public class X extends java.io.IOException { \n" +
- "} \n";
-
- String completeBehind = ".io";
- String expectedCompletionNodeToString = "<CompleteOnClass:java.io>";
- String completionIdentifier = "io";
- String expectedUnitDisplayString =
- "public class X extends <CompleteOnClass:java.io> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOException";
- String testName = "<complete inside qualified superclass>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete inside qualified superinterface
- */
-public void test10() {
-
- String str =
- "public class X extends IOException implements java.io.Serializable { \n" +
- "} \n";
-
- String completeBehind = ".io";
- String expectedCompletionNodeToString = "<CompleteOnInterface:java.io>";
- String completionIdentifier = "io";
- String expectedUnitDisplayString =
- "public class X extends IOException implements <CompleteOnInterface:java.io> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.Serializable";
- String testName = "<complete inside qualified superinterface>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete inside qualified superclass ending with dot
- */
-public void test11() {
-
- String str =
- " \n" +
- "public class X extends java.io. { \n" +
- "} \n";
-
- String completeBehind = ".io.";
- String expectedCompletionNodeToString = "<CompleteOnClass:java.io.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "public class X extends <CompleteOnClass:java.io.> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.";
- String testName = "<complete inside qualified superclass ending with dot>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete inside qualified superinterface ending with dot
- */
-public void test12() {
-
- String str =
- "public class X extends IOException implements java.io. { \n" +
- "} \n";
-
- String completeBehind = ".io.";
- String expectedCompletionNodeToString = "<CompleteOnInterface:java.io.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "public class X extends IOException implements <CompleteOnInterface:java.io.> {\n" +
- " public X() {\n" +
-
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.";
- String testName = "<complete inside qualified superinterface ending with dot>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on empty superclass
- */
-public void test13() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends { \n" +
- "} \n";
-
- String completeBehind = "extends ";
- String expectedCompletionNodeToString = "<CompleteOnClass:>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnClass:> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "";
- String testName = "<complete on empty superclass>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on empty superinterface
- */
-public void test14() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException implements { \n" +
- "} \n";
-
- String completeBehind = "implements ";
- String expectedCompletionNodeToString = "<CompleteOnInterface:>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException implements <CompleteOnInterface:> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "";
- String testName = "<complete on empty superinterface>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on empty superclass followed by identifier
- */
-public void test15() {
-
- String str =
- "public class X extends java.io. IOException { \n" +
- "} \n";
-
- String completeBehind = "java.io.";
- String expectedCompletionNodeToString = "<CompleteOnClass:java.io.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "public class X extends <CompleteOnClass:java.io.> {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.";
- String testName = "<complete on empty superclass followed by identifier>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on keyword extends
- */
-public void test16() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends { \n" +
- "} \n";
-
- String completeBehind = "extends";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:extends>";
- String completionIdentifier = "extends";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnKeyword:extends> {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "extends";
- String testName = "<complete on keyword extends>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in keyword extends
- */
-public void test17() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X ext { \n" +
- "} \n";
-
- String completeBehind = "ext";
- String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>";
- String completionIdentifier = "ext";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnKeyword:ext> {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "ext";
- String testName = "<complete in keyword extends>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in field type
- */
-public void test18() {
-
- String str =
- "class X { \n" +
- " \n" +
- " IOException x; \n" +
- "} \n";
-
- String completeBehind = "IO";
- String expectedCompletionNodeToString = "<CompleteOnType:IO>";
- String completionIdentifier = "IO";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IO>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOException";
- String testName = "<complete in field type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete at beginning of field type
- */
-public void test19() {
-
- String str =
- "class X { \n" +
- " \n" +
- " final IOException x; \n" +
- "} \n";
-
- String completeBehind = "final ";
- String expectedCompletionNodeToString = "<CompleteOnType:>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOException";
- String testName = "<complete at beginning of field type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete at beginning of superclass
- */
-public void test20() {
-
- String str =
- "class X extends IOException { \n" +
- " \n" +
- "} \n";
-
- String completeBehind = "extends ";
- String expectedCompletionNodeToString = "<CompleteOnClass:>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "class X extends <CompleteOnClass:> {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOException";
- String testName = "<complete at beginning of superclass>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in return type
- */
-public void test21() {
-
- String str =
- "class X { \n" +
- " IOEx \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in return type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in argument type
- */
-public void test22() {
-
- String str =
- "class X { \n" +
- " int foo(IOEx \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in argument type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in return type
- */
-public void test23() {
-
- String str =
- "class X { \n" +
- " IOEx \n" +
- " \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in return type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in argument type (no closing brace for type)
- */
-public void test24() {
-
- String str =
- "class X { \n" +
- " int foo(IOEx \n" +
- " \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
-
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in argument type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in return type with modifiers
- */
-public void test25() {
-
- String str =
- "class X { \n" +
- " public final IOEx \n" +
- " \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in return type with modifiers>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in field initialization
- */
-public void test26() {
-
- String str =
- "class X { \n" +
- " public final int x = IOEx \n" +
- " \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnName:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " public final int x = <CompleteOnName:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in field initialization>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in nth argument type
- */
-public void test27() {
-
- String str =
- "class X { \n" +
- " int foo(AA a, BB b, IOEx \n" +
- " \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- " int foo(AA a, BB b) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in nth argument type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in nth argument qualified type
- */
-public void test28() {
-
- String str =
- "class X { \n" +
- " int foo(AA a, BB b, java.io.IOEx \n" +
- " \n";
-
- String completeBehind = ".io.";
- String expectedCompletionNodeToString = "<CompleteOnType:java.io.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <CompleteOnType:java.io.>;\n" +
- " X() {\n" +
- " }\n" +
- " int foo(AA a, BB b) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOEx";
- String testName = "<complete in nth argument qualified type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in nth thrown exception qualified type
- */
-public void test29() {
-
- String str =
- "class X { \n" +
- " public int foo(AA a, BB b) throws AA, java.io.IOEx \n" +
- " \n";
-
- String completeBehind = ".io";
- String expectedCompletionNodeToString = "<CompleteOnException:java.io>";
- String completionIdentifier = "io";
- String expectedUnitDisplayString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " public int foo(AA a, BB b) throws AA, <CompleteOnException:java.io> {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOEx";
- String testName = "<complete in nth thrown exception qualified type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in completed argument
- */
-public void test30() {
-
- String str =
- "class X { \n" +
- " public int foo(AA a, java.io.BB b) \n" +
- " \n";
-
- String completeBehind = "io.";
- String expectedCompletionNodeToString = "<CompleteOnType:java.io.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " public int foo(AA a, <CompleteOnType:java.io.> b) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.BB";
- String testName = "<complete in in completed argument>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Negative test: no diet completion in allocation expression
- */
-public void test31() {
-
- String str =
- "class Bar { \n"+
- " void foo() { \n"+
- " new X().zzz(); \n"+
- " } \n"+
- "}\n";
-
- String completeBehind = "new X";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = NONE;
- String expectedUnitDisplayString =
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = null;
- String testName = "<no diet completion in allocation expression>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Completion in package statement
- */
-public void test32() {
-
- String str =
- "package x.abc \n"+
- "import x.util.*; \n"+
- "import x.*; \n"+
- "class X extends util{ \n"+
- " X(){} \n"+
- " X(int a, int b){} \n"+
- "} \n";
-
- String completeBehind = "x.ab";
- String expectedCompletionNodeToString = "<CompleteOnPackage:x.ab>";
- String completionIdentifier = "ab";
- String expectedUnitDisplayString =
- "package <CompleteOnPackage:x.ab>;\n" +
- "import x.util.*;\n" +
- "import x.*;\n" +
- "class X extends util {\n" +
- " X() {\n" +
- " }\n" +
- " X(int a, int b) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "x.abc";
- String testName = "<complete in package statement>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Completion in import statement
- */
-public void test33() {
-
- String str =
- "package x.abc; \n"+
- "import x.util \n"+
- "import x.*; \n"+
- "class X extends util{ \n"+
- " X(){} \n"+
- " X(int a, int b){} \n"+
- "} \n";
-
- String completeBehind = "x.util";
- String expectedCompletionNodeToString = "<CompleteOnImport:x.util>";
- String completionIdentifier = "util";
- String expectedUnitDisplayString =
- "package x.abc;\n" +
- "import <CompleteOnImport:x.util>;\n" +
- "import x.*;\n" +
- "class X extends util {\n" +
- " X() {\n" +
- " }\n" +
- " X(int a, int b) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "x.util";
- String testName = "<complete in import statement>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on superclass behind a unicode
- *
- * -- compute the unicode representation for a given string --
- [ String str = "IOEx";
- StringBuffer buffer = new StringBuffer("\"");
- for (int i = 0; i < str.length(); i++){
- String hex = Integer.toHexString(str.charAt(i));
- buffer.append("\\u0000".substring(0, 6-hex.length()));
- buffer.append(hex);
- }
- buffer.append("\"");
- buffer.toString()
- ]
- */
-public void test34() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOE\\u0078ception { \n" +
- "} \n";
-
- String completeBehind = "IOE\\u0078";
- String expectedCompletionNodeToString = "<CompleteOnClass:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <CompleteOnClass:IOEx> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOE\\u0078ception";
- String testName = "<complete on superclass behind a unicode>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Invalid completion inside a unicode
- *
- * -- compute the unicode representation for a given string --
- [ String str = "IOEx";
- StringBuffer buffer = new StringBuffer("\"");
- for (int i = 0; i < str.length(); i++){
- String hex = Integer.toHexString(str.charAt(i));
- buffer.append("\\u0000".substring(0, 6-hex.length()));
- buffer.append(hex);
- }
- buffer.append("\"");
- buffer.toString()
- ]
- */
-public void test35() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOE\\u0078ception { \n" +
- "} \n";
-
- String completeBehind = "IOE\\u00";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = NONE;
- String expectedUnitDisplayString = "";
- String expectedReplacedSource = NONE;
- String testName = "<complete inside unicode>";
-
- try {
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_UNICODE);
- }
-}
-/*
- * Invalid completion inside a comment
- *
- */
-public void test36() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends /*IOException*/ { \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = NONE;
- String expectedUnitDisplayString = "";
- String expectedReplacedSource = NONE;
- String testName = "<complete inside comment>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- try {
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT);
- }
-}
-/*
- * Invalid completion inside a string literal
- *
- */
-public void test37() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X { \n" +
- " String s = \"IOException\"; \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = NONE;
- String expectedUnitDisplayString = "";
- String expectedReplacedSource = NONE;
- String testName = "<complete inside a string literal>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- try{
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_STRING);
- }
-}
-/*
- * Invalid completion inside a number literal
- *
- */
-public void test38() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X { \n" +
- " int s = 12345678; \n" +
- "} \n";
-
- String completeBehind = "1234";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = NONE;
- String expectedUnitDisplayString = "";
- String expectedReplacedSource = NONE;
- String testName = "<complete inside a number literal>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- try{
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- assertTrue("failed to detect invalid cursor location", false);
- } catch(InvalidCursorLocation e){
- assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER);
- }
-}
-/*
- * Completion in import statement at the end of the unit
- */
-public void test39() {
-
- String str =
- "package x.abc; \n"+
- "import x.util";
-
- String completeBehind = "x.util";
- String expectedCompletionNodeToString = "<CompleteOnImport:x.util>";
- String completionIdentifier = "util";
- String expectedUnitDisplayString =
- "package x.abc;\n" +
- "import <CompleteOnImport:x.util>;\n";
- String expectedReplacedSource = "x.util";
- String testName = "<complete in import statement at the end of the unit>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Completion in import statement at the end of the unit (qualified empty name)
- */
-public void test40() {
-
- String str =
- "package a.b; \n"+
- "import java.";
-
- String completeBehind = "java.";
- String expectedCompletionNodeToString = "<CompleteOnImport:java.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "package a.b;\n" +
- "import <CompleteOnImport:java.>;\n";
- String expectedReplacedSource = "java.";
- String testName = "<complete in import statement at the end of the unit>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Should not find any diet completion
- */
-public void test41() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends \n" +
- " int foo(String str) \n" +
- " String variable = ; \n" +
- " { \n" +
- " String variableNotInScope; \n" +
- " } \n" +
- " foo(varia \n";
-
- String completeBehind = "foo(var";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "var";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "varia";
- String testName = "<should not find diet completion>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on array type with prefix dimensions
- */
-public void test42() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X { \n" +
- " int[] foo(String str) \n";
-
- String completeBehind = "int";
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String completionIdentifier = "int";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " <CompleteOnType:int>\n" +
- "}\n";
- String expectedReplacedSource = "int";
- String testName = "<completion on array type with prefix dimensions>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on array type with postfix dimensions
- */
-public void test43() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X { \n" +
- " int foo(String str) [] \n";
-
- String completeBehind = "int";
- String expectedCompletionNodeToString = "<CompleteOnType:int>";
- String completionIdentifier = "int";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " <CompleteOnType:int>\n" +
- "}\n";
- String expectedReplacedSource = "int";
- String testName = "<completion on array type with postfix dimensions>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in return type behind other member
- */
-public void test44() {
-
- String str =
- "class X { \n" +
- " int i; \n" +
- " IOEx \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " int i;\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in return type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in return type behind other member
- */
-public void test45() {
-
- String str =
- "class X { \n" +
- " int i; \n" +
- " public IOEx \n" +
- "} \n";
-
- String completeBehind = "IOEx";
- String expectedCompletionNodeToString = "<CompleteOnType:IOEx>";
- String completionIdentifier = "IOEx";
- String expectedUnitDisplayString =
- "class X {\n" +
- " int i;\n" +
- " <CompleteOnType:IOEx>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOEx";
- String testName = "<complete in return type>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on name in field initializer
- */
-public void test46() {
-
- String str =
- "class X { \n" +
- " String s = \"hello\"; \n" +
- " int f = s. \n" +
- "} \n";
-
- String completeBehind = "= s";
- String expectedCompletionNodeToString = "<CompleteOnName:s>";
- String completionIdentifier = "s";
- String expectedUnitDisplayString =
- "class X {\n" +
- " String s;\n" +
- " int f = <CompleteOnName:s>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "s";
- String testName = "<complete on name in field initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete in field initializer in innner class
- */
-public void test47() {
-
- String str =
- "class X { \n" +
- " class Y { \n" +
- " Object[] f = { this.foo } \n" +
- " Object foo(){ return this; } \n" +
- "} \n";
-
- String completeBehind = "this.foo";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.foo>";
- String completionIdentifier = "foo";
- String expectedUnitDisplayString =
- "class X {\n" +
- " class Y {\n" +
- " Object[] f = {<CompleteOnMemberAccess:this.foo>,};\n" +
- " Y() {\n" +
- " }\n" +
- " Object foo() {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "this.foo";
- String testName = "<complete in field initializer in inner class>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Should not find fake field of type <CompleteOnType:f>
- */
-public void test48() {
-
- String str =
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv) \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n";
-
- String completeBehind = "new Member().f";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "f";
- String expectedUnitDisplayString =
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "f";
- String testName = "<should not find fake field of type f>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Completion in middle of package import statement
- */
-public void test49() {
-
- String str =
- "import java.lang.reflect.*; \n"+
- "class X { \n"+
- "} \n";
-
- String completeBehind = "java.la";
- String expectedCompletionNodeToString = "<CompleteOnImport:java.la>";
- String completionIdentifier = "la";
- String expectedUnitDisplayString =
- "import <CompleteOnImport:java.la>;\n" +
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.lang.reflect";
- String testName = "<complete in middle of package import statement>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on instance creation in field initializer.
- */
-public void test50() {
-
- String str =
- "class X { \n" +
- " String s = \"hello\"; \n" +
- " Object o = new Xyz(); \n" +
- "} \n";
-
- String completeBehind = "new X";
- String expectedCompletionNodeToString = "<CompleteOnType:X>";
- String completionIdentifier = "X";
- String expectedUnitDisplayString =
- "class X {\n" +
- " String s;\n" +
- " Object o = new <CompleteOnType:X>();\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "Xyz";
- String testName = "<complete on instance creation in field initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on member access in field initializer.
- */
-public void test51() {
-
- String str =
- "class X { \n" +
- " String s = \"hello\"; \n" +
- " Object o = fred().xyz; \n" +
- "} \n";
-
- String completeBehind = "fred().x";
- String expectedCompletionNodeToString = "<CompleteOnMemberAccess:fred().x>";
- String completionIdentifier = "x";
- String expectedUnitDisplayString =
- "class X {\n" +
- " String s;\n" +
- " Object o = <CompleteOnMemberAccess:fred().x>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "xyz";
- String testName = "<complete on member access in field initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on class literal access in field initializer.
- */
-public void test52() {
-
- String str =
- "class X { \n" +
- " String s = \"hello\"; \n" +
- " Class c = int[].class; \n" +
- "} \n";
-
- String completeBehind = "int[].c";
- String expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int[].c>";
- String completionIdentifier = "c";
- String expectedUnitDisplayString =
- "class X {\n" +
- " String s;\n" +
- " Class c = <CompleteOnClassLiteralAccess:int[].c>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "int[].class";
- String testName = "<complete on class literal access in field initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on method invocation in field initializer.
- */
-public void test53() {
-
- String str =
- "class X { \n" +
- " String s = \"hello\"; \n" +
- " Object o = s.concat(); \n" +
- "} \n";
-
- String completeBehind = "s.concat(";
- String expectedCompletionNodeToString = "<CompleteOnMessageSend:s.concat()>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "class X {\n" +
- " String s;\n" +
- " Object o = <CompleteOnMessageSend:s.concat()>;\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "concat(";
- String testName = "<complete on method invocation in field initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Should not find fake field of type <CompleteOnType:f>
- */
-public void test54() {
-
- String str =
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n";
-
- String completeBehind = "new Member().f";
- String expectedCompletionNodeToString = NONE;
- String completionIdentifier = "f";
- String expectedUnitDisplayString =
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "f";
- String testName = "<should not find fake field of type f>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on anonymous type in field initializer.
- */
-public void test55() {
-
- String str =
- "class X { \n" +
- " Object o = new Object(){ \n" +
- " void foo(){ \n" +
- " String x = \"\"; \n" +
- " x.index \n" +
- " } \n" +
- " \n" +
- " void bar(){ \n" +
- " String y = \"\"; \n" +
- " } \n" +
- " }; \n" +
- "} \n";
-
- String completeBehind = "x.index";
- String expectedCompletionNodeToString = "<CompleteOnName:x.index>";
- String completionIdentifier = "index";
- String expectedUnitDisplayString =
- "class X {\n" +
- " Object o = new Object() {\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " String x;\n" +
- " <CompleteOnName:x.index>;\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " };\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "x.index";
- String testName = "<complete on anonymous type in field initializer>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
deleted file mode 100644
index fd56e9d..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
+++ /dev/null
@@ -1,5833 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import java.util.Locale;
-
-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.env.ICompilationUnit;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
-import org.eclipse.jdt.internal.compiler.parser.Parser;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
-
-public class DietRecoveryTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
- public static boolean optimizeStringLiterals = false;
- public static long sourceLevel = CompilerOptions.JDK1_3; //$NON-NLS-1$
-
-public DietRecoveryTest(String testName){
- super(testName);
-}
-
-public void checkParse(
- char[] source,
- String expectedDietUnitToString,
- String expectedDietPlusBodyUnitToString,
- String expectedFullUnitToString,
- String expectedCompletionDietUnitToString,
- String testName) {
-
- /* using regular parser in DIET mode */
- {
- Parser parser =
- new Parser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(),
- new DefaultProblemFactory(Locale.getDefault())),
- optimizeStringLiterals,
- sourceLevel);
-
- 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(),
- new DefaultProblemFactory(Locale.getDefault())),
- optimizeStringLiterals,
- sourceLevel);
-
- 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 = computedUnit.types.length; --i >= 0;){
- computedUnit.types[i].binding = new SourceTypeBinding(){};
- computedUnit.types[i].parseMethod(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 */
- {
- Parser parser =
- new Parser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(),
- new DefaultProblemFactory(Locale.getDefault())),
- optimizeStringLiterals,
- sourceLevel);
-
- 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 */
- {
- SourceElementParser parser =
- new SourceElementParser(
- new TestSourceElementRequestor(),
- new DefaultProblemFactory(Locale.getDefault()),
- new CompilerOptions());
-
- 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 */
- {
- SourceElementParser parser =
- new SourceElementParser(
- new TestSourceElementRequestor(),
- new DefaultProblemFactory(Locale.getDefault()),
- new CompilerOptions());
-
- 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 */
- {
- CompilerOptions options = new CompilerOptions();
- CompletionParser parser =
- new CompletionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())),
- options.sourceLevel);
-
- 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);
- }
-}
-/*
- * Should treat variables 'h' and 'i' as fields since 'public'.
- */
-public void test01() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<promote local vars into fields>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out local type altogether
- */
-public void test02() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " class L { \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<filter out local type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should still be finding last method (#baz)
- */
-
-public void test03() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<should find last method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should finding 5 fields.
- */
-
-public void test04() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " X x; \n"
- + " Object a, b = null; \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " X x;\n" +
- " Object a;\n" +
- " Object b = null;\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " X x;\n" +
- " Object a;\n" +
- " Object b = null;\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " X x;\n" +
- " Object a;\n" +
- " Object b;\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<five fields>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Diet parse thinks it is successful - no recovery
- */
-
-public void test05() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " void bar(){ \n"
- + " } \n"
- + " void truc(){ \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<diet was successful>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Recovery will not restart from scratch, and miss some signatures (#baz())
- */
-
-public void test06() {
-
- String s =
- "import java.lang.*; \n"
- + " \n"
- + "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " void bar(){ \n"
- + " } \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "import java.lang.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "import java.lang.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<will not miss nested method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Attaching orphan methods and fields
- */
-
-public void test07() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + "} \n"
- + " void bar(){ \n"
- + " } \n"
- + " int x; \n"
- + " void baz(){ \n"
- + " } \n"
- + " int y; \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<attaching orphans>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Properly attaching fields/methods to member type
- */
-
-public void test08() {
-
- String s =
- "public class X { \n"
- + " class Y { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<attaching to member type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Properly attaching fields/methods to enclosing type
- */
-
-public void test09() {
-
- String s =
- "public class X { \n"
- + " class Y { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " public X() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<attaching to enclosing type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Properly attaching fields/methods to member type in presence of missing
- * member type opening brace (Y) (and array initializer for (i)).
- */
-
-public void test10() {
-
- String s =
- "public class X { \n"
- + " class Y \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " Y() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<missing brace + array initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Attaching orphan methods and fields, by counting brackets
- * variable 'x' should be eliminated (looks like a local variable)
- */
-
-public void test11() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + "} \n"
- + " void bar(){ \n"
- + " int x; \n"
- + " void baz(){ \n"
- + " } \n"
- + " int y; \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " int y;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<attaching orphans with missing brackets>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Attaching orphan methods and fields, by counting brackets
- * variable 'x' should NOT be eliminated given it looks like a field
- */
-
-public void test12() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + "} \n"
- + " void bar(){ \n"
- + " public int x; \n"
- + " void baz(){ \n"
- + " } \n"
- + " int y; \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void baz() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<attaching orphans with missing brackets 2>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString ,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should still recover incomplete type signature (missing superclass)
- */
-
-public void test13() {
-
- String s =
- "public class X extends { \n"
- + " void foo() { \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<invalid type header>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should still recover incomplete method signature (missing opening brace)
- */
-
-public void test14() {
-
- String s =
- "public class X extends Thread { \n"
- + " void foo() \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X extends Thread {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X extends Thread {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<method header missing opening brace>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should still recover incomplete method signature (missing thrown exceptions)
- */
-
-public void test15() {
-
- String s =
- "public class X extends Thread { \n"
- + " void foo() throws \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X extends Thread {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X extends Thread {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<method header missing thrown exceptions>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should still recover incomplete type signature (missing superinterfaces)
- */
-
-public void test16() {
-
- String s =
- "public class X implements \n"
- + " void foo() \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<type header missing superinterfaces>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should still recover incomplete type signature (missing superinterfaces)
- */
-
-public void test17() {
-
- String s =
- "public class X implements Y, \n"
- + " void foo() \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X implements Y {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X implements Y {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<type header missing superinterfaces 2>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find member type behind incomplete enclosing type header
- */
-
-public void test18() {
-
- String s =
- "public class X implements \n"
- + " class Y { \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<member type behind incomplete enclosing type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find member type when missing opening brace
- */
-
-public void test19() {
-
- String s =
- "public class X \n"
- + " class Y { \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n"+
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<member type when missing opening brace>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not find fieldX signature behind missing brace
- */
-
-public void test20() {
-
- String s =
- "public class X \n"
- + " fieldX; \n"
- + " class Y { \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n"+
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<no field behind missing brace>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find Y as member type
- */
-
-public void test21() {
-
- String s =
- "public class X \n"
- + " fieldX; \n"
- + " class Y \n"
- + " } \n"
- + "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n"+
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find Y as member type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out incomplete local type
- */
-
-public void test22() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz(){} \n" +
- " } \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should filter out incomplete local type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out incomplete local type and method signature
- */
-
-public void test23() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz() throws {} \n" +
- " } \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should filter out incomplete local type/method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out anonymous type
- */
-
-public void test24() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() {} \n" +
- " }.baz(); \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should filter out incomplete anonymous type/method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out incomplete anonymous type
- */
-
-public void test25() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() {} \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should filter out incomplete anonymous type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out incomplete anonymous method
- */
-
-public void test26() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() \n" +
- " } \n" +
- " } \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should filter out incomplete anonymous method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should filter out incomplete local type and local var h
- */
-
-public void test27() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz(){} \n" +
- " } \n" +
- " \n" +
- " int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should filter incomplete local type L and variable h>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find <y> as a field in Y
- */
-
-public void test28() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y { \n" +
- " int y; \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " int y;\n" +
- " Y() {\n" +
- " }\n" +
- " }\n" +
- " int x;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " int y;\n" +
- " Y() {\n" +
- " super();\n"+
- " }\n" +
- " }\n" +
- " int x;\n" +
- " public X() {\n" +
- " super();\n"+
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find <y> as a field in Y>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find <y> as a field in X
- */
-
-public void test29() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y { \n" +
- "} \n" +
- " int y; \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " }\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " }\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find <y> as a field in X>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find <y> as a field in X
- */
-
-public void test30() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y \n" +
- "} \n" +
- " int y; \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " }\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " }\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find <y> as a field in X>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should recover from partial method header foo()
- */
-
-public void test31() {
-
- String s =
- "package a; \n"+
- "import java.lang.*; \n"+
- "import java.util.*; \n"+
- " \n"+
- "public class X { \n"+
- " void foo() \n"+
- " System.out.println(); \n"+
- " \n"+
- " public int h; \n"+
- " public int[] i = { 0, 1 }; \n"+
- " \n"+
- " void bar(){ \n"+
- " void truc(){ \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i = {0,1,};\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package a;\n" +
- "import java.lang.*;\n" +
- "import java.util.*;\n" +
- "public class X {\n" +
- " public int h;\n" +
- " public int[] i;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void truc() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<should recover from partial method header>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should recover from method with missing argument names
- */
-
-public void test32() {
-
- String s =
- "public class WB2 { \n"+
- " public void foo(java.util.Locale, java.util.Vector) { \n"+
- " int i; \n"+
- " if(i instanceof O) { \n"+
- " } \n"+
- " String s = \"hello\"; \n"+
- " s. \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class WB2 {\n" +
- " public WB2() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class WB2 {\n" +
- " public WB2() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should recover from method with missing argument names>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not find message with no argument as a constructor
- */
-
-public void test33() {
-
- String s =
- "public class X { \n"+
- " void hello() \n"+
- " public X(int i) \n"+
- " void foo() { \n"+
- " System.out.println(); \n"+
- " \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " void hello() {\n" +
- " }\n" +
- " public X(int i) {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " void hello() {\n" +
- " }\n" +
- " public X(int i) {\n" +
- " }\n" +
- " void foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not find message with no argument as a constructor>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not find allocation as a constructor
- */
-
-public void test34() {
-
- String s =
- "public class X { \n"+
- " void hello() \n"+
- " public X(int i) \n"+
- " static void foo() { \n"+
- " X x; \n"+
- " x = new X(23); \n"+
- " System.out.println(); \n"+
- " \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " void hello() {\n" +
- " }\n" +
- " public X(int i) {\n" +
- " }\n" +
- " static void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " void hello() {\n" +
- " }\n" +
- " public X(int i) {\n" +
- " }\n" +
- " static void foo() {\n" +
- " X x;\n" +
- " x = new X(23);\n" +
- " System.out.println();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not find allocation as a constructor>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Incomplete field header
- */
-
-public void test35() {
-
- String s =
- "public class X { \n" +
- " int x \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<incomplete field header>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Incomplete multiple field headers
- */
-
-public void test36() {
-
- String s =
- "public class X { \n" +
- " int x, y \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<incomplete multiple field headers>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Field header with started string initializer
- */
-
-public void test37() {
-
- String s =
- "public class X { \n" +
- " String s = \" \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " String s;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " String s;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<field header with started string initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Field header with started string initializer combined with incomplete superinterface
- */
-
-public void test38() {
-
- String s =
- "public class X implements Y, { \n" +
- " String s = \" \n";
-
- String expectedDietUnitToString =
- "public class X implements Y {\n" +
- " String s;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X implements Y {\n" +
- " String s;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<field header and incomplete superinterface>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Field signature behind keyword implements
- */
-
-public void test39() {
-
- String s =
- "public class X implements \n"+
- "int x \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int x;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<field signature behind keyword implements>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Field type read as interface
- */
-
-public void test40() {
-
- String s =
- "public class X implements Y, \n" +
- " String s = \" \n";
-
- String expectedDietUnitToString =
- "public class X implements Y, String {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X implements Y, String {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<field type read as interface>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Contiguous headers (checking checkpoint positions)
- */
-
-public void test41() {
-
- String s =
- "public class X public int foo(int bar(static String s";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " static String s;\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public int foo() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " static String s;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public int foo() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<contiguous headers>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Contiguous headers without comma (checking checkpoint positions)
- */
-
-public void test42() {
-
- String s =
- "public class X public int foo(int x, int bar public String s;";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public String s;\n" +
- " public X() {\n" +
- " }\n" +
- " public int foo(int x, int bar) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public String s;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public int foo(int x, int bar) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<contiguous headers without comma>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Contiguous headers without comma (checking checkpoint positions)
- */
-
-public void test43() {
-
- String s =
- "public class X \n" +
- " public int foo( \n" +
- " int bar( \n" +
- " static String s, int x \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " static String s;\n" +
- " int x;\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public int foo() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " static String s;\n" +
- " int x;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public int foo() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<contiguous headers without comma>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find static field <x>
- */
-
-public void test44() {
-
- String s =
- "class X { \n" +
- " String s; \n" +
- " \n" +
- " public void foo( \n" +
- " static int x \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " String s;\n" +
- " static int x;\n" +
- " X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " String s;\n" +
- " static int x;\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;;
-
- String testName = "<should find static field x>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Missing string literal quote inside method
- */
-
-public void test45() {
-
- String s =
- "public class X { \n"+
- " int foo(){ \n"+
- " String s = \" \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<missing string literal quote inside method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Detecting member type closing when missing brackets
- */
-
-public void test46() {
-
- String s =
- "class X \n"+
- " String s = \"class y \n"+
- " class Member \n"+
- " int foo() \n"+
- " public int x; \n"+
- " } \n"+
- " int bar() \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " class Member {\n" +
- " public int x;\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " String s;\n" +
- " X() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " class Member {\n" +
- " public int x;\n" +
- " Member() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " String s;\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<detecting member type closing when missing brackets>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated method arguments
- */
-
-public void test47() {
-
- String s =
-
- "class X { \n" +
- " int foo(AA a, BB b, IOEx \n" +
- " \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " int foo(AA a, BB b) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo(AA a, BB b) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated method arguments>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated literal string in method body
- */
-
-public void test48() {
-
- String s =
- "public class X { \n"+
- " final static int foo(){ \n"+
- " return \"1; \n"+
- " } \n"+
- " public static void main(String argv[]){ \n"+
- " foo(); \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " static final int foo() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " }\n" +
- "}\n";
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static final int foo() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " foo();\n" +
- " }\n" +
- "}\n";
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated literal string in method body>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated initializer with local declaration
- */
-
-public void test49() {
-
- String s =
- "public class X { \n"+
- " { \n"+
- " int x; \n"+
- " \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated initializer with local declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated if statement
- */
-
-public void test50() {
-
- String s =
- "public class X { \n"+
- " int foo(){ \n"+
- " if(true){ \n"+
- " int x; \n"+
- " \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated if statement>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated nested block with local declaration
- */
-
-public void test51() {
-
- String s =
- "public class X { \n"+
- " int foo(){ \n"+
- " { \n"+
- " int x; \n"+
- " \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated nested block with local declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated nested block with field declaration
- */
-
-public void test52() {
-
- String s =
- "public class X { \n"+
- " int foo(){ \n"+
- " { \n"+
- " public int x; \n"+
- " \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public int x;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public int x;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated nested block with field declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated initializer with field declaration
- */
-
-public void test53() {
-
- String s =
- "public class X { \n"+
- " { \n"+
- " public int x; \n"+
- " \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public int x;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " {\n" +
- " }\n" +
- " public int x;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated initializer with field declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Invalid class name
- */
-
-public void test54() {
-
- String s =
- "package p; \n"+
- "public class ZPro.Sev.Blo { \n"+
- "void ThisIsADummyMethodThatIsCreatedOnlyForThePurposesOfTheCompletionEngine() { \n"+
- " System.out.println(this.getClass()); \n"+
- "} \n"+
- " // COMMENT \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "package p;\n" +
- "public class ZPro {\n" +
- " {\n" +
- " }\n" +
- " public ZPro() {\n" +
- " }\n" +
- " void ThisIsADummyMethodThatIsCreatedOnlyForThePurposesOfTheCompletionEngine() {\n" +
- " }\n" +
- "}\n";
- String expectedDietPlusBodyUnitToString =
- "package p;\n" +
- "public class ZPro {\n" +
- " {\n" +
- " }\n" +
- " public ZPro() {\n" +
- " super();\n" +
- " }\n" +
- " void ThisIsADummyMethodThatIsCreatedOnlyForThePurposesOfTheCompletionEngine() {\n" +
- " System.out.println(this.getClass());\n" +
- " }\n" +
- "}\n";
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<Invalid class name>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated static initializer with field declaration
- */
-
-public void test55() {
-
- String s =
- "public class X { \n"+
- " static { \n"+
- " public int x; \n"+
- " \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unterminated static initializer with field declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Multiple initializers combined with array initializer
- */
-
-public void test56() {
-
- String s =
- "public class X \n"+
- " static int zz \n"+
- " { \n"+
- " } \n"+
- " static { \n"+
- " public int x; \n"+
- " int[] y = { 0, 1}; \n"+
- " { \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " static int zz;\n" +
- " {\n" +
- " }\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " int[] y = {0,1,};\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " static int zz;\n" +
- " {\n" +
- " }\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " int[] y = {0,1,};\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "public class X {\n" +
- " static int zz;\n" +
- " {\n" +
- " }\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " int[] y;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<multiple initializers combined with array initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Combination of unterminated methods and fields
- */
-
-public void test57() {
-
- String s =
- "class X \n"+
- " void foo(){ \n"+
- " { \n"+
- " public static int x; \n"+
- " void bar() \n"+
- " } \n"+
- " int y; \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " public static int x;\n" +
- " int y;\n" +
- " X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " public static int x;\n" +
- " int y;\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<combination of unterminated methods and fields>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Illegal unicode inside method body
- */
-
-public void test58() {
-
- String s =
- "package p; \n"+
- " \n"+
- "class A { \n"+
- " void bar() { \n"+
- " String s = \"\\u000D\"; \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "package p;\n" +
- "class A {\n" +
- " A() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package p;\n" +
- "class A {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<illegal unicode inside method body>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Extra identifier in type signature
- */
-
-public void test59() {
-
- String s =
- "public class X extends java.io.IOException IOException { \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "public class X extends java.io.IOException {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X extends java.io.IOException {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<extra identifier in type signature>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Extra identifier in method signature
- */
-
-public void test60() {
-
- String s =
- "public class X extends java.io.IOException { \n" +
- " int foo() ExtraIdentifier { \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "public class X extends java.io.IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X extends java.io.IOException {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<extra identifier in method signature>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Extra identifier behind thrown exception
- */
-
-public void test61() {
-
- String s =
- "public class X extends { \n" +
- " int foo() throws IOException ExtraIdentifier { \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() throws IOException {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() throws IOException {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<extra identifier behind thrown exception>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unterminated array initializer
- */
-
-public void test62() {
-
- String s =
- "class X { \n"+
- " class Y \n"+
- " public String s; \n"+
- " int foo(){ \n"+
- " return 1; \n"+
- " static int y = {; \n"+ // can only be an initializer since type is not array one
- " } \n"+
- " public int i = 0; \n"+
- " \n"+
- " int baz() \n"+
- " \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " public String s;\n" +
- " static int y;\n" +
- " {\n" +
- " }\n" +
- " public int i = 0;\n" +
- " Y() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " int baz() {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " public String s;\n" +
- " static int y;\n" +
- " {\n" +
- " ;;\n" +
- " }\n" +
- " public int i = 0;\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " int baz() {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " public String s;\n" +
- " static int y;\n" +
- " {\n" +
- " }\n" +
- " public int i;\n" +
- " Y() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " int baz() {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<unterminated array initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Initializer behind array initializer
- */
-
-public void test63() {
-
- String s =
- "class X { \n"+
- " int x[] = {0, 1} \n"+
- " { \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " int[] x = {0,1,};\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " int[] x = {0,1,};\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "class X {\n" +
- " int[] x;\n" +
- " {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<initializer behind array initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Initializers mixed with fields
- */
-
-public void test64() {
-
- String s =
- "public class X \n"+
- " int[] x = { 0, 1}; \n"+
- " static int zz \n"+
- " { \n"+
- " } \n"+
- " static { \n"+
- " public int x; \n"+
- " { \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " int[] x = {0,1,};\n" +
- " static int zz;\n" +
- " {\n" +
- " }\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int[] x = {0,1,};\n" +
- " static int zz;\n" +
- " {\n" +
- " }\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "public class X {\n" +
- " int[] x;\n" +
- " static int zz;\n" +
- " {\n" +
- " }\n" +
- " static {\n" +
- " }\n" +
- " public int x;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<initializers mixed with fields>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find method behind some()
- */
-
-public void test65() {
-
- String s =
- "import java.lang.*; \n" +
- " \n" +
- "public class Hanoi { \n" +
- "private Post[] posts; \n" +
- "public static void main (String args[]) { \n" +
- "} \n" +
- "public void some(){ \n" +
- " \n" +
- "private void moveDisk (Post source, Post destination) { \n" +
- "} \n" +
- "protected void reportMove (Post source, Post destination) { \n" +
- "} \n" +
- "private void reset () { \n" +
- "} \n" +
- "public void solve () { \n" +
- "} \n" +
- "private void solve (int depth, Post start, Post free, Post end) { \n" +
- "} \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "import java.lang.*;\n" +
- "public class Hanoi {\n" +
- " private Post[] posts;\n" +
- " public Hanoi() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- " public void some() {\n" +
- " }\n" +
- " private void moveDisk(Post source, Post destination) {\n" +
- " }\n" +
- " protected void reportMove(Post source, Post destination) {\n" +
- " }\n" +
- " private void reset() {\n" +
- " }\n" +
- " public void solve() {\n" +
- " }\n" +
- " private void solve(int depth, Post start, Post free, Post end) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "import java.lang.*;\n" +
- "public class Hanoi {\n" +
- " private Post[] posts;\n" +
- " public Hanoi() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- " public void some() {\n" +
- " }\n" +
- " private void moveDisk(Post source, Post destination) {\n" +
- " }\n" +
- " protected void reportMove(Post source, Post destination) {\n" +
- " }\n" +
- " private void reset() {\n" +
- " }\n" +
- " public void solve() {\n" +
- " }\n" +
- " private void solve(int depth, Post start, Post free, Post end) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find method behind some()>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should detect X(int) as a method with no return type
- */
-
-public void test66() {
-
- String s =
- "class X { \n"+
- " class Y { \n"+
- " X(int i){} \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " X(int i) {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " X(int i) {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should detect X(int) as a method with no return type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should detect orphan X(int) as a constructor
- */
-
-public void test67() {
-
- String s =
- "class X { \n"+
- " class Y { \n"+
- " } \n"+
- "} \n"+
- " X(int i){ \n"+
- " } \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " }\n" +
- " X(int i) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " }\n" +
- " X(int i) {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should detect orphan X(int) as a constructor>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Empty unit
- */
-
-public void test68() {
-
- String s = "";
-
- String expectedDietUnitToString = "";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<empty unit>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unit reduced to a method declaration
- */
-
-public void test69() {
-
- String s =
- " int foo(){ \n" +
- " System.out.println(); \n" +
- " } \n";
-
- String expectedDietUnitToString = "";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unit reduced to a method declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unit reduced to a constructor declaration
- */
-
-public void test70() {
-
- String s =
- " X(){ \n" +
- " System.out.println(); \n" +
- " } \n";
-
- String expectedDietUnitToString = "";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unit reduced to a constructor declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unit reduced to a field declaration
- */
-
-public void test71() {
-
- String s =
- " String str = new String();";
-
- String expectedDietUnitToString = "";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unit reduced to a field declaration>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Unit reduced to a field declaration with array initializer
- */
-
-public void test72() {
-
- String s =
- " String[] str = { \"hello\" };";
-
- String expectedDietUnitToString = "";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<unit reduced to a field declaration with array initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not pick-up any constructor with no arg
- */
-
-public void test73() {
-
- String s =
- " class X { \n" +
- " X(int i){} \n" +
- " int foo(){ \n" +
- " new X( \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " X(int i) {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X(int i) {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not pick-up any constructor with no arg>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not detect any field
- */
-
-public void test74() {
-
- String s =
- "package pack; \n" +
- " \n" +
- "class A extends IOException { \n" +
- " \n" +
- " S{ \n" +
- " int x; \n" +
- " } \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package pack;\n" +
- "class A extends IOException {\n" +
- " {\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package pack;\n" +
- "class A extends IOException {\n" +
- " {\n" +
- " int x;\n" +
- " }\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not detect any field>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Bunch of syntax errors
- */
-
-public void test75() {
-
- String s =
- "package ZKentTest;\n"+
- "\n"+
- "import java.awt.color.*;\n"+
- "\n"+
- "public class A {\n"+
- " A foo(int i) { return this; }\n"+
- " int[] ii = {0, 1clone()\n"+
- "\n"+
- " int bar() {\n"+
- " class Local {\n"+
- " int hello(){\n"+
- " fo\n"+
- " }\n"+
- " int world()\n"+
- " }\n"+
- " void foo() {\n"+
- " ba \n";
-
- String expectedDietUnitToString =
- "package ZKentTest;\n" +
- "import java.awt.color.*;\n" +
- "public class A {\n" +
- " int[] ii;\n" +
- " public A() {\n" +
- " }\n" +
- " A foo(int i) {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package ZKentTest;\n" +
- "import java.awt.color.*;\n" +
- "public class A {\n" +
- " int[] ii;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " A foo(int i) {\n" +
- " return this;\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package ZKentTest;\n" +
- "import java.awt.color.*;\n" +
- "public class A {\n" +
- " int[] ii;\n" +
- " public A() {\n" +
- " }\n" +
- " A foo(int i) {\n" +
- " }\n" +
- " clone() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<bunch of syntax errors>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find Member as a member type
- */
-
-public void test76() {
-
- String s =
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv) \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n";
-
- String expectedDietUnitToString =
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find Member as a member type>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not recover duplicate field numberOfDisks
- */
-
-public void test77() {
-
- String s =
- "package p; \n"+
- " \n"+
- "import java.lang.*; \n"+
- " \n"+
- "class IncompleteHanoi { \n"+
- "private Post[] posts; \n"+
- "private int numberOfDisks; \n"+
- " \n"+
- "public Hanoi (int numberOfDisks) { \n"+
- " this.numberOfDisks = numberOfDisks; \n"+
- "'' this.posts = new Post[3]; \n"+
- " String[] postNames = new String[]{\"Left\", \"Middle\", \"Right\"}; \n"+
- " \n"+
- " for (int i = 0; i < 3; ++i) \n"+
- " this.posts[i] = new Post(postNames[i], numberOfDisks); \n"+
- "} \n"+
- " \n"+
- "private void solve (int depth, Post start, Post free, Post end) { \n"+
- " if (depth == 1) \n"+
- " moveDisk(start, end); \n"+
- " else if (depth > 1) { \n"+
- " sol \n";
-
- String expectedDietUnitToString =
- "package p;\n" +
- "import java.lang.*;\n" +
- "class IncompleteHanoi {\n" +
- " private Post[] posts;\n" +
- " private int numberOfDisks;\n" +
- " IncompleteHanoi() {\n" +
- " }\n" +
- " public Hanoi(int numberOfDisks) {\n" +
- " }\n" +
- " private void solve(int depth, Post start, Post free, Post end) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package p;\n" +
- "import java.lang.*;\n" +
- "class IncompleteHanoi {\n" +
- " private Post[] posts;\n" +
- " private int numberOfDisks;\n" +
- " IncompleteHanoi() {\n" +
- " super();\n" +
- " }\n" +
- " public Hanoi(int numberOfDisks) {\n" +
- " }\n" +
- " private void solve(int depth, Post start, Post free, Post end) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not recover duplicate field numberOfDisks>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not detect a field v (1/2)
- */
-
-public void test78() {
-
- String s =
- "class X { \n" +
- " int foo(){ \n" +
- " Vector v = new Vector(); \n" +
- " s \n" +
- " v.addElement( \n" +
- " } \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not detect a field v>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not detect a field v (2/2)
- */
-
-public void test79() {
-
- String s =
- "class X { \n" +
- " int foo(){ \n" +
- " Vector v = new Vector(); \n" +
- " public s v.addElement( \n" +
- " } \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not detect a field v>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not detect a method bar
- */
-
-public void test80() {
-
- String s =
- "class X { \n" +
- " int test(){ \n" +
- " int[] i; \n" +
- " i \n" +
- " // some comment \n" +
- " bar(1); \n" +
- " } \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " int test() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " int test() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not detect a method bar>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not pick-up any constructor with no arg
- */
-
-public void test81() {
-
- String s =
- " class X { \n" +
- " X(int i){} \n" +
- " int foo(){ \n" +
- " X(12) \n";
-
- String expectedDietUnitToString =
- "class X {\n" +
- " X(int i) {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X(int i) {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not pick-up any constructor with no arg>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not promote message sending as a method
- */
-
-public void test82() {
-
- String s =
- "public class A { \n"+
- " \n"+
- " void foo() \n"+
- " if (true) { \n"+
- " } else { \n"+
- " Bar s; \n"+
- " s.fred(); \n"+
- " } \n"+
- " } \n"+
- "} \n";
- String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not promote message sending as a method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should not promote message sending as a method 2
- */
-
-public void test83() {
-
- String s =
- "public class A { \n"+
- " \n"+
- " void foo() if (true) { \n"+
- " } else { \n"+
- " Bar s; \n"+
- " s.fred(); \n"+
- " } \n"+
- " } \n"+
- "} \n";
- String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should not promote message sending as a method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find a static initializer
- */
-
-public void test84() {
-
- String s =
- "public class A extends \n" +
- " \n" +
- " static { \n" +
- "} \n";
- String expectedDietUnitToString =
- "public class A {\n" +
- " static {\n" +
- " }\n" +
- " public A() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " static {\n" +
- " }\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find a static initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find a static initializer
- */
-
-public void test85() {
-
- String s =
- "public class A \n" +
- " \n" +
- " static { \n" +
- "} \n";
- String expectedDietUnitToString =
- "public class A {\n" +
- " static {\n" +
- " }\n" +
- " public A() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " static {\n" +
- " }\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find a static initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find an initializer
- */
-
-public void test86() {
-
- String s =
- "public class A \n" +
- " \n" +
- " int \n" +
- " { \n" +
- "} \n";
- String expectedDietUnitToString =
- "public class A {\n" +
- " {\n" +
- " }\n" +
- " public A() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " {\n" +
- " }\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find an initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Should find an initializer
- */
-
-public void test87() {
-
- String s =
- "public class A \n" +
- " \n" +
- " int x; \n" +
- " { \n" +
- " int y; \n" +
- "} \n";
- String expectedDietUnitToString =
- "public class A {\n" +
- " int x;\n" +
- " {\n" +
- " }\n" +
- " public A() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " int x;\n" +
- " {\n" +
- " int y;\n" +
- " }\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<should find an initializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FVRQG0: ITPCOM:WINNT - NullPointerException in recovery mode
- */
-
-public void test88() {
-
- String s =
- "package p1; \n" +
- " \n" +
- "public class X { \n" +
- " int foo(String s, int x) \n" +
- " public int y = new X() { \n" +
- " \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "package p1;\n" +
- "public class X {\n" +
- " public int y;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String s, int x) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "package p1;\n" +
- "public class X {\n" +
- " public int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " int foo(String s, int x) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "package p1;\n" +
- "public class X {\n" +
- " public int y;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String s, int x) {\n" +
- " }\n" +
- "}\n";;
-
- String testName = "<1FVRQG0: ITPCOM:WINNT - NullPointerException in recovery mode>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FVRN9V: ITPJCORE:WIN98 - Internal builder error compiling servlet
- */
-
-public void test89() {
-
- String s =
- "import javax.servlet.*; \n" +
- "import javax.servlet.http.*; \n" +
- " \n" +
- "public class Servlet1 extends HttpServlet { \n" +
- " protected (HttpServletRequest req, HttpServletResponse resp) { \n" +
- " } \n" +
- "} \n";
-
- String expectedDietUnitToString =
- "import javax.servlet.*;\n" +
- "import javax.servlet.http.*;\n" +
- "public class Servlet1 extends HttpServlet {\n" +
- " HttpServletRequest req;\n" +
- " HttpServletRequest HttpServletResponse;\n" +
- " {\n" +
- " }\n" +
- " public Servlet1() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "import javax.servlet.*;\n" +
- "import javax.servlet.http.*;\n" +
- "public class Servlet1 extends HttpServlet {\n" +
- " HttpServletRequest req;\n" +
- " HttpServletRequest HttpServletResponse;\n" +
- " {\n" +
- " }\n" +
- " public Servlet1() {\n" +
- " super();\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FVRN9V: ITPJCORE:WIN98 - Internal builder error compiling servlet>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FVXQZ4: ITPCOM:WIN98 - Walkback during parsing recovery
- */
-
-public void test90() {
-
- String s =
- "public class Test { \n"+
- " \n"+
- " int x; \n"+
- " int foo( \n"+
- " int bar( \n"+
- " baz(A a \n"+
- "} \n";
- String expectedDietUnitToString =
- "public class Test {\n" +
- " int x;\n" +
- " public Test() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- " baz(A a) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class Test {\n" +
- " int x;\n" +
- " public Test() {\n" +
- " super();\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " int bar() {\n" +
- " }\n" +
- " baz(A a) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FVXQZ4: ITPCOM:WIN98 - Walkback during parsing recovery>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface
- */
-
-public void test91() {
-
- String s =
- "public interface Fred { \n" +
- " void foo(); \n" +
- " void bar(); \n" +
- " public fred(X x, int y); \n" +
- "} \n";
- String expectedDietUnitToString =
- "public interface Fred {\n" +
- " void foo();\n" +
- " void bar();\n" +
- " public fred(X x, int y) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * Variation on 1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface
- */
-
-public void test92() {
- String s =
- "public interface Test { \n"+
- " void foo(); \n"+
- " \n"+
- " public fred(Fred x, int y); \n"+
- "} \n";
- String expectedDietUnitToString =
- "public interface Test {\n" +
- " void foo();\n" +
- " public fred(Fred x, int y) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FW5A4E: ITPCOM:WIN98 - Walkback reconciling
- */
-
-public void test93() {
- String s =
- "class X{ \n" +
- " int foo() \n" +
- " static { } \n" +
- "} \n";
- String expectedDietUnitToString =
- "class X {\n" +
- " static {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " static {\n" +
- " }\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FW5A4E: ITPCOM:WIN98 - Walkback reconciling>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FW3663: ITPCOM:WIN98 - Outline - does not show method #fred()
- */
-
-public void test94() {
- String s =
- "public class X { \n" +
- " int[] array; \n" +
- " \n" +
- "void foo() { \n" +
- " bar(this.array.length, 10, fred( \n" +
- " \n" +
- "int fred( \n" +
- "} \n";
- String expectedDietUnitToString =
- "public class X {\n" +
- " int[] array;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " int fred() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " int[] array;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- " int fred() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FW3663: ITPCOM:WIN98 - Outline - does not show method #fred()>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FW6M5M: ITPJUI:ALL - NPE in SourceElementParser
- */
-
-public void test95() {
- String s =
- "public interface IP { \n"+
- " public static toString() { \n"+
- " } \n"+
- "} \n";
- String expectedDietUnitToString =
- "public interface IP {\n" +
- " public static toString() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString = expectedDietUnitToString;
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FW6M5M: ITPJUI:ALL - NPE in SourceElementParser>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * 1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import
- */
-
-public void test96() {
- String s =
- "import ;\n"+
- "class X {\n"+
- " int foo(){\n"+
- " System.out.println();\n"+
- " }\n"+
- " static {\n"+
- " int i = j;\n"+
- " }\n"+
- "}\n";
- String expectedDietUnitToString =
- "class X {\n" +
- " static {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " static {\n" +
- " int i = j;\n" +
- " }\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- "}\n";
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * variation on 1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import
- */
-
-public void test97() {
- String s =
- "import ;\n"+
- "class X {\n"+
- " int foo(){\n"+
- " System.out.println();\n"+
- " }\n"+
- " static {\n"+
- " }\n"+
- "}\n";
- String expectedDietUnitToString =
- "class X {\n" +
- " static {\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " static {\n" +
- " }\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " int foo() {\n" +
- " System.out.println();\n" +
- " }\n" +
- "}\n";
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<variation on 1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-/*
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=9084
- */
-
-public void test98() {
-
- String s =
- "public class A { \n"+
- " class Platform { \n"+
- " public static void run(Runnable r) { \n"+
- " } \n"+
- " } \n"+
- " Object [] array = null; \n"+
- " for (int nX = 0; nX < array.length; nX ++) { \n"+
- " final String part = \"\"; \n"+
- " final String sel = \"\"; \n"+
- " Object l = null; \n"+
- " if ((part != null && sel != null) || l instanceof String) { \n"+
- " Platform.run(new Runnable() { \n"+
- " public void run() { \n"+
- " } \n"+
- " public void handleException(Throwable e) { \n"+
- " } \n"+
- " }); \n"+
- " } \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class A {\n"+
- " class Platform {\n"+
- " Platform() {\n"+
- " }\n"+
- " public static void run(Runnable r) {\n"+
- " }\n"+
- " }\n"+
- " Object[] array = null;\n"+
- " int nX = 0;\n"+
- " {\n"+
- " }\n"+
- " public A() {\n"+
- " }\n"+
- "}\n";
-
-
- String expectedDietPlusBodyUnitToString = "public class A {\n"+
- " class Platform {\n"+
- " Platform() {\n"+
- " super();\n"+
- " }\n"+
- " public static void run(Runnable r) {\n"+
- " }\n"+
- " }\n"+
- " Object[] array = null;\n"+
- " int nX = 0;\n"+
- " {\n"+
- " final String part = \"\";\n"+
- " final String sel = \"\";\n"+
- " Object l = null;\n"+
- " if ((((part != null) && (sel != null)) || (l instanceof String))) \n"+
- " {\n"+
- " Platform.run(new Runnable() {\n"+
- " public void run() {\n"+
- " }\n"+
- " public void handleException(Throwable e) {\n"+
- " }\n"+
- "});\n"+
- " };;\n"+
- " }\n"+
- " public A() {\n"+
- " super();\n"+
- " }\n"+
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString =
- "public class A {\n"+
- " class Platform {\n"+
- " Platform() {\n"+
- " }\n"+
- " public static void run(Runnable r) {\n"+
- " }\n"+
- " }\n"+
- " Object[] array;\n"+
- " int nX;\n"+
- " {\n"+
- " }\n"+
- " public A() {\n"+
- " }\n"+
- "}\n";
-
- String testName = "<check for null inside RecoveredInitializer>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-
-public void test99() {
- String s =
- "import ;\n"+
- "class X {\n"+
- "}\n"+
- "- public void addThreadFilter(IJavaThread thread) - restricts breakpoint to \n"+
- "given thread and any other previously specified threads\n"+
- "- public void removeThreadFilter(IJavaThread thread)- removes the given thread \n"+
- "restriction (will need to re-create breakpoint request as JDI does not support \n"+
- "the removal of thread filters)\n"+
- "- public IJavaThread[] getThreadFilters() - return the set of threads this \n"+
- "breakpoint is currently restricted to\n";
- String expectedDietUnitToString =
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " public void addThreadFilter(IJavaThread thread) {\n" +
- " }\n" +
- " public void removeThreadFilter(IJavaThread thread) {\n" +
- " }\n" +
- " public IJavaThread[] getThreadFilters() {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "class X {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " public void addThreadFilter(IJavaThread thread) {\n" +
- " }\n" +
- " public void removeThreadFilter(IJavaThread thread) {\n" +
- " }\n" +
- " public IJavaThread[] getThreadFilters() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<9101 - Parse error while typing in Java editor>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-public void test100() {
- String s =
- "public class Bug {\n" +
- " static boolean bold = false;\n" +
- "public static void main(String arguments[]) {\n" +
- " Shell shell = new Shell(SWT.MENU | SWT.RESIZE | SWT.TITLE | SWT.H_SCROLL);\n" +
- " StyledText text = new StyledText(shell, SWT.WRAP); \n" +
- " shell.addListener(SWT.Resize, new Listener() {\n" +
- " public void handleEvent(Event e) {\n" +
- " text.setBounds(shell.getClientArea()); \n" +
- " } \n" +
- " }); \n" +
- " shell.addListener(SWT.KeyDown, bew Listener () {\n" +
- " public void handleEvent(Event e) {\n" +
- " bold = !bold;\n" +
- " }\n" +
- " }); \n" +
- " text.addLineStyleListener(new LineStyleListener() { \n" +
- " public void lineGetStyle(LineStyleEvent event) {\n" +
- " }\n" +
- " });\n" +
- "}\n" +
- "}\n";
-
- String expectedDietUnitToString =
- "public class Bug {\n" +
- " static boolean bold = false;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bug() {\n" +
- " }\n" +
- " public static void main(String[] arguments) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class Bug {\n" +
- " static boolean bold = false;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bug() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] arguments) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString =
- "public class Bug {\n" +
- " static boolean bold = false;\n" +
- " public Bug() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public static void main(String[] arguments) {\n" +
- " }\n" +
- " bew Listener() {\n" +
- " }\n" +
- " public void handleEvent(Event e) {\n" +
- " }\n" +
- "}\n";
-
- String expectedCompletionDietUnitToString =
- "public class Bug {\n" +
- " static boolean bold;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bug() {\n" +
- " }\n" +
- " public static void main(String[] arguments) {\n" +
- " }\n" +
- "}\n";
-
- String testName = "<10616 - local type outside method>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-public void test101() {
- String s =
- "public class X { \n"+
- " Object foo(Stack<X> s) { \n"+
- " } \n"+
- " List<T> bar(int pos, T x1, T x2, List<T> l) { \n"+
- " } \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " Object foo() {\n" +
- " }\n" +
- " bar(int pos, T x1, T x2) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " Object foo() {\n" +
- " }\n" +
- " bar(int pos, T x1, T x2) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<12387 out of memory with generics>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-public void test102() {
- String s =
- "void ___eval() { \n"+
- "new Runnable(){ \n"+
- "void ___run() throws Throwable { \n"+
- "return blah; \n"+
- "} \n"+
- "private String blarg; \n"+
- "public void run (){ \n"+
- " class Local { \n" +
- " void baz() { \n"+
- " } \n" +
- " } \n"+
- "} \n"+
- "} \n"+
- ";} \n"+
- "public class Hello{ \n"+
- "private static int x; \n"+
- "private String blah; \n"+
- "public static void main (String[] args){ \n"+
- "} \n"+
- "public void hello (){ \n"+
- "} \n"+
- "public boolean blah (){ \n"+
- "return false;} \n"+
- "public void foo (){ \n"+
- "} \n"+
- "} \n";
-
- String expectedDietUnitToString =
- "public class Hello {\n" +
- " private static int x;\n" +
- " private String blah;\n" +
- " public Hello() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- " public void hello() {\n" +
- " }\n" +
- " public boolean blah() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n" ;
-
- String expectedDietPlusBodyUnitToString =
- "public class Hello {\n" +
- " private static int x;\n" +
- " private String blah;\n" +
- " public Hello() {\n" +
- " super();\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- " public void hello() {\n" +
- " }\n" +
- " public boolean blah() {\n" +
- " return false;\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<12454 - handling toplevel anonymous>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-public void test103() {
- String s =
- "public class X{ \n"+
- " void foo(int x, int y, void z";
-
- String expectedDietUnitToString =
- "public class X {\n" +
- " void z;\n" +
- " public X() {\n" +
- " }\n" +
- " void foo(int x, int y) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class X {\n" +
- " void z;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x, int y) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<14038 - third argument type is void>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-public void test104() {
- String s =
- "public class P#AField {\n" +
- " public void setP#A(String P#A) {\n" +
- " this.P#A = P#A;\n" +
- " }\n" +
- "}";
-
- String expectedDietUnitToString =
- "public class P {\n" +
- " {\n" +
- " }\n" +
- " public void setP;\n" +
- " public P() {\n" +
- " }\n" +
- " A(String P) {\n" +
- " }\n" +
- "}\n";
-
- String expectedDietPlusBodyUnitToString =
- "public class P {\n" +
- " {\n" +
- " }\n" +
- " public void setP;\n" +
- " public P() {\n" +
- " super();\n" +
- " }\n" +
- " A(String P) {\n" +
- " }\n" +
- "}\n";
-
- String expectedFullUnitToString = expectedDietUnitToString;
-
- String expectedCompletionDietUnitToString = expectedDietUnitToString;
-
- String testName = "<16126>";
- checkParse(
- s.toCharArray(),
- expectedDietUnitToString,
- expectedDietPlusBodyUnitToString,
- expectedFullUnitToString,
- expectedCompletionDietUnitToString,
- testName);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java
deleted file mode 100644
index 7fa57b4..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be an ExplicitConstructorInvocation
- * or inside an ExplicitConstructorInvocation
- */
-public class ExplicitConstructorInvocationCompletionTest extends AbstractCompletionTest {
-public ExplicitConstructorInvocationCompletionTest(String testName) {
- super(testName);
-}
-/*
- * 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:
- "<CompleteOnExplicitConstructorCall:primary().super(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar(Bar x) {\n" +
- " <CompleteOnExplicitConstructorCall:primary().super(1, 2)>;\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on explicit constructor invocation primary super>"
- );
-}
-/*
- * 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:
- "<CompleteOnExplicitConstructorCall:primary().this(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar(Bar x) {\n" +
- " <CompleteOnExplicitConstructorCall:primary().this(1, 2)>;\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on explicit constructor invocation primary this>"
- );
-}
-/*
- * 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:
- "<CompleteOnExplicitConstructorCall:super(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " <CompleteOnExplicitConstructorCall:super(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<completion on 'super' constructor invocation>"
- );
-}
-/*
- * 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:
- "<CompleteOnExplicitConstructorCall:this(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " <CompleteOnExplicitConstructorCall:this(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<completion on 'this' constructor invocation>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= Name '.' 'super' '(' <ArgumentListopt> ')' ';'
- */
-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:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " super(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on wrapper name super>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= Name '.' 'this' '(' <ArgumentListopt> ')' ';'
- */
-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:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " this(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on wrapper name this>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= Primary '.' 'this' '(' <ArgumentListopt> ')' ';'
- */
-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:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar(Bar x) {\n" +
- " super(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on wrapper primary super>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= 'super' '(' <ArgumentListopt> ')' ';'
- */
-public void testWrapperSuper() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " super(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " super(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on wrapper super>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= 'this' '(' <ArgumentListopt> ')' ';'
- */
-public void testWrapperThis() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " this(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " this(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on wrapper this>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java
deleted file mode 100644
index 30e8ddf..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * 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' '(' <ArgumentListopt> ')' ';'
- */
-public void testNameSuper() {
- 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()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // selectionStartBehind:
- "Bar.super(",
- // selectionEndBehind:
- "fred",
- // expectedSelectionNodeToString:
- "<SelectOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " super(<SelectOnMessageSend:fred()>);\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedSelectionIdentifier:
- "fred",
- // expectedReplacedSource:
- "fred()",
- // testName:
- "<select on explicit constructor invocation name super>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= Name '.' 'this' '(' <ArgumentListopt> ')' ';'
- */
-public void testNameThis() {
- 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()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // selectionStartBehind:
- "Bar.this(",
- // selectionEndBehind:
- "fred",
- // expectedSelectionNodeToString:
- "<SelectOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " this(<SelectOnMessageSend:fred()>);\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedSelectionIdentifier:
- "fred",
- // expectedReplacedSource:
- "fred()",
- // testName:
- "<select on explicit constructor invocation name this>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= Primary '.' 'this' '(' <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(fred()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // selectionStartBehind:
- "super(",
- // selectionEndBehind:
- "fred",
- // expectedSelectionNodeToString:
- "<SelectOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " InnerBar(Bar x) {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar(Bar x) {\n" +
- " super(<SelectOnMessageSend:fred()>);\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedSelectionIdentifier:
- "fred",
- // expectedReplacedSource:
- "fred()",
- // testName:
- "<select on explicit constructor invocation primary super>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= 'super' '(' <ArgumentListopt> ')' ';'
- */
-public void testSuper() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " super(fred()); \n" +
- " } \n" +
- "} \n",
- // selectionStartBehind:
- "super(",
- // selectionEndBehind:
- "fred",
- // expectedSelectionNodeToString:
- "<SelectOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " super(<SelectOnMessageSend:fred()>);\n" +
- " }\n" +
- "}\n",
- // expectedSelectionIdentifier:
- "fred",
- // expectedReplacedSource:
- "fred()",
- // testName:
- "<select on explicit constructor invocation super>"
- );
-}
-/*
- * ExplicitConstructorInvocation ::= 'this' '(' <ArgumentListopt> ')' ';'
- */
-public void testThis() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " this(fred()); \n" +
- " } \n" +
- "} \n",
- // selectionStartBehind:
- "this(",
- // selectionEndBehind:
- "fred",
- // expectedSelectionNodeToString:
- "<SelectOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " this(<SelectOnMessageSend:fred()>);\n" +
- " }\n" +
- "}\n",
- // expectedSelectionIdentifier:
- "fred",
- // expectedReplacedSource:
- "fred()",
- // testName:
- "<select on explicit constructor invocation this>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
deleted file mode 100644
index e484448..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
+++ /dev/null
@@ -1,2419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be a FieldAccess.
- */
-public class FieldAccessCompletionTest extends AbstractCompletionTest {
-public FieldAccessCompletionTest(String testName) {
- super(testName);
-}
-/*
- * AdditiveExpression ::= AdditiveExpression '-' <MultiplicativeExpression>
- */
-public void testAdditiveExpressionMinus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return 1 - fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (1 - <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on additive expression minus>"
- );
-}
-/*
- * AdditiveExpression ::= AdditiveExpression '+' <MultiplicativeExpression>
- */
-public void testAdditiveExpressionPlus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return 1 + fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (1 + <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on additive expression plus>"
- );
-}
-/*
- * AndExpression ::= AndExpression '&' <EqualityExpression>
- */
-public void testAndExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return isTrue & fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (isTrue & <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // expectedReplacedSource:
- "<complete on and expression>"
- );
-}
-/*
- * ArgumentList ::= ArgumentList ',' <Expression>
- */
-public void testArgumentList() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " bizz(1, \"2\", fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " bizz(1 , \"2\" , <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on argument list>"
- );
-}
-/*
- * ArrayAccess ::= Name '[' <Expression> ']'
- */
-public void testArrayAccess() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return v[fred().xyz]; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " v[<CompleteOnMemberAccess:fred().x>];\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on array access>"
- );
-}
-/*
- * ArrayAccess ::= PrimaryNoNewArray '[' <Expression> ']'
- */
-public void testArrayAccessPrimaryNoNewArray() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return buzz()[fred().xyz]; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " buzz()[<CompleteOnMemberAccess:fred().x>];\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on array access primary no new array>"
- );
-}
-/*
- * ArrayInitializer ::= '{' <VariableInitializers> '}'
- */
-public void testArrayInitializer() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[] i = new int[] {fred().xyz} \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int[] i = new int[]{<CompleteOnMemberAccess:fred().x>,};\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on array initializer>"
- );
-}
-/*
- * ArrayInitializer ::= '{' <VariableInitializers> , '}'
- */
-public void testArrayInitializerComma() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[] i = new int[] {fred().xyz,} \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int[] i = new int[]{<CompleteOnMemberAccess:fred().x>,};\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on array initializer comma>"
- );
-}
-/*
- * Assignment ::= LeftHandSide AssignmentOperator <AssignmentExpression>
- */
-public void testAssignment() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " i = fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on assignment>"
- );
-}
-/*
- * Block ::= OpenBlock '{' <BlockStatementsopt> '}'
- */
-public void testBlock() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " try { \n" +
- " fred().xyz = new Foo(); \n" +
- " } catch (Exception e) {} \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on block>"
- );
-}
-/*
- * BlockStatements ::= BlockStatements <BlockStatement>
- */
-public void testBlockStatements() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on block statements>"
- );
-}
-/*
- * ConstructorBody ::= NestedMethod '{' ExplicitConstructorInvocation <BlockStatements> '}'
- */
-public void testBlockStatementsInConstructorBody() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " super(); \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " super();\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on block statements in constructor body>"
- );
-}
-/*
- * BlockStatements ::= BlockStatements <BlockStatement>
- *
- * in a non static initializer.
- */
-public void testBlockStatementsInInitializer() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " { \n" +
- " int i = 0; \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " {\n" +
- " int i;\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on block statements in initializer>"
- );
-}
-/*
- * BlockStatements ::= BlockStatements <BlockStatement>
- *
- * in a static initializer.
- */
-public void testBlockStatementsInStaticInitializer() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " static { \n" +
- " int i = 0; \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " static {\n" +
- " int i;\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on block statements in static initializer>"
- );
-}
-/*
- * CastExpression ::= PushLPAREN <Expression> PushRPAREN UnaryExpressionNotPlusMinus
- *
- * NB: Valid syntaxically but not semantically
- */
-public void testCastExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar foo() { \n" +
- " return (fred().xyz)buzz(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " Bar foo() {\n" +
- " return <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on cast expression>"
- );
-}
-/*
- * CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN <UnaryExpression>
- * or
- * CastExpression ::= PushLPAREN Name Dims PushRPAREN <UnaryExpressionNotPlusMinus>
- * or
- * CastExpression ::= PushLPAREN Expression PushRPAREN <UnaryExpressionNotPlusMinus>
- */
-public void testCastExpressionUnaryExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar foo() { \n" +
- " return (Bar)(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " Bar foo() {\n" +
- " (Bar) <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on cast expression unary expression>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= 'new' ClassType '(' <ArgumentListopt> ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new Bar(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Bar(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on class instance creation expression>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Bar.new Bar(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Bar.new Bar(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on class instance creation expression name>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' <ArgumentListopt> ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionPrimary() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " bizz().new Bar(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " bizz().new Bar(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on class instance creation expression primary>"
- );
-}
-/*
- * ConditionalAndExpression ::= ConditionalAndExpression '&&' <InclusiveOrExpression>
- */
-public void testConditionalAndExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return isTrue && fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (isTrue && <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on conditional and expression>"
- );
-}
-/*
- * ConditionalExpression ::= ConditionalOrExpression '?' <Expression> ':' ConditionalExpression
- */
-public void testConditionalExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar foo() { \n" +
- " return fred().xyz == null ? null : new Bar(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " Bar foo() {\n" +
- " return <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on conditional expression>"
- );
-}
-/*
- * ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' <ConditionalExpression>
- */
-public void testConditionalExpressionConditionalExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return isTrue ? true : fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (isTrue ? true : <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on conditional expression conditional expression>"
- );
-}
-/*
- * ConditionalOrExpression ::= ConditionalOrExpression '||' <ConditionalAndExpression>
- */
-public void testConditionalOrExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return isTrue || fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (isTrue || <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on conditional or expression>"
- );
-}
-/*
- * ConstructorBody ::= NestedMethod '{' <BlockStatementsopt> '}'
- */
-public void testConstructorBody() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " super();\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on constructor body>"
- );
-}
-/*
- * DimWithOrWithOutExpr ::= '[' <Expression> ']'
- */
-public void testDimWithOrWithOutExpr() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[] v = new int[fred().xyz]; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int[] v = new int[<CompleteOnMemberAccess:fred().x>];\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on dim with or without expr>"
- );
-}
-/*
- * DoStatement ::= 'do' Statement 'while' '(' <Expression> ')' ';'
- */
-public void testDoExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " do \n" +
- " System.out.println(); \n" +
- " while (fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on do expression>"
- );
-}
-/*
- * DoStatement ::= 'do' <Statement> 'while' '(' Expression ')' ';'
- */
-public void testDoStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " do \n" +
- " fred().xyz = new Foo(); \n" +
- " while (true); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on do statement>"
- );
-}
-/*
- * EqualityExpression ::= EqualityExpression '==' <RelationalExpression>
- */
-public void testEqualityExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return 1 == fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (1 == <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on equality expression>"
- );
-}
-/*
- * EqualityExpression ::= EqualityExpression '!=' <RelationalExpression>
- */
-public void testEqualityExpressionNot() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return 1 != fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (1 != <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on equality expression not>"
- );
-}
-/*
- * ExclusiveOrExpression ::= ExclusiveOrExpression '^' <AndExpression>
- */
-public void testExclusiveOrExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return isTrue ^ fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (isTrue ^ <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on exclusive or expression>"
- );
-}
-/*
- * ConstructorBody ::= NestedMethod '{' <ExplicitConstructorInvocation> '}'
- * or
- * ConstructorBody ::= NestedMethod '{' <ExplicitConstructorInvocation> BlockStatements '}'
- */
-public void testExplicitConstructorInvocationInConstructorBody() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " static Bar x; \n" +
- " public class InnerBar { \n" +
- " } \n" +
- " public class SubInnerBar extends InnerBar { \n" +
- " SubInnerBar() { \n" +
- " Bar.x.x.super(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "Bar.x.x",
- // expectedCompletionNodeToString:
- "<CompleteOnName:Bar.x.x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " public InnerBar() {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " super();\n" +
- " <CompleteOnName:Bar.x.x>;\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "Bar.x.x",
- // test name
- "<complete on explicit constructor invocation in constructor body>"
- );
-}
-/*
- * ForStatement ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' Statement
- * or
- * ForStatementNoShortIf ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf
- */
-public void testForInit() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " for (int i = fred().xyz; i < 2; i++) \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on for init>"
- );
-}
-/*
- * ForStatement ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' <Statement>
- * or
- * ForStatementNoShortIf ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' <StatementNoShortIf>
- */
-public void testForStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " for (int i = 0; i < 2; i++) \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on for statement>"
- );
-}
-/*
- * ForStatement ::= 'for' '(' ForInitopt ';' <Expressionopt> ';' ForUpdateopt ')' Statement
- * or
- * ForStatementNoShortIf ::= 'for' '(' ForInitopt ';' <Expressionopt> ';' ForUpdateopt ')' StatementNoShortIf
- */
-public void testForStatementExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " for (int i = 0; fred().xyz > i; i++) \n" +
- " Systemout.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on for statement expression>"
- );
-}
-/*
- * ForStatement ::= 'for' '(' ForInitopt ';' Expressionopt ';' <ForUpdateopt> ')' Statement
- * or
- * ForStatementNoShortIf ::= 'for' '(' ForInitopt ';' Expressionopt ';' <ForUpdateopt> ')' StatementNoShortIf
- */
-public void testForUpdate() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " for (int i = 0; i < 2; i+= fred().xyz) \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " i += <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on for update>"
- );
-}
-/*
- * IfThenStatement ::= 'if' '(' <Expression> ')' Statement
- */
-public void testIfExpresionThen() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (fred().xyz) \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on \"if expression then\">"
- );
-}
-/*
- * IfThenElseStatement ::= 'if' '(' <Expression> ')' StatementNoShortIf 'else' Statement
- * or
- * IfThenElseStatementNoShortIf ::= 'if' '(' <Expression> ')' StatementNoShortIf 'else' StatementNoShortIf
- */
-public void testIfExpresionThenElse() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (fred().xyz) \n" +
- " System.out.println(); \n" +
- " else \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on \"if expression then else\">"
- );
-}
-/*
- * IfThenElseStatement ::= 'if' '(' Expression ')' StatementNoShortIf 'else' <Statement>
- * or
- * IfThenElseStatementNoShortIf ::= 'if' '(' Expression ')' StatementNoShortIf 'else' <StatementNoShortIf>
- */
-public void testIfThenElseStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (false) \n" +
- " System.out.println(); \n" +
- " else \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on \"if then else\" statement>"
- );
-}
-/*
- * IfThenStatement ::= 'if' '(' Expression ')' <Statement>
- */
-public void testIfThenStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (true) \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on \"if then\" statement>"
- );
-}
-/*
- * IfThenStatementElse ::= 'if' '(' Expression ')' <StatementNoShortIf> 'else' Statement
- * or
- * IfThenElseStatementNoShortIf ::= 'if' '(' Expression ')' <StatementNoShortIf> 'else' StatementNoShortIf
- */
-public void testIfThenStatementElse() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (true) \n" +
- " fred().xyz = new Foo(); \n" +
- " else \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on \"if then statement else\">"
- );
-}
-/*
- * InclusiveOrExpression ::= InclusiveOrExpression '|' <ExclusiveOrExpression>
- */
-public void testInclusiveOrExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return isTrue | fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (isTrue | <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on inclusive or expression>"
- );
-}
-/*
- * LabeledStatement ::= 'Identifier' ':' <Statement>
- * or
- * LabeledStatementNoShortIf ::= 'Identifier' ':' <StatementNoShortIf>
- */
-public void testLabeledStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " fredCall: fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // expectedLabels:
- new String[] {"fredCall"},
- // test name
- "<complete on labeled statement>"
- );
-}
-/*
- * MethodBody ::= NestedMethod '{' <BlockStatementsopt> '}'
- */
-public void testMethodBody() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on method body>"
- );
-}
-/*
- * MethodInvocation ::= Name '(' <ArgumentListopt> ')'
- */
-public void testMethodInvocation() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " bizz(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " bizz(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on method invocation>"
- );
-}
-/*
- * MethodInvocation ::= Primary '.' 'Identifier' '(' <ArgumentListopt> ')'
- */
-public void testMethodInvocationPrimary() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " buzz().bizz(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " buzz().bizz(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on method invocation primary>"
- );
-}
-/*
- * MethodInvocation ::= 'super' '.' 'Identifier' '(' <ArgumentListopt> ')'
- */
-public void testMethodInvocationSuper() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " super.bizz(fred().xyz); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " super.bizz(<CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on method invocation super>"
- );
-}
-/*
- * MultiplicativeExpression ::= MultiplicativeExpression '/' <UnaryExpression>
- */
-public void testMultiplicativeExpressiondDivision() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " double foo() { \n" +
- " return 2 / fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " double foo() {\n" +
- " (2 / <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on multiplicative expression division>"
- );
-}
-/*
- * MultiplicativeExpression ::= MultiplicativeExpression '*' <UnaryExpression>
- */
-public void testMultiplicativeExpressionMultiplication() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return 2 * fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (2 * <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on multiplicative expression multiplication>"
- );
-}
-/*
- * MultiplicativeExpression ::= MultiplicativeExpression '%' <UnaryExpression>
- */
-public void testMultiplicativeExpressionRemainder() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return 2 % fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (2 % <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on multiplicative expression remainder>"
- );
-}
-/*
- * PreDecrementExpression ::= '--' PushPosition <UnaryExpression>
- */
-public void testPreIncrementExpressionMinusMinus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " -- fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " -- <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on pre increment expression minus minus>"
- );
-}
-/*
- * PreIncrementExpression ::= '++' PushPosition <UnaryExpression>
- */
-public void testPreIncrementExpressionPlusPlus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " ++ fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " ++ <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on pre increment expression plus plus>"
- );
-}
-/*
- * PrimaryNoNewArray ::= PushLPAREN <Expression> PushRPAREN
- */
-public void testPrimaryNoNewArray() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " (fred().xyz).zzz(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on primary no new array>"
- );
-}
-/*
- * RelationalExpression ::= RelationalExpression '>' <ShiftExpression>
- */
-public void testRelationalExpressionGreaterThan() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return 1 > fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (1 > <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on relational expression greater than>"
- );
-}
-/*
- * RelationalExpression ::= RelationalExpression '>=' <ShiftExpression>
- */
-public void testRelationalExpressionGreaterThanOrEquals() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return 1 >= fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (1 >= <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on relational expression greater than or equal>"
- );
-}
-/*
- * RelationalExpression ::= RelationalExpression '<' <ShiftExpression>
- */
-public void testRelationalExpressionLessThan() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return 1 < fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (1 < <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on relational expression less than>"
- );
-}
-/*
- * RelationalExpression ::= RelationalExpression '<=' <ShiftExpression>
- */
-public void testRelationalExpressionLessThanOrEqual() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return 1 <= fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (1 <= <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on relational expression less than or equal>"
- );
-}
-/*
- * ReturnStatement ::= 'return' <Expressionopt> ';
- */
-public void testReturnStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " return <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on return statement>"
- );
-}
-/*
- * ShiftExpression ::= ShiftExpression '<<' <AdditiveExpression>
- */
-public void testShiftExpressionLeft() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return i << fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (i << <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on shift expression left>"
- );
-}
-/*
- * ShiftExpression ::= ShiftExpression '>>' <AdditiveExpression>
- */
-public void testShiftExpressionRight() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return i >> fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (i >> <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on shift expression right>"
- );
-}
-/*
- * ShiftExpression ::= ShiftExpression '>>>' <AdditiveExpression>
- */
-public void testShiftExpressionRightUnSigned() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " int foo() { \n" +
- " return i >>> fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " int foo() {\n" +
- " (i >>> <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on shift expression right unsigned>"
- );
-}
-/*
- * StatementExpressionList ::= StatementExpressionList ',' <StatementExpression>
- */
-public void testStatementExpressionList() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " for (int i = 0, length = fred().xyz; i < 2; i++) \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " int length = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on statement expression list>"
- );
-}
-/*
- * SwitchBlockStatement ::= SwitchLabels <BlockStatements>
- */
-public void testSwitchBlockStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " switch (i) { \n" +
- " case 0: fred().xyz = new Foo(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on switch block statement>"
- );
-}
-/*
- * SwitchStatement ::= 'switch' OpenBlock '(' <Expression> ')' SwitchBlock
- */
-public void testSwitchExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " switch (fred().xyz) { \n" +
- " case 0: System.out.println(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on switch expression>"
- );
-}
-/*
- * SwitchLabel ::= 'case' <ConstantExpression> ':'
- */
-public void testSwitchLabel() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " switch (i) { \n" +
- " case fred().xyz: System.out.println(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on switch label>"
- );
-}
-/*
- * SynchronizedStatement ::= OnlySynchronized '(' <Expression> ')' Block
- */
-public void testSynchronizedStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " synchronized (fred().xyz) { \n" +
- " System.out.println(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on synchronized expression>"
- );
-}
-/*
- * ThrowStatement ::= 'throw' <Expression> ';'
- */
-public void testThrowExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " throw fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on throw expression>"
- );
-}
-/*
- * UnaryExpressionNotPlusMinus ::= '~' PushPosition <UnaryExpression>
- */
-public void testUnaryExpressionBitwiseComplement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " i = ~ fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (~ <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on unary expression bitwise complement>"
- );
-}
-/*
- * UnaryExpressionNotPlusMinus ::= '!' PushPosition <UnaryExpression>
- */
-public void testUnaryExpressionLogicalComplement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " i = ! fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (! <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on unary expression logical complement>"
- );
-}
-/*
- * UnaryExpression ::= '-' PushPosition <UnaryExpression>
- */
-public void testUnaryExpressionMinus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " i = - fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (- <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on unary expression minus>"
- );
-}
-/*
- * UnaryExpression ::= '+' PushPosition <UnaryExpression>
- */
-public void testUnaryExpressionPlus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " i = + fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (+ <CompleteOnMemberAccess:fred().x>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on unary expression plus>"
- );
-}
-/*
- * VariableDeclarator ::= VariableDeclaratorId EnterField '=' ForceNoDiet <VariableInitializer> RestoreDiet ExitField
- */
-public void testVariableDeclarator() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on variable declarator>"
- );
-}
-/*
- * VariableInitializers ::= VariableInitializers ',' <VariableInitializer>
- */
-public void testVariableInitializers() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0, j = fred().xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " int j = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on variable initializers>"
- );
-}
-/*
- * WhileStatement ::= 'while' '(' <Expression> ')' Statement
- * or
- * WhileStatementNoShortIf ::= 'while' '(' <Expression> ')' StatementNoShortIf
- */
-public void testWhileExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " while (fred().xyz) \n" +
- " System.out.println(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on while expresion>"
- );
-}
-/*
- * WhileStatement ::= 'while' '(' Expression ')' <Statement>
- * or
- * WhileStatementNoShortIf ::= 'while' '(' Expression ')' <StatementNoShortIf>
- */
-public void testWhileStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " while (true) \n" +
- " fred().xyz = new Foo(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on while statement>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/InnerTypeCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/InnerTypeCompletionTest.java
deleted file mode 100644
index 37fbd32..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/InnerTypeCompletionTest.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be in an inner type
- */
-public class InnerTypeCompletionTest extends AbstractCompletionTest {
-public InnerTypeCompletionTest(String testName) {
- super(testName);
-}
-/*
- * Test completion in the first method of an anonymous inner class
- */
-public void testAnonymousFirstMethod() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Object o = new Object() { \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " void fuzz() { \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " void fuzz() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in anonymous inner class in first method>"
- );
-}
-/*
- * Test completion in anonymous inner class with no statement defined before.
- */
-public void testAnonymousNoStatementBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Object o = new Object() { \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in anonymous inner class with no statement before>"
- );
-}
-/*
- * Test completion in anonymous inner class with one field defined before
- * the method containing the completion.
- */
-public void testAnonymousOneFieldBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Object o = new Object() { \n" +
- " int field = 1; \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " int field;\n" +
- " () {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in anonymous inner class with one field before>"
- );
-}
-/*
- * Test completion in anonymous inner class with one statement defined before.
- */
-public void testAnonymousOneStatementBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 1; \n" +
- " Object o = new Object() { \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in anonymous inner class with one statement before>"
- );
-}
-/*
- * Test completion in the second method of an anonymous inner class
- */
-public void testAnonymousSecondMethod() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Object o = new Object() { \n" +
- " void fuzz() { \n" +
- " } \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void fuzz() {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in anonymous inner class in second method>"
- );
-}
-/*
- * Test completion in the first method of a local type declaration
- */
-public void testLocalTypeFirstMethod() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " class InnerBar { \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " void fuzz() { \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class InnerBar {\n" +
- " InnerBar() {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " void fuzz() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in local type declaration in first method>"
- );
-}
-/*
- * Test completion in local type declaration with no statement defined before.
- */
-public void testLocalTypeNoStatementBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " class InnerBar { \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class InnerBar {\n" +
- " InnerBar() {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in local type declaration with no statement before>"
- );
-}
-/*
- * Test completion in local type declaration with one field defined before
- * the method containing the completion.
- */
-public void testLocalTypeOneFieldBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " class InnerBar { \n" +
- " int field = 1; \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class InnerBar {\n" +
- " int field;\n" +
- " InnerBar() {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in local type declaration with one field before>"
- );
-}
-/*
- * Test completion in local type declaration with one statement defined before.
- */
-public void testLocalTypeOneStatementBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 1; \n" +
- " class InnerBar { \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " class InnerBar {\n" +
- " InnerBar() {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in local type declaration with 1 statement before>"
- );
-}
-/*
- * Test completion in the second method of a local type declaration
- */
-public void testLocalTypeSecondMethod() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " class InnerBar { \n" +
- " void fuzz() { \n" +
- " } \n" +
- " void buzz() { \n" +
- " int i = fred().xyz; \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:fred().x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class InnerBar {\n" +
- " InnerBar() {\n" +
- " }\n" +
- " void fuzz() {\n" +
- " }\n" +
- " void buzz() {\n" +
- " int i = <CompleteOnMemberAccess:fred().x>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete in local type declaration in second method>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LabelStatementCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LabelStatementCompletionTest.java
deleted file mode 100644
index 3da72fa..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LabelStatementCompletionTest.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be in a LabeledStatement.
- */
-public class LabelStatementCompletionTest extends AbstractCompletionTest {
-public LabelStatementCompletionTest(String testName) {
- super(testName);
-}
-/*
- * Completion inside an inner class defined inside a labeled statement.
- */
-public void test1FTEO9L() {
- String cu =
- "package p; \n" +
- " \n" +
- "class CCHelper { \n" +
- " class Member1 { \n" +
- " } \n" +
- " class Member2 { \n" +
- " } \n" +
- " void foo() { \n" +
- " } \n" +
- "} \n" +
- " \n" +
- "public class CC { \n" +
- " void foo() { \n" +
- " new CCHelper() \n" +
- " .new CCHelper() \n" +
- " .new M \n" +
- " } \n" +
- "} \n";
- // first case
- this.runTestCheckMethodParse(
- // compilationUnit:
- cu,
- // completeBehind:
- " .n",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:new CCHelper().n>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "class CCHelper {\n" +
- " class Member1 {\n" +
- " Member1() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " CCHelper() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class CC {\n" +
- " public CC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new CCHelper().n>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "n",
- // expectedReplacedSource:
- "new",
- // test name
- "<regression test 1FTEO9L (first case)>"
- );
- // second case
- this.runTestCheckMethodParse(
- // compilationUnit:
- cu,
- // completeBehind:
- " .new CC",
- // expectedCompletionNodeToString:
- "<CompleteOnType:CC>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "class CCHelper {\n" +
- " class Member1 {\n" +
- " Member1() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " CCHelper() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class CC {\n" +
- " public CC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new CCHelper().new <CompleteOnType:CC>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "CC",
- // expectedReplacedSource:
- "CCHelper",
- // test name
- "<regression test 1FTEO9L (second case)>"
- );
- // third case
- this.runTestCheckMethodParse(
- // compilationUnit:
- cu,
- // completeBehind:
- " .new CCHelper() \n" +
- " .n",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:new CCHelper().new CCHelper().n>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "class CCHelper {\n" +
- " class Member1 {\n" +
- " Member1() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " CCHelper() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class CC {\n" +
- " public CC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMemberAccess:new CCHelper().new CCHelper().n>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "n",
- // expectedReplacedSource:
- "new",
- // test name
- "<regression test 1FTEO9L (third case)>"
- );
- // fourth case
- this.runTestCheckMethodParse(
- // compilationUnit:
- cu,
- // completeBehind:
- " .new CCHelper() \n" +
- " .new M",
- // expectedCompletionNodeToString:
- "<CompleteOnType:M>",
- // expectedUnitDisplayString:
- "package p;\n" +
- "class CCHelper {\n" +
- " class Member1 {\n" +
- " Member1() {\n" +
- " }\n" +
- " }\n" +
- " class Member2 {\n" +
- " Member2() {\n" +
- " }\n" +
- " }\n" +
- " CCHelper() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "public class CC {\n" +
- " public CC() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new CCHelper().new CCHelper().new <CompleteOnType:M>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "M",
- // expectedReplacedSource:
- "M",
- // test name
- "<regression test 1FTEO9L (fourth case)>"
- );
-}
-/*
- * Completion inside a case that has an identifier as its constant expression.
- */
-public void testInCaseWithIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: { \n" +
- " switch (i) { \n" +
- " case a: label2: X o = new Object(); \n" +
- " } \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label1", "label2"},
- // test name
- "<complete in case with identifier>"
- );
-}
-/*
- * Completion inside a case that has a number as its constant expression.
- */
-public void testInCaseWithNumberConstant() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: { \n" +
- " switch (i) { \n" +
- " case 1: label2: X o = new Object(); \n" +
- " } \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label1", "label2"},
- // test name
- "<complete in case with number>"
- );
-}
-/*
- * Completion inside an inner class defined inside a labeled statement.
- */
-public void testInLabeledInnerClass() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: { \n" +
- " Object o = new Object() { \n" +
- " void fred() { \n" +
- " label2: { \n" +
- " X o = new Object(); \n" +
- " } \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void fred() {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label2"},
- // test name
- "<complete in labeled inner class>"
- );
-}
-/*
- * Completion inside an inner class defined inside a labeled statement with a syntax error
- * just before the labeled statement.
- */
-public void testInLabeledInnerClassWithErrorBefore() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i == 2; \n" +
- " label1: { \n" +
- " Object o = new Object() { \n" +
- " void fred() { \n" +
- " label2: { \n" +
- " X o = new Object(); \n" +
- " } \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " Object o;\n" +
- " new Object() {\n" +
- " () {\n" +
- " }\n" +
- " void fred() {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label2"},
- // test name
- "<complete in labeled inner class with syntax error before>"
- );
-}
-/*
- * Completion inside a labeled statement one level deep.
- */
-public void testOneLevelDeep() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: X o = new Object(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label1"},
- // test name
- "<complete in one level deep>"
- );
-}
-/*
- * Completion inside a labeled statement which is the second one in the method.
- */
-public void testSecondLabel() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: buzz(); \n" +
- " label2: X o = new Object(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label2"},
- // test name
- "<complete in second labeled statement>"
- );
-}
-/*
- * Completion inside a labeled statement two level deep.
- */
-public void testTwoLevelDeep() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: { \n" +
- " label2: X o = new Object(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "X",
- // expectedLabels:
- new String[] {"label1", "label2"},
- // test name
- "<complete in two level deep>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java
deleted file mode 100644
index 6d0fbd9..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java
+++ /dev/null
@@ -1,858 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be a MethodInvocation.
- */
-public class MethodInvocationCompletionTest extends AbstractCompletionTest {
-public MethodInvocationCompletionTest(String testName) {
- super(testName);
-}
-/*
- * Completion with no receiver inside a for statement.
- */
-public void test1FVVWS8_1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " for (int i = 10; i > 0; --i) \n" +
- " fred( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnMessageSend:fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<1FVVWS8_1>"
- );
-}
-/*
- * Completion with no receiver inside an if statement.
- */
-public void test1FVVWS8_2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " if (true) \n" +
- " fred( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<1FVVWS8_2>"
- );
-}
-/*
- * Completion with no receiver inside a for statement
- * and after a field access.
- */
-public void test1FW2ZTB_1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " int[] array; \n" +
- " void foo() { \n" +
- " for (int i = this.array.length; i > 0; --i) \n" +
- " fred( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " int[] array;\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnMessageSend:fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<1FW2ZTB_1"
- );
-}
-/*
- * Completion with no receiver inside another message send
- * and after a field access in a previous argument.
- */
-public void test1FW2ZTB_2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " int[] array; \n" +
- " void foo() { \n" +
- " bar(this.array.length, 10, fred( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " int[] array;\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<1FW2ZTB_2"
- );
-}
-/*
- * Complete on method invocation with expression receiver
- * inside another invocation with no receiver.
- */
-public void test1FW35YZ_1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " bar(primary().fred( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:primary().fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:primary().fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<1FW35YZ_1>"
- );
-}
-/*
- * Complete on qualified allocation expression
- * inside an invocation with no receiver.
- */
-public void test1FW35YZ_2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " bar(primary().new X( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X(",
- // expectedCompletionNodeToString:
- "<CompleteOnQualifiedAllocationExpression:primary().new X()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnQualifiedAllocationExpression:primary().new X()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<1FW35YZ_2>"
- );
-}
-/*
- * Completion with primary receiver.
- */
-public void test1FWYBKF() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " this.x.bar( \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "bar(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.x.bar()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.x.bar()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "bar(",
- // test name
- "<1FWYBKF>"
- );
-}
-/*
- * Completion just after a parameter which is a message send.
- */
-public void test1GAJBUQ() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " x.y.Z.fred(buzz()); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(buzz()",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:x.y.Z.fred(buzz())>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:x.y.Z.fred(buzz())>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(buzz()",
- // test name
- "<1GAJBUQ>"
- );
-}
-/*
- * Completion just before the second parameter, the first parameter being an empty
- * anonymous class.
- */
-public void testAfterEmptyAnonymous() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(new Runnable() {}, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(new Runnable() {}, ",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.fred(new Runnable() {\n})>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.fred(new Runnable() {\n" +
- "})>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(new Runnable() {}, ",
- // test name
- "<completion just before second parameter, the first parameter being an empty anonymous class>"
- );
-}
-/*
- * Completion just after the first parameter.
- */
-public void testAfterFirstParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(\"abc\" , 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(\"abc\" ",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.fred(\"abc\")>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.fred(\"abc\")>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(\"abc\" ",
- // test name
- "<completion just after first parameter>"
- );
-}
-/*
- * Completion just before the first parameter.
- */
-public void testBeforeFirstParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(1, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<completion just before first parameter>"
- );
-}
-/*
- * Completion just before the last parameter.
- */
-public void testBeforeLastParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(1, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.fred(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.fred(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(1, 2,",
- // test name
- "<completion just before last parameter>"
- );
-}
-/*
- * Completion just before the second parameter.
- */
-public void testBeforeSecondParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(1, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(1, ",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.fred(1)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.fred(1)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(1, ",
- // test name
- "<completion just before second parameter>"
- );
-}
-/*
- * Completion on empty name inside the expression of the first parameter.
- */
-public void testEmptyInFirstParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(\"abc\" + , 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(\"abc\" +",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (\"abc\" + <CompleteOnName:>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<completion empty in first parameter>"
- );
-}
-/*
- * Completion inside the expression of the first parameter.
- */
-public void testInFirstParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred(\"abc\" + bizz, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(\"abc\" + bi",
- // expectedCompletionNodeToString:
- "<CompleteOnName:bi>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " (\"abc\" + <CompleteOnName:bi>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "bi",
- // expectedReplacedSource:
- "bizz",
- // test name
- "<completion inside first parameter>"
- );
-}
-/*
- * Completion inside an if statement.
- */
-public void testInIfStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " if (true) { \n" +
- " bar.fred(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:bar.fred()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnMessageSend:bar.fred()>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<completion inside a if statement>"
- );
-}
-/*
- * Completion in labeled method invocation with expression receiver.
- */
-public void testLabeledWithExpressionReceiver() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " label1: bar().fred(1, 2, o); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:bar().fred(1, 2)>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:bar().fred(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(1, 2,",
- // expectedLabels:
- new String[] {"label1"},
- // test name
- "<completion in labeled method invocation with expression receiver>"
- );
-}
-/*
- * Completion in labeled method invocation without receiver.
- */
-public void testLabeledWithoutReceiver() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " label1: fred(1, 2, o); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:fred(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:fred(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(1, 2,",
- // expectedLabels:
- new String[] {"label1"},
- // test name
- "<completion in labeled method invocation without receiver>"
- );
-}
-/*
- * MethodInvocation ::= Name '(' ArgumentListopt ')'
- */
-public void testNoReceiver() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " fred(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<completion on method invocation with no receiver>"
- );
-}
-/*
- * Completion just before the first parameter with a space after the open parenthesis.
- */
-public void testSpaceThenFirstParameter() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " this.fred( 1, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred( ",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:this.fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:this.fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred( ",
- // test name
- "<completion just before first parameter with a space after open parenthesis>"
- );
-}
-/*
- * MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
- */
-public void testSuper() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " super.fred(1, 2, i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:super.fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:super.fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<completion on super method invocation>"
- );
-}
-/*
- * Complete on method invocation with expression receiver.
- */
-public void testWithExpressionReceiver() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " bar().fred(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:bar().fred()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:bar().fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // test name
- "<completion on method invocation with expression receiver>"
- );
-}
-/*
- * Completion with a name receiver.
- */
-public void testWithNameReceiver() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Vector v = new Vector(); \n" +
- " v.addElement(\"1\"); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "addElement(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:v.addElement()>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Vector v;\n" +
- " <CompleteOnMessageSend:v.addElement()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "addElement(",
- // test name
- "<completion with name receiver>"
- );
-}
-/*
- * Completion with a name receiver after conditional expression.
- */
-public void testWithNameReceiverAfterConditionalExpression() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " buzz.test(cond ? max : min); \n" +
- " bar.fred(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred(",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:bar.fred()>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnMessageSend:bar.fred()>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(",
- // expectedLabels:
- new String[] {},
- // test name
- "<completion with name receiver after conditional expression>"
- );
-}
-/*
- * Completion with a name receiver and 2 arguments.
- */
-public void testWithNameReceiverAndTwoArgs() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " X x = new X(); \n" +
- " x.fred(1, 2, o); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x.fred(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:x.fred(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X x;\n" +
- " <CompleteOnMessageSend:x.fred(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(1, 2,",
- // test name
- "<completion with name receiver and 2 arguments>"
- );
-}
-/*
- * Completion with a qualified name receiver.
- */
-public void testWithQualifiedNameReceiver() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " X x = new X(); \n" +
- " y.x.fred(1, 2, o); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x.fred(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnMessageSend:y.x.fred(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X x;\n" +
- " <CompleteOnMessageSend:y.x.fred(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "fred(1, 2,",
- // test name
- "<completion with qualified name receiver>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
deleted file mode 100644
index 4e8e309..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
+++ /dev/null
@@ -1,927 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be a name reference.
- */
-public class NameReferenceCompletionTest extends AbstractCompletionTest {
-public NameReferenceCompletionTest(String testName) {
- super(testName);
-}
-/*
- * Regression test for 1FTZ849.
- * The instance creation before the completion is not properly closed, and thus
- * the completion parser used to think the completion was on a type.
- */
-public void test1FTZ849() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " X o = new X; \n" +
- " fred.xyz; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "fred.x",
- // expectedCompletionNodeToString:
- "<CompleteOnName:fred.x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X o;\n" +
- " <CompleteOnName:fred.x>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "fred.xyz",
- // test name
- "<1FTZ849>"
- );
-}
-/*
- * Completion in a field initializer with no syntax error.
- */
-public void test1FUUP73() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class A { \n" +
- " String s = \"hello\"; \n" +
- " Object o = s.concat(\"boo\"); \n",
- // completeBehind:
- "Object o = s",
- // expectedCompletionNodeToString:
- "<CompleteOnName:s>",
- // expectedUnitDisplayString:
- "public class A {\n" +
- " String s;\n" +
- " Object o = <CompleteOnName:s>;\n" +
- " public A() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "s",
- // expectedReplacedSource:
- "s",
- // test name
- "<1FUUP73>"
- );
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class A { \n" +
- " String s = \"hello\"; \n" +
- " Object o = s.concat(\"boo\"); \n",
- // completeBehind:
- "Object o = s.c",
- // expectedCompletionNodeToString:
- "<CompleteOnName:s.c>",
- // expectedUnitDisplayString:
- "public class A {\n" +
- " String s;\n" +
- " Object o = <CompleteOnName:s.c>;\n" +
- " public A() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "c",
- // expectedReplacedSource:
- "s.concat",
- // test name
- "<1FUUP73>"
- );
-}
-/*
- * Regression test for 1FVRQQA.
- */
-public void test1FVRQQA_1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " Enumeration e = null; \n" +
- " e.to \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "e.to",
- // expectedCompletionNodeToString:
- "<CompleteOnName:e.to>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Enumeration e;\n" +
- " <CompleteOnName:e.to>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "to",
- // expectedReplacedSource:
- "e.to",
- // test name
- "<1FVRQQA_1>"
- );
-}
-/*
- * Regression test for 1FVRQQA.
- */
-public void test1FVRQQA_2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " for (Enumeration e = getSomeEnumeration(); e.has \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "e.has",
- // expectedCompletionNodeToString:
- "<CompleteOnName:e.has>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Enumeration e;\n" +
- " <CompleteOnName:e.has>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "has",
- // expectedReplacedSource:
- "e.has",
- // test name
- "<1FVRQQA_2>"
- );
-}
-/*
- * Regression test for 1FVT66Q.
- */
-public void test1FVT66Q_1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package test; \n" +
- " \n" +
- "public class Test { \n" +
- " public void foo() { \n" +
- " final int codeAssistTarget= 3; \n" +
- " \n" +
- " Thread t= new Thread() { \n" +
- " public void run() { \n" +
- " codeAss \n" +
- " } \n" +
- " }; \n" +
- " codeA \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- " codeAss",
- // expectedCompletionNodeToString:
- "<CompleteOnName:codeAss>",
- // expectedUnitDisplayString:
- "package test;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " final int codeAssistTarget;\n" +
- " Thread t;\n" +
- " new Thread() {\n" +
- " () {\n" +
- " }\n" +
- " public void run() {\n" +
- " <CompleteOnName:codeAss>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "codeAss",
- // expectedReplacedSource:
- "codeAss",
- // test name
- "<1FVT66Q_1>"
- );
-}
-/*
- * Regression test for 1FVT66Q.
- */
-public void test1FVT66Q_2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package test; \n" +
- " \n" +
- "public class Test { \n" +
- " public void foo() { \n" +
- " final int codeAssistTarget= 3; \n" +
- " \n" +
- " Thread t= new Thread() { \n" +
- " public void run() { \n" +
- " codeAss \n" +
- " } \n" +
- " }; \n" +
- " codeA \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "\n codeA",
- // expectedCompletionNodeToString:
- "<CompleteOnName:codeA>",
- // expectedUnitDisplayString:
- "package test;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " final int codeAssistTarget;\n" +
- " Thread t;\n" +
- " <CompleteOnName:codeA>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "codeA",
- // expectedReplacedSource:
- "codeA",
- // test name
- "<1FVT66Q_2>"
- );
-}
-/*
- * Regression test for 1G8DE30.
- */
-public void test1G8DE30() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new Runnable() { \n" +
- " public void run() { \n" +
- " Bar \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "public void run() { \n ",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Runnable() {\n" +
- " () {\n" +
- " }\n" +
- " public void run() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<1G8DE30>"
- );
-}
-/*
- * Completion on an empty name reference.
- */
-public void testEmptyNameReference() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int i = 0; \n ",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on empty name reference>"
- );
-}
-/*
- * Completion on an empty name reference after a cast.
- */
-public void testEmptyNameReferenceAfterCast() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " X x = (X) \n" +
- " \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "(X)",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X x = (X) <CompleteOnName:>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on empty name reference after cast>"
- );
-}
-/*
- * Completion on an empty name reference after + operator.
- */
-public void testEmptyNameReferenceAfterPlus() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " 1 + \n" +
- " \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "1 +",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on empty name reference after + operator>"
- );
-}
-/*
- * Completion on an empty name reference in an array dimension.
- */
-public void testEmptyNameReferenceInArrayDim() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " int[] \n" +
- " \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int[",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on empty name reference in array dim>"
- );
-}
-/*
- * Completion on an empty name reference in inner class.
- */
-public void testEmptyNameReferenceInInnerClass() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " class Y { \n" +
- " void bar() { \n" +
- " \n" +
- " } \n" +
- " } \n" +
- " \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "\n ",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void bar() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on empty name reference in inner class>"
- );
-}
-/*
- * Completion in the statement following an if expression.
- */
-public void testInIfThenStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (bar()) \n" +
- " \n" +
- " \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "\n ",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete in if then statement>"
- );
-}
-/*
- * Completion on a name reference inside an inner class in a field initializer.
- */
-public void testInnerClassFieldInitializer() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " Object o = new Object() { \n" +
- " void foo() { \n" +
- " xyz \n" +
- " } \n" +
- " }; \n" +
- "} \n",
- // completeBehind:
- "xyz",
- // expectedCompletionNodeToString:
- "<CompleteOnName:xyz>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Object o = new Object() {\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:xyz>;\n" +
- " }\n" +
- " };\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "xyz",
- // expectedReplacedSource:
- "xyz",
- // test name
- "<complete on name reference in inner class in field initializer>"
- );
-}
-/*
- * Completion on an empty name reference inside an invocation in a field initializer.
- */
-public void testInvocationFieldInitializer() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " String s = fred(1 + ); \n" +
- " void foo() { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "(1 + ",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " String s = (1 + <CompleteOnName:>);\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on empty name reference in invocation in field initializer>"
- );
-}
-/*
- * Completion inside an anonymous inner class which is
- * inside a method invocation with receiver.
- */
-public void testMethodInvocationAnonymousInnerClass() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " primary().bizz( \n" +
- " new X() { \n" +
- " void fuzz() { \n" +
- " x.y.z \n" +
- " } \n" +
- " } \n" +
- " ); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x.",
- // expectedCompletionNodeToString:
- "<CompleteOnName:x.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new X() {\n" +
- " () {\n" +
- " }\n" +
- " void fuzz() {\n" +
- " <CompleteOnName:x.>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "x.",
- // test name
- "<complete inside anonymous inner class inside method invocation 1>"
- );
-}
-/*
- * Completion on a qualified name reference, where the cursor is in the
- * first type reference.
- */
-public void testQualifiedNameReferenceShrinkAll() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " a.b.c.Xxx o = new Y(i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- " a",
- // expectedCompletionNodeToString:
- "<CompleteOnName:a>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnName:a>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "a",
- // expectedReplacedSource:
- "a",
- // test name
- "<complete on qualified name reference (shrink all)>"
- );
-}
-/*
- * Completion on a qualified name reference, where the cursor is right after the first dot.
- */
-public void testQualifiedNameReferenceShrinkAllButOne() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " static Bar x; \n" +
- " public class InnerBar { \n" +
- " } \n" +
- " public class SubInnerBar extends InnerBar { \n" +
- " SubInnerBar() { \n" +
- " Bar.x.x.super(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "Bar.",
- // expectedCompletionNodeToString:
- "<CompleteOnName:Bar.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " public InnerBar() {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " super();\n" +
- " <CompleteOnName:Bar.>;\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "Bar.",
- // test name
- "<complete on qualified name reference (shrink all but one)>"
- );
-}
-/*
- * Completion on a qualified name reference, where the cursor is right after the first dot.
- */
-public void testQualifiedNameReferenceShrinkAllButOne2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " a.b.c.X o = new Y(i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- " a.",
- // expectedCompletionNodeToString:
- "<CompleteOnName:a.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnName:a.>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "a.",
- // test name
- "<complete on qualified name reference (shrink all but one) 2>"
- );
-}
-/*
- * Completion on a qualified name reference,where the cursor is right after the end
- * of the last name reference.
- */
-public void testQualifiedNameReferenceShrinkNone() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " static Bar x; \n" +
- " public class InnerBar { \n" +
- " } \n" +
- " public class SubInnerBar extends InnerBar { \n" +
- " SubInnerBar() { \n" +
- " Bar.x.x.super(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "Bar.x.x",
- // expectedCompletionNodeToString:
- "<CompleteOnName:Bar.x.x>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " public InnerBar() {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " super();\n" +
- " <CompleteOnName:Bar.x.x>;\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "x",
- // expectedReplacedSource:
- "Bar.x.x",
- // test name
- "<complete on qualified name reference (shrink none)>"
- );
-}
-/*
- * Completion on a qualified name reference, where the cursor is right after the end
- * of the last type reference.
- */
-public void testQualifiedNameReferenceShrinkNone2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " a.b.c.Xxx o = new Y(i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:a.b.c.X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnName:a.b.c.X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "a.b.c.Xxx",
- // test name
- "<complete on qualified name reference (shrink none) 2>"
- );
-}
-/*
- * Completion on a qualified name reference, where the cursor is right after the
- * last dot.
- */
-public void testQualifiedNameReferenceShrinkOne() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " static Bar x; \n" +
- " public class InnerBar { \n" +
- " } \n" +
- " public class SubInnerBar extends InnerBar { \n" +
- " SubInnerBar() { \n" +
- " Bar.x.x.super(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "Bar.x.",
- // expectedCompletionNodeToString:
- "<CompleteOnName:Bar.x.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " public class InnerBar {\n" +
- " public InnerBar() {\n" +
- " }\n" +
- " }\n" +
- " public class SubInnerBar extends InnerBar {\n" +
- " SubInnerBar() {\n" +
- " super();\n" +
- " <CompleteOnName:Bar.x.>;\n" +
- " }\n" +
- " }\n" +
- " static Bar x;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "Bar.x.",
- // test name
- "<complete on qualified name reference (shrink one)>"
- );
-}
-/*
- * Completion on a qualified name reference, where the cursor is right after the
- * last dot.
- */
-public void testQualifiedNameReferenceShrinkOne2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " a.b.c.X o = new Y(i); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "a.b.c.",
- // expectedCompletionNodeToString:
- "<CompleteOnName:a.b.c.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnName:a.b.c.>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "a.b.c.",
- // test name
- "<complete on qualified name reference (shrink one) 2>"
- );
-}
-/*
- * Completion on a qualified name reference that contains a unicode.
- */
-public void testUnicode() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class X { \n" +
- " void foo() { \n" +
- " bar.\\u005ax \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x",
- // expectedCompletionNodeToString:
- "<CompleteOnName:bar.Zx>",
- // expectedUnitDisplayString:
- "class X {\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:bar.Zx>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "Zx",
- // expectedReplacedSource:
- "bar.\\u005ax",
- // test name
- "<complete on unicode>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
deleted file mode 100644
index 3be3655..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
+++ /dev/null
@@ -1,1539 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-/**
- * Completion is expected to be a ReferenceType.
- */
-public class ReferenceTypeCompletionTest extends AbstractCompletionTest {
-public ReferenceTypeCompletionTest(String testName) {
- super(testName);
-}
-/*
- * Regression test for 1FTZCIG.
- */
-public void test1FTZCIG() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new X() { \n" +
- " protected void bar() { \n" +
- " } \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "p",
- // expectedCompletionNodeToString:
- "<CompleteOnType:p>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new X() {\n" +
- " <CompleteOnType:p>;\n" +
- " () {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "p",
- // expectedReplacedSource:
- "protected",
- // test name
- "<1FTZCIG>"
- );
-}
-/*
- * Block ::= OpenBlock '{' <BlockStatementsopt> '}'
- */
-public void testBlock() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " try { \n" +
- " Xxx o = new Y(); \n" +
- " } catch (Exception e) { \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on block>"
- );
-}
-/*
- * BlockStatements ::= BlockStatements <BlockStatement>
- */
-public void testBlockStatements() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " Xxx o = new Y(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on block statements>"
- );
-}
-/*
- * CatchClause ::= 'catch' '(' <FormalParameter> ')' Block
- */
-public void testCatchClause1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " try { \n" +
- " fred(); \n" +
- " } catch (Xxx e) { \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnException:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnException:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on catch clause 1>"
- );
-}
-/*
- * CatchClause ::= 'catch' '(' <FormalParameter> ')' Block
- */
-public void testCatchClause2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " try { \n" +
- " fred(); \n" +
- " } catch (final Xxx e) { \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnException:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnException:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on catch clause 2>"
- );
-}
-/*
- * CatchClause ::= 'catch' '(' <FormalParameter> ')' Block
- */
-public void testCatchClause3() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " try { \n" +
- " fred(); \n" +
- " } catch (x.y.Xxx e) { \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "x.y.X",
- // expectedCompletionNodeToString:
- "<CompleteOnException:x.y.X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnException:x.y.X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "x.y.Xxx",
- // test name
- "<complete on catch clause 3>"
- );
-}
-/*
- * ClassBody ::= '{' <ClassBodyDeclarationsopt> '}'
- */
-public void testClassBody() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " Xxx foo() { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " <CompleteOnType:X>\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class body>"
- );
-}
-/*
- * ClassBodyDeclarations ::= ClassBodyDeclarations <ClassBodyDeclaration>
- */
-public void testClassBodyDeclarations() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " int i = 0; \n" +
- " Xxx foo() { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " int i;\n" +
- " Bar() {\n" +
- " }\n" +
- " <CompleteOnType:X>\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class body declarations>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= 'new' <ClassType> '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpression1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new Xxx().zzz(); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new <CompleteOnType:X>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression 1>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= 'new' <ClassType> '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpression2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new Y(new Xxx()).zzz(); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Y(new <CompleteOnType:X>());\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression 2>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= 'new' <ClassType> '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpression3() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new Y(1, true, new Xxx()).zzz(); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Y(1, true, new <CompleteOnType:X>());\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression 3>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= 'new' <ClassType> '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpression4() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " fred().new Y(new Xxx()).zzz(); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " fred().new Y(new <CompleteOnType:X>());\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression 4>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionName1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " static Bar baz; \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " Bar.baz.new Xxx(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " Bar.baz.new <CompleteOnType:X>();\n" +
- " }\n" +
- " }\n" +
- " static Bar baz;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with name 1>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionName2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " static Bar baz; \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " new Y(Bar.baz.new Xxx()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Y(Bar.baz.new <CompleteOnType:X>());\n" +
- " }\n" +
- " }\n" +
- " static Bar baz;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with name 2>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionName3() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " static Bar baz; \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " new Y(1, true, Bar.baz.new Xxx()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Y(1, true, Bar.baz.new <CompleteOnType:X>());\n" +
- " }\n" +
- " }\n" +
- " static Bar baz;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with name 3>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionName4() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " static Bar baz; \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " fred().new Y(Bar.baz.new Xxx()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " fred().new Y(Bar.baz.new <CompleteOnType:X>());\n" +
- " }\n" +
- " }\n" +
- " static Bar baz;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with name 4>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionPrimary1() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " new Bar().new Xxx(); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Bar().new <CompleteOnType:X>();\n" +
- " }\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with primary 1>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionPrimary2() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " new Y(new Bar().new Xxx()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Y(new Bar().new <CompleteOnType:X>());\n" +
- " }\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with primary 2>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionPrimary3() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " fred().new Y(new Bar().new Xxx()); \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " fred().new Y(new Bar().new <CompleteOnType:X>());\n" +
- " }\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with primary 3>"
- );
-}
-/*
- * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testClassInstanceCreationExpressionPrimary4() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "public class Bar { \n" +
- " public class X { \n" +
- " void foo() { \n" +
- " new Y(1, true, new Bar().new Xxx());\n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "new X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "public class Bar {\n" +
- " public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " new Y(1, true, new Bar().new <CompleteOnType:X>());\n" +
- " }\n" +
- " }\n" +
- " public Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class instance creation expression with primary 4>"
- );
-}
-/*
- * ClassTypeList ::= ClassTypeList ',' <ClassTypeElt>
- */
-public void testClassTypeList() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() throws Exception, Xxx { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnException:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() throws Exception, <CompleteOnException:X> {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on class type list>"
- );
-}
-/*
- * ConstructorBody ::= NestedMethod '{' <BlockStatementsopt> '}'
- */
-public void testConstructorBody() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar() { \n" +
- " Xxx o = new Y(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " super();\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on constructor body>"
- );
-}
-/*
- * ConstructorDeclarator ::= 'Identifier' '(' <FormalParameterListopt> ')'
- */
-public void testConstructorDeclarator() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " Bar(Xxx o) { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar(<CompleteOnType:X> o) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on constructor declarator>"
- );
-}
-/*
- * The reference type is burried in several blocks
- */
-public void testDeepReference() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (a == 2) { \n" +
- " } \n" +
- " try { \n" +
- " } finally { \n" +
- " if (1 == fgh) { \n" +
- " Xxx o = null; \n" +
- " } \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on deep type>"
- );
-}
-/*
- * Super ::= 'extends' <ClassType>
- */
-public void testExtendsClass() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar extends Xxx { \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnClass:X>",
- // expectedUnitDisplayString:
- "class Bar extends <CompleteOnClass:X> {\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on extends>"
- );
-}
-/*
- * ExtendsInterfaces ::= 'extends' <InterfaceTypeList>
- */
-public void testExtendsInterface() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "interface Bar extends Xxx { \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnInterface:X>",
- // expectedUnitDisplayString:
- "interface Bar extends <CompleteOnInterface:X> {\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on extends>"
- );
-}
-/*
- * FieldDeclaration ::= Modifiersopt <Type> VariableDeclarators ';'
- * where Modifiersopt is not empty
- */
-public void testFieldDeclarationWithModifiers() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " public final Xxx foo; \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " <CompleteOnType:X>;\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on field declaration with modifiers>"
- );
-}
-/*
- * FieldDeclaration ::= Modifiersopt <Type> VariableDeclarators ';'
- * where Modifiersopt is empty
- */
-public void testFieldDeclarationWithoutModifiers() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " Xxx foo; \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " <CompleteOnType:X>;\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on field declaration without modifiers>"
- );
-}
-/*
- * FormalParameter ::= Modifiers <Type> VariableDeclaratorId
- */
-public void testFormalParameter() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo(final Xxx x) { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo(final <CompleteOnType:X> x) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on formal parameter>"
- );
-}
-/*
- * FormalParameterList ::= FormalParameterList ',' <FormalParameter>
- */
-public void testFormalParameterList() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo(int i, final Object o, Xxx x) {\n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo(int i, final Object o, <CompleteOnType:X> x) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on formal parameter list>"
- );
-}
-/*
- * ForStatement ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' Statement
- * or
- * ForStatementNoShortIf ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf
- */
-public void testForStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " for (Xxx o = new Y(); o.size() < 10; ) {\n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on for statement>"
- );
-}
-/*
- * Interfaces ::= 'implements' <InterfaceTypeList>
- */
-public void testImplements() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar implements Xxx { \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnInterface:X>",
- // expectedUnitDisplayString:
- "class Bar implements <CompleteOnInterface:X> {\n" +
- " Bar() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on implements>"
- );
-}
-/*
- * RelationalExpression ::= RelationalExpression 'instanceof' <ReferenceType>
- */
-public void testInstanceOf() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " boolean foo() { \n" +
- " return this instanceof Xxx; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " boolean foo() {\n" +
- " (this instanceof <CompleteOnType:X>);\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on instanceof>"
- );
-}
-/*
- * InterfaceBody ::= '{' <InterfaceMemberDeclarationsopt> '}'
- */
-public void testInterfaceBody() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "interface Bar { \n" +
- " Xxx foo(); \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "interface Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " <CompleteOnType:X>\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on interface body>"
- );
-}
-/*
- * InterfaceMemberDeclarations ::= InterfaceMemberDeclarations <InterfaceMemberDeclaration>
- */
-public void testInterfaceMemberDeclarations() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "interface Bar { \n" +
- " int CONSTANT = 0; \n" +
- " Xxx foo(); \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "interface Bar {\n" +
- " int CONSTANT;\n" +
- " Bar() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " <CompleteOnType:X>\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on interface member declarations>"
- );
-}
-/*
- * InterfaceTypeList ::= InterfaceTypeList ',' <InterfaceType>
- */
-public void testInterfaceTypeList() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "interface Bar extends Comparable, Xxx { \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnInterface:X>",
- // expectedUnitDisplayString:
- "interface Bar extends Comparable, <CompleteOnInterface:X> {\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on interface list>"
- );
-}
-/*
- * LocalVariableDeclaration ::= Modifiers <Type> VariableDeclarators
- */
-public void testLocalVariableDeclaration() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " final Xxx o = new Y(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on local variable declaration>"
- );
-}
-/*
- * MethodBody ::= NestedMethod '{' <BlockStatementsopt> '}'
- */
-public void testMethodBody() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " Xxx o = new Y(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on method body>"
- );
-}
-/*
- * MethodDeclarator ::= 'Identifier' '(' <FormalParameterListopt> ')' Dimsopt
- */
-public void testMethodDeclarator() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo(Xxx o) { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo(<CompleteOnType:X> o) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on method declarator>"
- );
-}
-/*
- * MethodHeader ::= Modifiersopt <Type> MethodDeclarator Throwsopt
- * where Modifiersopt is not empty
- */
-public void testMethodHeaderWithModifiers() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " public static Xxx foo() { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " <CompleteOnType:X>\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on method header with modifiers>"
- );
-}
-/*
- * MethodHeader ::= Modifiersopt <Type> MethodDeclarator Throwsopt
- * where Modifiersopt is empty
- */
-public void testMethodHeaderWithoutModifiers() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " Xxx foo() { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " <CompleteOnType:X>\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on method header without modifiers>"
- );
-}
-/*
- * Completion on a qualified type reference, where the cursor is in the
- * first type reference.
- */
-public void testQualifiedTypeReferenceShrinkAll() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " new a.b.c.Xxx(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- " new a",
- // expectedCompletionNodeToString:
- "<CompleteOnType:a>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " new <CompleteOnType:a>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "a",
- // expectedReplacedSource:
- "a",
- // test name
- "<complete on qualified type reference (shrink all)>"
- );
-}
-/*
- * Completion on a qualified type reference, where the cursor is right after the first dot.
- */
-public void testQualifiedTypeReferenceShrinkAllButOne() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " new a.b.c.Xxx(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "a.",
- // expectedCompletionNodeToString:
- "<CompleteOnType:a.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " new <CompleteOnType:a.>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "a.",
- // test name
- "<complete on qualified type reference (shrink all but one)>"
- );
-}
-/*
- * Completion on a qualified type reference, where the cursor is right after the end
- * of the last type reference.
- */
-public void testQualifiedTypeReferenceShrinkNone() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " new a.b.c.Xxx(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnType:a.b.c.X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " new <CompleteOnType:a.b.c.X>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "a.b.c.Xxx",
- // test name
- "<complete on qualified type reference (shrink none)>"
- );
-}
-/*
- * Completion on a qualified type reference, where the cursor is right after the
- * last dot.
- */
-public void testQualifiedTypeReferenceShrinkOne() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 0; \n" +
- " new a.b.c.Xxx(); \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "a.b.c.",
- // expectedCompletionNodeToString:
- "<CompleteOnType:a.b.c.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " new <CompleteOnType:a.b.c.>();\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "a.b.c.",
- // test name
- "<complete on qualified type reference (shrink one)>"
- );
-}
-/*
- * SwitchBlockStatement ::= SwitchLabels <BlockStatements>
- */
-public void testSwitchBlockStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int i = 1; \n" +
- " switch (i) { \n" +
- " case 1: \n" +
- " Xxx o = fred(i); \n" +
- " break; \n" +
- " default: \n" +
- " } \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnName:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " int i;\n" +
- " {\n" +
- " <CompleteOnName:X>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on switch block statement>"
- );
-}
-/*
- * Throws ::= 'throws' <ClassTypeList>
- */
-public void testThrows() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() throws Xxx { \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "X",
- // expectedCompletionNodeToString:
- "<CompleteOnException:X>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() throws <CompleteOnException:X> {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "X",
- // expectedReplacedSource:
- "Xxx",
- // test name
- "<complete on throws>"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java
deleted file mode 100644
index ceb2810..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java
+++ /dev/null
@@ -1,2162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class SelectionTest extends AbstractSelectionTest {
-public SelectionTest(String testName) {
- super(testName);
-}
-/*
- * Select superclass
- */
-public void test01() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- "} \n";
-
- String selectionStartBehind = "extends ";
- String selectionEndBehind = "IOException";
-
- String expectedCompletionNodeToString = "<SelectOnType:IOException>";
- String completionIdentifier = "IOException";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends <SelectOnType:IOException> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "IOException";
- String testName = "<select superclass>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.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 = "<SelectOnType:Serializable>";
- String completionIdentifier = "Serializable";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException implements <SelectOnType:Serializable> {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "Serializable";
- String testName = "<select superinterface>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Select qualified superclass
- */
-public void test03() {
-
- String str =
- "public class X extends java.io.IOException { \n" +
- "} \n";
-
- String selectionStartBehind = "java.io.";
- String selectionEndBehind = "IOException";
-
- String expectedCompletionNodeToString = "<SelectOnType:java.io.IOException>";
- String completionIdentifier = "IOException";
- String expectedUnitDisplayString =
- "public class X extends <SelectOnType:java.io.IOException> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOException";
- String testName = "<select qualified superclass>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.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 = "<SelectOnType:java.io>";
- String completionIdentifier = "io";
- String expectedUnitDisplayString =
- "public class X extends <SelectOnType:java.io> {\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.io.IOException";
- String testName = "<select package from qualified superclass>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Select message send
- */
-public void test05() {
-
- String str =
- "public class X extends java.io.IOException { \n" +
- " int foo(){ \n" +
- " System.out.println(\"hello\"); \n";
-
- String selectionStartBehind = "System.out.";
- String selectionEndBehind = "println";
-
- String expectedCompletionNodeToString = "<SelectOnMessageSend:System.out.println(\"hello\")>";
- String completionIdentifier = "println";
- String expectedUnitDisplayString =
- "public class X extends java.io.IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnMessageSend:System.out.println(\"hello\")>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "System.out.println(\"hello\")";
- String testName = "<select message send>";
-
- 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 = "<SelectOnMessageSend:System.out.println(\"hello\")>";
- String completionIdentifier = "println";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnMessageSend:System.out.println(\"hello\")>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "System.out.println(\"hello\")";
- String testName = "<select message send with recovery before>";
-
- 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 sibling method
- */
-public void test07() {
-
- String str =
- "public class X extends \n" +
- " int foo(){ \n" +
- " this.bar(\"hello\"); \n" +
- " int bar(String s){ \n" +
- " return s.length(); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "this.";
- String selectionEndBehind = "this.bar";
-
- String expectedCompletionNodeToString = "<SelectOnMessageSend:this.bar(\"hello\")>";
- String completionIdentifier = "bar";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnMessageSend:this.bar(\"hello\")>;\n" +
- " }\n" +
- " int bar(String s) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "this.bar(\"hello\")";
- String testName = "<select message send with sibling method>";
-
- 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 = "<SelectionOnFieldReference:this.num>";
- String completionIdentifier = "num";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " int num;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " int j = <SelectionOnFieldReference:this.num>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "this.num";
- String testName = "<select field reference>";
-
- 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 with syntax errors
- */
-public void test09() {
-
- String str =
- "public class X \n" +
- " int num \n" +
- " int foo(){ \n" +
- " int j = this.num; \n" +
- "} \n";
-
- String selectionStartBehind = "this.";
- String selectionEndBehind = "this.num";
-
- String expectedCompletionNodeToString = "<SelectionOnFieldReference:this.num>";
- String completionIdentifier = "num";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " int num;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " int j = <SelectionOnFieldReference:this.num>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "this.num";
- String testName = "<select field reference with syntax errors>";
-
- 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 = "<SelectionOnFieldReference:this.x>";
- String completionIdentifier = "x";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " X x;\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " int j = <SelectionOnFieldReference:this.x>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "this.x";
- String testName = "<select field reference inside message receiver>";
-
- 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 allocation
- */
-public void test11() {
-
- String str =
- "public class X { \n" +
- " X(int i){} \n" +
- " int foo(){ \n" +
- " int j = 0; \n" +
- " X x = new X(j); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "new ";
- String selectionEndBehind = "new X";
-
- String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new X(j)>";
- String completionIdentifier = "X";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " X(int i) {\n" +
- " }\n" +
- " int foo() {\n" +
- " int j;\n" +
- " X x = <SelectOnAllocationExpression:new X(j)>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new X(j)";
- String testName = "<select allocation>";
-
- 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 = "<SelectOnQualifiedAllocationExpression:x.new Y(1)>";
- 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" +
- " <SelectOnQualifiedAllocationExpression:x.new Y(1)>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "x.new Y(1)";
- String testName = "<select qualified allocation>";
-
- 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 receiver
- */
-public void test13() {
-
- String str =
- "public class X { \n" +
- " int foo(){ \n" +
- " java.lang.System.out.println(); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "java.lang.";
- String selectionEndBehind = "java.lang.System";
-
- String expectedCompletionNodeToString = "<SelectOnName:java.lang.System>";
- String completionIdentifier = "System";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnName:java.lang.System>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.lang.System.out";
- String testName = "<select qualified name receiver>";
-
- 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 = "<SelectOnName:java.lang.System>";
- String completionIdentifier = "System";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " System sys = <SelectOnName:java.lang.System>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "java.lang.System";
- String testName = "<select qualified name>";
-
- 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 with modifier
- */
-public void test15() {
-
- String str =
- "public class X { \n" +
- " int foo(){ \n" +
- " final System sys = null; \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "final ";
- String selectionEndBehind = "final System";
-
- String expectedCompletionNodeToString = "<SelectOnType:System>";
- String completionIdentifier = "System";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " final <SelectOnType:System> sys;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "System";
- String testName = "<select variable type with modifier>";
-
- 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 = "<SelectOnType:System>";
- String completionIdentifier = "System";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnType:System> sys;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "System";
- String testName = "<select variable type>";
-
- 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 name
- */
-public void test17() {
-
- String str =
- "public class X { \n" +
- " int foo(){ \n" +
- " System \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "\n ";
- String selectionEndBehind = "\n System";
-
- String expectedCompletionNodeToString = "<SelectOnName:System>";
- String completionIdentifier = "System";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnName:System>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "System";
- String testName = "<select name>";
-
- 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 =
- "<SelectOnAllocationExpression:new Object() {\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- "}>";
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " <SelectOnAllocationExpression:new Object() {\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- " }>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "new Object()";
- String testName = "<select anonymous type>";
-
- 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 cast type
- */
-public void test19() {
-
- String str =
- "public class X { \n" +
- " Object foo(){ \n" +
- " return (Object) this; \n" +
- " } \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "return (";
- String selectionEndBehind = "return (Object";
-
- String expectedCompletionNodeToString = "<SelectOnName:Object>";
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " Object foo() {\n" +
- " <SelectOnName:Object>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "Object";
- String testName = "<select cast type>";
-
- 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 = "<SelectOnPackage:x.y>";
- String completionIdentifier = "y";
- String expectedUnitDisplayString =
- "package <SelectOnPackage:x.y>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "x.y.other";
- String testName = "<select package>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Select import
- */
-public void test21() {
-
- 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 = "<SelectOnImport:x.y.Other>";
- String completionIdentifier = "Other";
- String expectedUnitDisplayString =
- "import <SelectOnImport:x.y.Other>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "x.y.Other";
- String testName = "<select import>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.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 = "<SelectOnImport:x.y.other>";
- String completionIdentifier = "other";
- String expectedUnitDisplayString =
- "import <SelectOnImport:x.y.other>;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "x.y.other";
- String testName = "<select import on demand>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Select array initializer type
- */
-public void test23() {
-
- String str =
- "public class X { \n" +
- " int foo(){ \n" +
- " String[] p = new String[]{\"Left\"};\n" +
-// " } \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "new ";
- String selectionEndBehind = "new String";
- String expectedCompletionNodeToString = "<SelectOnType:String>";
- String completionIdentifier = "String";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " String[] p = <SelectOnType:String>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "String";
- String testName = "<select array initializer type>";
-
- 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 = "<SelectOnType:G>";
-
- String completionIdentifier = "G";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " public G() {\n" +
- " }\n" +
- " void foo() {\n" +
- " class X {\n" +
- " class Y extends <SelectOnType:G> {\n" +
- " Y() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " X() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "G";
- String testName = "<select nested type superclass>";
-
- 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
- */
-public void test25() {
-
- String str =
- "public class G { \n" +
- " Object foo() { \n" +
- " return super.foo(); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "return ";
- String selectionEndBehind = "return super";
-
- String expectedCompletionNodeToString = "<SelectOnSuper:super>";
-
- String completionIdentifier = "super";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " public G() {\n" +
- " }\n" +
- " Object foo() {\n" +
- " <SelectOnSuper:super>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "super";
- String testName = "<select super>";
-
- 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 = "<SelectOnQualifiedSuper:G.super>";
-
- String completionIdentifier = "super";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " public G() {\n" +
- " }\n" +
- " Object foo() {\n" +
- " new X() {\n" +
- " () {\n" +
- " }\n" +
- " Object bar() {\n" +
- " <SelectOnQualifiedSuper:G.super>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "G.super";
- String testName = "<select qualified super>";
-
- 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
- */
-public void test27() {
-
- String str =
- "public class G { \n" +
- " G() { \n" +
- " super(); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "\n\t\t";
- String selectionEndBehind = "super";
-
- String expectedCompletionNodeToString = "<SelectOnExplicitConstructorCall:super()>";
-
- String completionIdentifier = "super";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " G() {\n" +
- " <SelectOnExplicitConstructorCall:super()>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "super()";
- String testName = "<select super constructor call>";
-
- 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 = "<SelectOnExplicitConstructorCall:new G().super()>";
-
- 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" +
- " <SelectOnExplicitConstructorCall:new G().super()>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new G().super()";
- String testName = "<select qualified super constructor call>";
-
- 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 with arguments
- */
-public void test29() {
-
- String str =
- "public class G { \n" +
- " class M {} \n" +
- " static Object foo() { \n" +
- " class X extends M { \n" +
- " X (){ \n" +
- " new G().super(23 + \"hello\"); \n" +
- " } \n" +
- " } \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "new G().";
- String selectionEndBehind = "new G().super";
-
- String expectedCompletionNodeToString = "<SelectOnExplicitConstructorCall:new G().super((23 + \"hello\"))>";
-
- 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" +
- " <SelectOnExplicitConstructorCall:new G().super((23 + \"hello\"))>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new G().super(23 + \"hello\")";
- String testName = "<select qualified super constructor call with arguments>";
-
- 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 = "<SelectOnExplicitConstructorCall:super(new G())>";
-
- String completionIdentifier = "super";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " G() {\n" +
- " <SelectOnExplicitConstructorCall:super(new G())>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "super(new G())";
- String testName = "<select super constructor call with arguments>";
-
- 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);
-}
-/*
- * Regression test for 1FVQ0LK
- */
-public void test31() {
-
- String str =
- "class X { \n" +
- " Y f; \n" +
- " void foo() { \n" +
- " new Bar(fred()); \n" +
- " Z z= new Z(); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "\n\t";
- String selectionEndBehind = "Y";
-
- String expectedCompletionNodeToString = "<SelectOnType:Y>";
-
- String completionIdentifier = "Y";
- String expectedUnitDisplayString =
- "class X {\n" +
- " <SelectOnType:Y> f;\n" +
- " X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "Y";
- String testName = "<regression test for 1FVQ0LK>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Regression test for 1FWT4AJ: ITPCOM:WIN98 - SelectionParser produces duplicate type declaration
- */
-public void test32() {
-
- String str =
- "package search; \n"+
- "import java.io.*; \n"+
- "public class PhraseQuery { \n"+
- " public boolean containsPhrase(){ \n"+
- " try { \n"+
- " char currentChar = \"hello\".toLowerCase() \n"+
- " } \n"+
- "} \n";
-
- String selectionStartBehind = "\"hello\".";
- String selectionEndBehind = "\"hello\".toLowerCase";
-
- String expectedCompletionNodeToString = "<SelectOnMessageSend:\"hello\".toLowerCase()>";
-
- String completionIdentifier = "toLowerCase";
- String expectedUnitDisplayString =
- "package search;\n" +
- "import java.io.*;\n" +
- "public class PhraseQuery {\n" +
- " public PhraseQuery() {\n" +
- " }\n" +
- " public boolean containsPhrase() {\n" +
- " {\n" +
- " char currentChar = <SelectOnMessageSend:\"hello\".toLowerCase()>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "\"hello\".toLowerCase()";
- String testName = "<1FWT4AJ: ITPCOM:WIN98 - SelectionParser produces duplicate type declaration>";
-
- 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);
-}
-/*
- * Regression test for 1G4CLZM: ITPJUI:WINNT - 'Import Selection' - Set not found
- */
-public void test33() {
-
- String str =
- " import java.util.AbstractMap; \n"+
- " public class c4 extends AbstractMap { \n"+
- " /** \n"+
- " * @see AbstractMap#entrySet \n"+
- " */ \n"+
- " public Set entrySet() { \n"+
- " return null; \n"+
- " } \n"+
- " } \n";
-
- String selectionStartBehind = "\n\t\tpublic ";
- String selectionEndBehind = "public Set";
-
- String expectedCompletionNodeToString = "<SelectOnType:Set>";
-
- String completionIdentifier = "Set";
- String expectedUnitDisplayString =
- "import java.util.AbstractMap;\n" +
- "public class c4 extends AbstractMap {\n" +
- " public c4() {\n" +
- " }\n" +
- " public <SelectOnType:Set> entrySet() {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "Set";
- String testName = "<1G4CLZM: ITPJUI:WINNT - 'Import Selection' - Set not found>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Regression test for 1GB99S3: ITPJUI:WINNT - SH: NPE in editor while getting hover help
- */
-public void test34() {
-
- String str =
- "public class X { \n"+
- " public int foo() { \n"+
- " Object[] array = new Object[0]; \n"+
- " return array.length; \n"+
- " } \n"+
- "} \n";
-
- String selectionStartBehind = "\n\t\treturn ";
- String selectionEndBehind = "array.length";
-
- String expectedCompletionNodeToString = NONE;
-
- String completionIdentifier = NONE;
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public int foo() {\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = NONE;
- String testName = "<1GB99S3: ITPJUI:WINNT - SH: NPE in editor while getting hover help>";
-
- 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
- */
-public void test35() {
-
- String str =
- "public class G { \n" +
- " G() { \n" +
- " } \n" +
- " G(int x) { \n" +
- " this(); \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "\n\t\t";
- String selectionEndBehind = "this";
-
- String expectedCompletionNodeToString = "<SelectOnExplicitConstructorCall:this()>";
-
- String completionIdentifier = "this";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " G() {\n" +
- " }\n" +
- " G(int x) {\n" +
- " <SelectOnExplicitConstructorCall:this()>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "this()";
- String testName = "<select this constructor call>";
-
- 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 = "<SelectOnExplicitConstructorCall:new G().this()>";
-
- 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" +
- " <SelectOnExplicitConstructorCall:new G().this()>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new G().this()";
- String testName = "<select qualified this constructor call>";
-
- 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 with arguments
- */
-public void test37() {
-
- String str =
- "public class G { \n" +
- " static Object foo() { \n" +
- " class X { \n" +
- " X (){ \n" +
- " } \n" +
- " X (int x){ \n" +
- " new G().this(23 + \"hello\"); \n" +
- " } \n" +
- " } \n" +
- " } \n" +
- "} \n";
-
- String selectionStartBehind = "new G().";
- String selectionEndBehind = "new G().this";
-
- String expectedCompletionNodeToString = "<SelectOnExplicitConstructorCall:new G().this((23 + \"hello\"))>";
-
- 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" +
- " <SelectOnExplicitConstructorCall:new G().this((23 + \"hello\"))>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new G().this(23 + \"hello\")";
- String testName = "<select qualified this constructor call with arguments>";
-
- 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 = "<SelectOnExplicitConstructorCall:this(new G())>";
-
- String completionIdentifier = "this";
- String expectedUnitDisplayString =
- "public class G {\n" +
- " G() {\n" +
- " <SelectOnExplicitConstructorCall:this(new G())>;\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "this(new G())";
- String testName = "<select this constructor call with arguments>";
-
- 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);
-}
-/*
- * bugs 3293 search does not work in inner class (1GEUQHJ)
- */
-public void test39() {
-
- String str =
- "public class X { \n" +
- " Object hello = new Object(){ \n" +
- " public void foo(String s){ \n" +
- " s.length(); \n" +
- " } \n" +
- " }; \n" +
- "} \n";
-
- String selectionStartBehind = "s.";
- String selectionEndBehind = "length";
-
- String expectedCompletionNodeToString = "<SelectOnMessageSend:s.length()>";
-
- String completionIdentifier = "length";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " Object hello = new Object() {\n" +
- " public void foo(String s) {\n" +
- " <SelectOnMessageSend:s.length()>;\n" +
- " }\n" +
- " };\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "s.length()";
- String testName = "<select message send in anonymous class>";
-
- int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
- int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;
-
- this.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 = "<SelectOnType:Object>";
-
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " <SelectOnType:Object>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "Object";
- String testName = "<select fake field>";
-
- int selectionStart = str.indexOf(selection);
- int selectionEnd = str.indexOf(selection) + selection.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * bugs 11475 selection on local name.
- */
-public void test41() {
-
- String str =
- "public class X { \n" +
- " public void foo(){ \n" +
- " Object var; \n" +
- " } \n" +
- "} \n";
-
- String selection = "var";
-
- String expectedCompletionNodeToString = "<SelectionOnLocalName:Object var>";
-
- String completionIdentifier = "var";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " <SelectionOnLocalName:Object var>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "var";
- String testName = "<select local name>";
-
- 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 = "<SelectionOnArgumentName:Object var>";
-
- String completionIdentifier = "var";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void foo(<SelectionOnArgumentName:Object var>) {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "var";
- String testName = "<select argument name>";
-
- int selectionStart = str.indexOf(selection);
- int selectionEnd = str.indexOf(selection) + selection.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * bugs 11475 selection on argument name inside catch statement.
- */
-public void test43() {
-
- String str =
- "public class X { \n" +
- " public void foo(){ \n" +
- " try{ \n" +
- " }catch(Object var){}\n" +
- " } \n" +
- "} \n";
-
- String selection = "var";
-
- String expectedCompletionNodeToString = "<SelectionOnArgumentName:Object var>";
-
- String completionIdentifier = "var";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " <SelectionOnArgumentName:Object var>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "var";
- String testName = "<select argument name inside catch statement>";
-
- 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 = "<SelectOnSuper:super>";
-
- String completionIdentifier = "super";
- String expectedUnitDisplayString =
- "public class X {\n" +
- " String x = <SelectOnSuper:super>;\n" +
- " public X() {\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "super";
- String testName = "<select super in field initializer>";
-
- int selectionStart = str.indexOf(selection);
- int selectionEnd = str.indexOf(selection) + selection.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * bugs 14468
- */
-public void test45() {
-
- String str =
- "public class X { \n" +
- " void foo() {\n" +
- " if(x instanceof Object){\n" +
- " }\n" +
- " } \n" +
- "} \n";
-
- String selection = "Object";
-
- String expectedCompletionNodeToString = "<SelectOnType:Object>";
-
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n"+
- " public X() {\n"+
- " }\n"+
- " void foo() {\n"+
- " <SelectOnType:Object>;\n"+
- " }\n"+
- "}\n";
- String expectedReplacedSource = "Object";
- String testName = "<select inside instanceof statement>";
-
- 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 = "<SelectOnType:Object>";
-
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n"+
- " public X() {\n"+
- " }\n"+
- " void foo() {\n"+
- " <SelectOnType:Object>;\n"+
- " }\n"+
- "}\n";
- String expectedReplacedSource = "Object";
- String testName = "<select inside instanceof statement>";
-
- 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 test47() {
-
- String str =
- "public class X { \n" +
- " void foo() {\n" +
- " boolean y = x instanceof Object;\n" +
- " } \n" +
- "} \n";
-
- String selection = "Object";
-
- String expectedCompletionNodeToString = "<SelectOnType:Object>";
-
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n"+
- " public X() {\n"+
- " }\n"+
- " void foo() {\n"+
- " boolean y = <SelectOnType:Object>;\n"+
- " }\n"+
- "}\n";
- String expectedReplacedSource = "Object";
- String testName = "<select inside instanceof statement>";
-
- 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 = "<SelectOnType:Object>";
-
- String completionIdentifier = "Object";
- String expectedUnitDisplayString =
- "public class X {\n"+
- " boolean y = <SelectOnType:Object>;\n"+
- " public X() {\n"+
- " }\n"+
- "}\n";
- String expectedReplacedSource = "Object";
- String testName = "<select inside instanceof statement>";
-
- int selectionStart = str.indexOf(selection);
- int selectionEnd = str.indexOf(selection) + selection.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * bugs 28064
- */
-public void test49() {
-
- String str =
- "public class X { \n" +
- " X x = new X(){}\n" +
- "} \n";
-
- String selection = "X";
-
- String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new X() {\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- "}>";
-
- String completionIdentifier = "X";
- String expectedUnitDisplayString =
- "public class X {\n"+
- " X x = <SelectOnAllocationExpression:new X() {\n" +
- " () {\n" +
- " super();\n" +
- " }\n" +
- " }>;\n"+
- " public X() {\n"+
- " }\n"+
- "}\n";
- String expectedReplacedSource = "new X()";
- String testName = "<select anonymous type>";
-
- int selectionStart = str.lastIndexOf(selection);
- int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1;
-
- this.checkDietParse(
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest2.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest2.java
deleted file mode 100644
index 2c8ac59..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest2.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import java.util.Locale;
-
-import org.eclipse.jdt.core.compiler.CharOperation;
-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.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;
-
-public class SelectionTest2 extends AbstractSelectionTest {
-
-public SelectionTest2(String testName) {
- super(testName);
-}
-boolean thereWasAnNPE = false;
-private class SpecialSelectionParser extends SelectionParser {
- public SpecialSelectionParser(ProblemReporter problemReporter, long sourceLevel) {
- super(problemReporter, sourceLevel);
- }
- public void doNPEInParser(){
- this.stack = null;
- }
-}
-
- SpecialSelectionParser createParser(){
- CompilerOptions options = new CompilerOptions();
- SpecialSelectionParser parser =
- new SpecialSelectionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())),
- options.sourceLevel);
- return parser;
-}
-void checkMethodParse(
- SelectionParser parser,
- char[] source,
- int selectionStart,
- int selectionEnd,
- String expectedSelection,
- String expectedUnitToString,
- String expectedSelectionIdentifier,
- String expectedSelectedSource,
-
- String testName) {
-
- 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;
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.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(Util.displayString(computedUnitToString));
- //System.out.println(expectedUnitToString);
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString(0);
- assertEquals(
- "invalid selection node-" + testName,
- expectedSelection,
- computedCompletion);
-
- assertEquals(
- "invalid selection location-"+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);
- }
-}
-/*
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=30946
- */
-public void testBug30946() {
- final SpecialSelectionParser parser = createParser();
- Thread query = new Thread(
- new Runnable(){
- public void run(){
- String str =
- "public class A {\n" +
- " void foo() {\n" +
- " if (true) {\n" +
- " if()\n" +
- " switch (1) {\n" +
- " case A.B:\n" +
- " C d= (C) s;\n" +
- " here\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}n";
-
- String selection = "here";
-
- String expectedCompletionNodeToString = "<SelectOnName:here>";
-
- String completionIdentifier = "here";
- String expectedUnitDisplayString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " {\n" +
- " C d;\n" +
- " <SelectOnName:here>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "here";
- String testName = "<inifinite loop test>";
-
- int selectionStart = str.lastIndexOf(selection);
- int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1;
-
- try {
- SelectionTest2.this.checkMethodParse(
- parser,
- str.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
- } catch (NullPointerException e) {
- SelectionTest2.this.thereWasAnNPE = true;
- }
- }
- });
-
- query.start();
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- }
- // force parser to stop
- parser.doNPEInParser();
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- }
- assertTrue("there is an infinite loop", !thereWasAnNPE);
-
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SingleCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SingleCompletionTest.java
deleted file mode 100644
index a1b7093..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SingleCompletionTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import java.lang.reflect.InvocationTargetException;
-
-import junit.framework.TestCase;
-
-/**
- * Only 1 test should be in this class
- */
-public class SingleCompletionTest extends AbstractCompletionTest {
-/**
- * SingleCompletionTest constructor comment.
- * @param testName java.lang.String
- */
-public SingleCompletionTest(String testName) {
- super(testName);
-}
-private void run(Class testClass, String methodName) {
- try {
- java.lang.reflect.Constructor constructor = testClass.getDeclaredConstructor(new Class[] {String.class});
- TestCase test = (TestCase)constructor.newInstance(new Object[] {"single completion test"});
- java.lang.reflect.Method method = testClass.getDeclaredMethod(methodName, new Class[] {});
- method.invoke(test, new Object[] {});
- } catch (InstantiationException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- Throwable target = e.getTargetException();
- if (target instanceof RuntimeException) {
- throw (RuntimeException)target;
- }
- if (target instanceof Error) {
- throw (Error)target;
- }
- throw new Error(target.getMessage());
- }
-}
-/*
- * The test.
- */
-public void test() {
- run(NameReferenceCompletionTest.class, "testMethodInvocationAnonymousInnerClass2");
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
deleted file mode 100644
index 3e89bd3..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
+++ /dev/null
@@ -1,5215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import java.util.Locale;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
-import org.eclipse.jdt.internal.compiler.SourceElementParser;
-import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
-import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
-import org.eclipse.jdt.internal.compiler.env.IConstants;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-
-public class SourceElementParserTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase implements ISourceElementRequestor, IConstants {
- private SourceType currentType;
- private SourceMethod currentMethod;
- private SourceField currentField;
- private SourceInitializer currentInitializer;
- private char[] source;
- private SourcePackage currentPackage;
- private SourceImport[] currentImports;
- private int numberOfImports;
-public SourceElementParserTest(String testName) {
- super(testName);
-}
-public SourceElementParserTest(String testName, char[] source) {
- super(testName);
- this.source = source;
-}
-/**
- * acceptConstructorReference method comment.
- */
-public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition) {
- if (currentMethod == null) {
- if (currentType != null) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(typeName).append("(").append(argCount).append(")\n");
- currentType.setDefaultConstructor(buffer.toString());
- }
- return;
- }
- if (currentMethod.isConstructor()) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(typeName).append("(").append(argCount).append(")\n");
- currentMethod.setExplicitConstructorCall(buffer.toString());
- } else {
- if (currentType != null) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(typeName).append("(").append(argCount).append(")\n");
- currentType.setDefaultConstructor(buffer.toString());
- }
- }
-}
-/**
- * acceptFieldReference method comment.
- */
-public void acceptFieldReference(char[] fieldName, int sourcePosition) {}
-/**
- * acceptImport method comment.
- */
-public void acceptImport(
- int declarationStart,
- int declarationEnd,
- char[] name,
- boolean onDemand,
- int modifiers) {
-
- addImport(
- new SourceImport(declarationStart, declarationEnd, name, onDemand, modifiers, source));
-}
-/**
- * acceptLineSeparatorPositions method comment.
- */
-public void acceptLineSeparatorPositions(int[] positions) {}
-/**
- * acceptMethodReference method comment.
- */
-public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition) {}
-/**
- * acceptPackage method comment.
- */
-public void acceptPackage(
- int declarationStart,
- int declarationEnd,
- char[] name) {
-
- currentPackage =
- new SourcePackage(declarationStart, declarationEnd, name, source);
-}
-/**
- * acceptProblem method comment.
- */
-public void acceptProblem(IProblem problem) {}
-/**
- * acceptTypeReference method comment.
- */
-public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {}
-/**
- * acceptTypeReference method comment.
- */
-public void acceptTypeReference(char[] typeName, int sourcePosition) {}
-/**
- * acceptUnknownReference method comment.
- */
-public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {}
-/**
- * acceptUnknownReference method comment.
- */
-public void acceptUnknownReference(char[] name, int sourcePosition) {}
-protected void addImport(SourceImport sourceImport) {
- if (currentImports == null) {
- currentImports = new SourceImport[4];
- }
-
- if (numberOfImports == currentImports.length) {
- System.arraycopy(
- currentImports,
- 0,
- currentImports = new SourceImport[numberOfImports * 2],
- 0,
- numberOfImports);
- }
- currentImports[numberOfImports++] = sourceImport;
-}
-public void dietParse(String s, String testName) {
-
- this.source = s.toCharArray();
- reset();
- SourceElementParser parser =
- new SourceElementParser(this, new DefaultProblemFactory(Locale.getDefault()), new CompilerOptions());
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
-
- parser.parseCompilationUnit(sourceUnit, false);
-
-}
-public static String displayModifiers(int modifiers) {
- StringBuffer buffer = new StringBuffer();
-
- if ((modifiers & AccPublic) != 0)
- buffer.append("public ");
- if ((modifiers & AccProtected) != 0)
- buffer.append("protected ");
- if ((modifiers & AccPrivate) != 0)
- buffer.append("private ");
- if ((modifiers & AccFinal) != 0)
- buffer.append("final ");
- if ((modifiers & AccStatic) != 0)
- buffer.append("static ");
- if ((modifiers & AccAbstract) != 0)
- buffer.append("abstract ");
- if ((modifiers & AccNative) != 0)
- buffer.append("native ");
- if ((modifiers & AccSynchronized) != 0)
- buffer.append("synchronized ");
- return buffer.toString();
-}
-/**
- * enterClass method comment.
- */
-public void enterClass(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[] superclass,
- char[][] superinterfaces) {
-
- if (currentType == null) {
- // top level type
- currentType =
- new SourceType(
- null,
- declarationStart,
- modifiers,
- name,
- nameSourceStart,
- nameSourceEnd,
- superclass,
- superinterfaces,
- source);
- currentType.setPackage(currentPackage);
- setImports();
- } else {
- // member type
- SourceType memberType;
- currentType.addMemberType(
- memberType =
- new SourceType(
- currentType.getName(),
- declarationStart,
- modifiers,
- name,
- nameSourceStart,
- nameSourceEnd,
- superclass,
- superinterfaces,
- source));
- memberType.parent = currentType;
- currentType = memberType;
- }
-}
-/**
- * enterCompilationUnit method comment.
- */
-public void enterCompilationUnit() {}
-/**
- * enterConstructor method comment.
- */
-public void enterConstructor(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] parameterTypes,
- char[][] parameterNames,
- char[][] exceptionTypes) {
-
- currentType.addMethod(
- currentMethod =
- new SourceMethod(
- declarationStart,
- modifiers,
- null,
- name,
- nameSourceStart,
- nameSourceEnd,
- parameterTypes,
- parameterNames,
- exceptionTypes,
- source));
-}
-/**
- * enterField method comment.
- */
-public void enterField(
- int declarationStart,
- int modifiers,
- char[] type,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd) {
-
- currentType.addField(
- currentField =
- new SourceField(
- declarationStart,
- modifiers,
- type,
- name,
- nameSourceStart,
- nameSourceEnd,
- source));
-
-}
-
-/**
- * enterInitializer method comment.
- */
-public void enterInitializer(int declarationSourceStart, int modifiers) {
- currentType.addField(
- currentInitializer = new SourceInitializer(
- declarationSourceStart,
- modifiers));
-}
-
-/**
- * exitInitializer method comment.
- */
-public void exitInitializer(int declarationSourceEnd) {
- currentInitializer.setDeclarationSourceEnd(declarationSourceEnd);
-}
-/**
- * enterInterface method comment.
- */
-public void enterInterface(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] superinterfaces) {
-
- if (currentType == null) {
- // top level type
- currentType =
- new SourceType(
- null,
- declarationStart,
- modifiers,
- name,
- nameSourceStart,
- nameSourceEnd,
- null,
- superinterfaces,
- source);
- currentType.setPackage(currentPackage);
- setImports();
- } else {
- // member type
- SourceType memberType;
- currentType.addMemberType(
- memberType =
- new SourceType(
- currentType.getName(),
- declarationStart,
- modifiers,
- name,
- nameSourceStart,
- nameSourceEnd,
- null,
- superinterfaces,
- source));
- memberType.parent = currentType;
- currentType = memberType;
- }
-}
-/**
- * enterMethod method comment.
- */
-public void enterMethod(
- int declarationStart,
- int modifiers,
- char[] returnType,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] parameterTypes,
- char[][] parameterNames,
- char[][] exceptionTypes) {
-
- currentType.addMethod(
- currentMethod =
- new SourceMethod(
- declarationStart,
- modifiers,
- returnType,
- name,
- nameSourceStart,
- nameSourceEnd,
- parameterTypes,
- parameterNames,
- exceptionTypes,
- source));
-}
-/**
- * exitClass method comment.
- */
-public void exitClass(int declarationEnd) {
- currentType.setDeclarationSourceEnd(declarationEnd);
- if (currentType.parent != null) {
- currentType = currentType.parent;
- }
-}
-/**
- * exitCompilationUnit method comment.
- */
-public void exitCompilationUnit(int declarationEnd) {}
-/**
- * exitConstructor method comment.
- */
-public void exitConstructor(int declarationEnd) {
-
- currentMethod.setDeclarationSourceEnd(declarationEnd);
-}
-/**
- * exitField method comment.
- */
-public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
- currentField.setDeclarationSourceEnd(declarationEnd);
-}
-/**
- * exitClass method comment.
- */
-public void exitInterface(int declarationEnd) {
- currentType.setDeclarationSourceEnd(declarationEnd);
- if (currentType.parent != null) {
- currentType = currentType.parent;
- }
-}
-/**
- * exitMethod method comment.
- */
-public void exitMethod(int declarationEnd) {
- currentMethod.setDeclarationSourceEnd(declarationEnd);
-}
-public void fullParse(String s, String testName) {
-
- this.source = s.toCharArray();
- reset();
- SourceElementParser parser =
- new SourceElementParser(this, new DefaultProblemFactory(Locale.getDefault()), new CompilerOptions());
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
-
- parser.parseCompilationUnit(sourceUnit, true);
-}
-public void reset() {
- currentType = null;
- currentMethod = null;
- currentField = null;
- currentPackage = null;
- currentImports = null;
- numberOfImports = 0;
-}
-public void setImports() {
- if (currentImports == null)
- return;
- if (numberOfImports != currentImports.length) {
- System.arraycopy(
- currentImports,
- 0,
- currentImports = new SourceImport[numberOfImports],
- 0,
- numberOfImports);
- }
- currentType.setImports(currentImports);
-}
-public void test01() {
-
- String s =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "\n"
- + "public class X {\n"
- + "void foo() {\n"
- + "System.out.println();\n"
- + "\n"
- + "public int h;\n"
- + "public int[] i = { 0, 1 };\n"
- + "\n"
- + "int bar" + "\\" + "u0065(){\n"
- + "void truc(){\n"
- + "}\n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tint bare() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test01: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 52,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 178,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 105, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 117, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 119, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 144, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 69, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bare", 147, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bare", 163, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 164, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 177, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bare", "bar" + "\\" + "u0065", methods[1].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test02() {
-
- String s =
- "/** javadoc comment */\n"
- + "public class X {\n"
- + "}\n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test02: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 40,
- currentType.getDeclarationSourceEnd());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test03() {
-
- String s =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "\n"
- + "public class X {\n"
- + "void foo() {\n"
- + "System.out.println();\n"
- + "\n"
- + "public int h;\n"
- + "public int[] i = { 0, 1 };\n"
- + "\n"
- + "int bar" + "\\" + "u0065(){\n"
- + "void truc(){\n"
- + "}\n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tvoid foo() {}\n"
- + "\tint bare() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test03: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 52,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 178,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 105, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 117, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 119, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 144, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 69, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 147, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 163, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 164, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 177, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bare", "bar" + "\\" + "u0065", methods[1].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test04() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " class L { \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
- String testName = "test04: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 372,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 248, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 260, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 271, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 296, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 246, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 317, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 337, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 339, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 360, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test05() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " class L { \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test05: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 372,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 248, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 260, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 271, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 296, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 246, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 317, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 337, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 339, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 360, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test06() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " X x; \n"
- + " Object a, b = null; \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tX x;\n"
- + "\tObject a;\n"
- + "\tObject b;\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test06: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 347,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 5, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 115, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 118, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field a", 131, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field a", 139, fields[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field b", 131, fields[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field b", 149, fields[2].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field h", 223, fields[3].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 235, fields[3].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 246, fields[4].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 271, fields[4].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 159, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 221, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 292, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 312, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 314, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 335, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test07() {
-
- String s =
- "package a; \n"
- + "import java.lang.*; \n"
- + "import java.util.*; \n"
- + " \n"
- + "public class X { \n"
- + " X x; \n"
- + " Object a, b = null; \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " \n"
- + " public int h; \n"
- + " public int[] i = { 0, 1 }; \n"
- + " \n"
- + " void bar(){ \n"
- + " void truc(){ \n"
- + "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tX x;\n"
- + "\tObject a;\n"
- + "\tObject b;\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test07: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 347,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 5, fields.length);
-
- assertEquals("Invalid declaration source start for field xh", 115, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 118, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field a", 131, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field a", 139, fields[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field b", 131, fields[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field b", 149, fields[2].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field h", 223, fields[3].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 235, fields[3].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 246, fields[4].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 271, fields[4].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 159, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 221, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 292, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 312, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 314, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 335, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test08() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " void bar(){ \n"
- + " } \n"
- + " void truc(){ \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test08: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 198,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 100, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 127, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 149, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 163, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 185, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test09() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " void baz(){} \n"
- + " } \n"
- + " \n"
- + " void bar(){ \n"
- + " } \n"
- + " void truc(){ \n"
- + " } \n"
- + "} \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test09: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 198,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 100, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 127, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 149, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 163, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 185, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test10() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " void baz(){} \n"
- + " } \n"
- + " /** comment \n"
- + " * \n"
- + " * \n"
- + " */ \n"
- + " \n"
- + " void bar(){ \n"
- + " } \n"
- + " void truc(){ \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test10: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 415,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 100, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 114, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 366, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 380, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 402, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test11() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " void baz(){} \n"
- + " /** comment \n"
- + " * \n"
- + " * \n"
- + " */ \n"
- + " int[][] j[] = null, k; // comment \n"
- + " \n"
- + " void bar(){ \n"
- + " } \n"
- + " void truc(){ \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint[][][] j;\n"
- + "\tint[][] k;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid baz() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test11: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 449,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
-
- assertEquals("Invalid declaration source start for field j", 102, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field j", 305, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field k", 102, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field k", 308, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 4, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 76, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 79, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 90, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 378, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 400, methods[2].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 414, methods[3].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 436, methods[3].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[2].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[3].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test12() {
-
- String s =
- "import java.util.Enumeration;\n"
- + "import java.util.Hashtable;"
- + "\n"
- + "/** comment */\n"
- + "public class A2 {\n"
- + " void foo() {\n"
- + " System.out.println();\n"
- + " void baz(){}\n"
- + " /** comment\n"
- + " *\n"
- + " *\n"
- + " */\n"
- + " static { } // comment\n"
- + " \n"
- + "\n"
- + " void bar(){\n"
- + " }\n"
- + " void truc(){\n"
- + " }\n"
- + "}\n";
-
- String expectedUnitToString =
- "import java.util.Enumeration;\n"
- + "import java.util.Hashtable;\n"
- + "public class A2 {\n"
- + "\tstatic {}\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid baz() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test12: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 58,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 231,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for initializer", 145, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for initializer", 181, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 4, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 92, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 128, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 131, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 142, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 183, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 212, methods[2].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 215, methods[3].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 229, methods[3].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[2].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[3].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test13() {
-
- String s =
- "import java.util.Enumeration;\n"
- + "import java.util.Hashtable;\n"
- + "\n"
- + "public class A2 {\n"
- + " void foo() {\n"
- + " System.out.println();\n"
- + " void baz(){}\n"
- + " static { }\n"
- + " \n"
- + "\n"
- + " void bar(){\n"
- + " }\n"
- + " void truc(){\n"
- + " }\n"
- + "}\n";
-
- String expectedUnitToString =
- "import java.util.Enumeration;\n"
- + "import java.util.Hashtable;\n"
- + "public class A2 {\n"
- + "\tstatic {}\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid baz() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
- String testName = "test13: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 59,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 180,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
-
- assertEquals(" invalid fields length", 1, fields.length);
-
- assertEquals("Invalid declaration source start for initializer", 132, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for initializer", 141, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 4, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 78, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 114, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 117, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 128, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 148, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 161, methods[2].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 164, methods[3].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 178, methods[3].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[2].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[3].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test14() {
-
- String s =
- "import java.util.Enumeration;\n"
- + "import java.util.Hashtable;\n"
- + "\n"
- + "public class A2 {\n"
- + " void foo() {\n"
- + " System.out.println();\n"
- + " void baz(){}\n"
- + " static { }\n"
- + " }\n"
- + "\n"
- + " void bar(){\n"
- + " }\n"
- + " void truc(){\n"
- + " }\n"
- + "}\n";
-
- String expectedUnitToString =
- "import java.util.Enumeration;\n"
- + "import java.util.Hashtable;\n"
- + "public class A2 {\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test14: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 59,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 180,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("Invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 78, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 144, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 148, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 161, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 164, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 178, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test15() {
-
- String s =
- "public class X { \n"
- + " class Y { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tpublic int h;\n"
- + "\t\tpublic int[] i;\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t\tvoid foo() {}\n"
- + "\t\tvoid bar() {}\n"
- + "\t\tvoid baz() {}\n"
- + "\t}\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test15: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 227,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" invalid members length ", 1, members.length);
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 117, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 129, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 140, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 163, fields[1].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 171, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 191, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 193, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 215, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName());
-
- SourceType member = members[0];
- assertEquals(
- "Invalid class declarationSourceStart ",
- 26,
- member.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 227,
- member.getDeclarationSourceEnd());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test16() {
-
- String s =
- "public class X { \n"
- + " class Y { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tpublic int h;\n"
- + "\t\tpublic int[] i;\n"
- + "\t\tvoid foo() {}\n"
- + "\t\tvoid bar() {}\n"
- + "\t\tvoid baz() {}\n"
- + "\t}\n"
- + "}";
-
- String testName = "test16: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 227,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" invalid members length ", 1, members.length);
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 117, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 129, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 140, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 163, fields[1].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid methods length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 171, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 191, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 193, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 215, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName());
-
- SourceType member = members[0];
- assertEquals(
- "Invalid class declarationSourceStart ",
- 26,
- member.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 227,
- member.getDeclarationSourceEnd());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test17() {
-
- String s =
- "public class X { \n"
- + " class Y { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t\tvoid foo() {}\n"
- + "\t}\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid bar() {}\n"
- + "\tvoid baz() {}\n"
- + "}";
-
- String testName = "test17: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 241,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 131, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 143, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 154, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 177, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method bar", 185, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 205, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 207, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 229, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" invalid members length ", 1, members.length);
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields == null);
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid methods length ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType member = members[0];
- assertEquals(
- "Invalid class declarationSourceStart ",
- 26,
- member.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 117,
- member.getDeclarationSourceEnd());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test18() {
-
- String s =
- "public class X { \n"
- + " class Y { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + " } \n"
- + " public int h; \n"
- + " public int[] i = {0, 1}; \n"
- + " void bar(){ \n"
- + " void baz(){ \n"
- + " } \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tvoid foo() {}\n"
- + "\t}\n"
- + "\tpublic int h;\n"
- + "\tpublic int[] i;\n"
- + "\tvoid bar() {}\n"
- + "\tvoid baz() {}\n"
- + "}";
-
- String testName = "test18: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 241,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 131, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 143, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 154, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 177, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method bar", 185, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 205, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 207, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 229, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" invalid members length ", 1, members.length);
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields == null);
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid methods length ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType member = members[0];
- assertEquals(
- "Invalid class declarationSourceStart ",
- 26,
- member.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 117,
- member.getDeclarationSourceEnd());
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test19() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + "} \n"
- + " void bar(){ \n"
- + " int x; \n"
- + " void baz(){ \n"
- + " } \n"
- + " int y; \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint y;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid baz() {}\n"
- + "}";
-
- String testName = "test19: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 197,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field y", 181, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 186, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 26, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 77, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 104, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 143, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 145, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 167, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test20() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + "} \n"
- + " void bar(){ \n"
- + " public int x; \n"
- + " void baz(){ \n"
- + " } \n"
- + " int y; \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tpublic int x;\n"
- + "\tint y;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid baz() {}\n"
- + "}";
-
- String testName = "test20: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 201,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 126, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 138, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field y", 185, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 190, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 26, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 77, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 104, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 124, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 149, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 171, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test21() {
-
- String s =
- "public class X { \n"
- + " void foo() { \n"
- + " System.out.println(); \n"
- + " } \n"
- + "} \n"
- + " void bar(){ \n"
- + " public int x; \n"
- + " void baz(){ \n"
- + " } \n"
- + " int y; \n";
-
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tpublic int x;\n"
- + "\tint y;\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid baz() {}\n"
- + "}";
-
- String testName = "test21: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 201,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" invalid fields length ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 126, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 138, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field y", 185, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 190, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 26, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 77, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 104, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 124, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method baz", 149, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method baz", 171, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test22() {
-
- String s =
- "public class X extends { \n"
- + " void foo() { \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "}";
-
- String testName = "test22: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 67,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 32, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 54, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test23() {
-
- String s =
- "public class X extends Thread { \n"
- + " void foo() throws \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X extends Thread {\n"
- + "\tThread(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "}";
-
- String testName = "test23: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 98,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 37, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 61, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 63, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 85, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test24() {
-
- String s =
- "public class X implements \n"
- + " void foo() \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "}";
-
- String testName = "test24: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 91,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 34, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 54, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 56, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 78, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test25() {
-
- String s =
- "public class X implements Y, \n"
- + " void foo() \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X implements Y, {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "}";
-
- String testName = "test25: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 92,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("contains superinterfaces " , currentType.getInterfaceNames() != null);
- assertEquals(" invalid superinterfaces length ", 1, currentType.getInterfaceNames().length);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" invalid fields length ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 35, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 55, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 57, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 79, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test26() {
-
- String s =
- "public class X implements \n"
- + " class Y { \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t\tvoid bar() {}\n"
- + "\t}\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test26: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 102,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 34,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 90,
- members[0].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method bar", 56, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 77, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName());
-
- members = members[0].getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test27() {
-
- String s =
- "public class X \n"
- + " fieldX; \n"
- + " class Y { \n"
- + " void bar() \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t\tvoid bar() {}\n"
- + "\t}\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test27: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 113,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 45,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 101,
- members[0].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method bar", 67, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 88, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName());
-
- members = members[0].getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test28() {
-
- String s =
- "public class X \n"
- + " fieldX; \n"
- + " class Y \n"
- + " } \n"
- + "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t}\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test28: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 78,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals(" contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 45,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 65,
- members[0].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- members = members[0].getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test29() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz(){} \n" +
- " } \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test29: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 88,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 357,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 276, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 288, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains 3 methods ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 114, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 274, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 312, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 332, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 334, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 355, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test30() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz(){} \n" +
- " } \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test30: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 88,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 357,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 276, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 288, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains 3 methods ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 114, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 274, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 312, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 332, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 334, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 355, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test31() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() {} \n" +
- " }.baz(); \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test31: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 334,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 253, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 265, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains 3 methods ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 251, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 289, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 309, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 311, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 332, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test32() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() {} \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "}";
-
- String testName = "test32: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 315,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 315, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test33() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() {} \n" +
- " \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tvoid foo() {}\n"
- + "}";
-
- String testName = "test33: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 89,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 315,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 315, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test34() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " new X(){ \n" +
- " void baz() \n" +
- " } \n" +
- " } \n" +
- " public int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tpublic int h;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test34: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 88,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 342,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field h", 250, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field h", 262, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains 3 methods ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 114, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 248, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 286, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 306, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 308, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 329, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test35() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz(){} \n" +
- " } \n" +
- " \n" +
- " int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test35: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 76,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 309,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains 3 methods ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 99, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 260, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 262, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 279, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 281, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 299, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test36() {
-
- String s =
- "package a; \n" +
- "import java.lang.*; \n" +
- "import java.util.*; \n" +
- " \n" +
- "public class X { \n" +
- " void foo() { \n" +
- " System.out.println(); \n" +
- " \n" +
- " class L extends { \n" +
- " public int l; \n" +
- " void baz(){} \n" +
- " } \n" +
- " \n" +
- " int h; \n" +
- " \n" +
- " void bar(){ \n" +
- " void truc(){ \n" +
- "} \n";
-
- String expectedUnitToString =
- "package a;\n"
- + "import java.lang.*;\n"
- + "import java.util.*;\n"
- + "public class X {\n"
- + "\tvoid foo() {}\n"
- + "\tvoid bar() {}\n"
- + "\tvoid truc() {}\n"
- + "}";
-
- String testName = "test36: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 76,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 309,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains 3 methods ", 3, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 99, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 260, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 262, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 279, methods[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method truc", 281, methods[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method truc", 299, methods[2].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test37() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y { \n" +
- " int y; \n" +
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tint y;\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t}\n"
- + "\tint x;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test37: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 112,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals("contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 73,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 104,
- members[0].getDeclarationSourceEnd());
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field y", 92, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 97, fields[0].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test38() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y { \n" +
- " int y; \n" +
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tint y;\n"
- + "\t}\n"
- + "\tint x;\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test38: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 112,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals("contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 73,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 104,
- members[0].getDeclarationSourceEnd());
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field y", 92, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 97, fields[0].getDeclarationSourceEnd());
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test39() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y \n" +
- "} \n" +
- " int y; \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t\tjava.lang.Object(0)\n"
- + "\t}\n"
- + "\tint x;\n"
- + "\tint y;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test39: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 109,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field y", 98, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 103, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals("contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 73,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 87,
- members[0].getDeclarationSourceEnd());
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields == null);
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test40() {
-
- String s =
- "public class X { \n" +
- " int x; \n" +
- " \n" +
- " int foo(){ } \n" +
- " \n" +
- " class Y \n" +
- "} \n" +
- " int y; \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tclass Y {\n"
- + "\t}\n"
- + "\tint x;\n"
- + "\tint y;\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test40: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 109,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("contains one field ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field y", 98, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 103, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members != null);
- assertEquals("contains one member ", 1, members.length);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 73,
- members[0].getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 87,
- members[0].getDeclarationSourceEnd());
-
- fields = members[0].getFields();
- assertTrue(" invalid fields ", fields == null);
-
- methods = members[0].getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test41() {
-
- String s =
- "public class X { \n"+
- " void hell" + "\\" + "u006f()\n"+
- " static void foo() { \n"+
- " X x; \n"+
- " x = new X(23); \n"+
- " System.out.println(); \n"+
- " \n"+
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tvoid hello() {}\n"
- + "\tstatic void foo() {}\n"
- + "}";
-
- String testName = "test41: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 139,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals(" contains one methods ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method hello", 22, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method hello", 39, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method foo", 41, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 130, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method hello", "hell" + "\\" + "u006f", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test42() {
-
- String s =
- "public class X { \n" +
- " int x \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test42: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 29,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" contains one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 24, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test43() {
-
- String s =
- "public class X { \n" +
- " int x \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "}";
-
- String testName = "test43: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 29,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" contains one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 24, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test44() {
-
- String s =
- "public class X { \n" +
- " int x, y \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "\tint y;\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test44: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 31,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" contains one field", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 25, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field y", 20, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 27, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test45() {
-
- String s =
- "public class X { \n" +
- " int x, y \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "\tint y;\n"
- + "}";
-
- String testName = "test45: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 31,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" contains one field", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 25, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field y", 20, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 27, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test46() {
-
- String s =
- "public class X { \n" +
- " String s = \" \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tString s;\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test46: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 34,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" contains one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 20, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 34, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test47() {
-
- String s =
- "public class X { \n" +
- " String s = \" \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tString s;\n"
- + "}";
-
- String testName = "test47: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 34,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("doesn't contain superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals(" contains one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 20, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 34, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test48() {
-
- String s =
- "public class X implements Y, \n" +
- " String s = \" \n";
-
- String expectedUnitToString =
- "public class X implements Y, String, {\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test48: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 50,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has 2 superinterfaces " , currentType.getInterfaceNames() != null);
- assertEquals("2 superinterfaces " , 2, currentType.getInterfaceNames().length);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test49() {
-
- String s =
- "public class X implements Y, \n" +
- " String s = \" \n";
-
- String expectedUnitToString =
- "public class X implements Y, String, {\n"
- + "}";
-
- String testName = "test49: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 50,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has 2 superinterfaces " , currentType.getInterfaceNames() != null);
- assertEquals("2 superinterfaces " , 2, currentType.getInterfaceNames().length);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test50() {
-
- String s =
- "public class X implements \n"+
- "int x \n"+
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test50: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 42,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 29, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 33, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test51() {
-
- String s =
- "public class X implements \n"+
- "int x \n"+
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "}";
-
- String testName = "test51: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 42,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 29, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 33, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test52() {
-
- String s =
- "public class X public int foo(int bar(static String s";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tstatic String s;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tpublic int foo() {}\n"
- + "\tint bar() {}\n"
- + "}";
-
- String testName = "test52: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 52,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 38, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 52, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
-
- assertEquals("Invalid declaration source start for method foo", 15, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 29, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 30, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 37, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test53() {
-
- String s =
- "public class X public int foo(int x, int bar public String s;";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tpublic String s;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tpublic int foo(int x, int bar, ) {}\n"
- + "}";
-
- String testName = "test53: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 60,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field ", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 45, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 60, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has one method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 15, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 44, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test54() {
-
- String s =
- "public class X \n" +
- " public int foo( \n" +
- " int bar( \n" +
- " static String s, int x \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tstatic String s;\n"
- + "\tint x;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tpublic int foo() {}\n"
- + "\tint bar() {}\n"
- + "}";
-
- String testName = "test54: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 78,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has 2 fields ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 55, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 70, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field x", 72, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 76, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 2 methods ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 20, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 38, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 40, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 52, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test55() {
-
- String s =
- "public class X \n" +
- " public int foo( \n" +
- " int bar( \n" +
- " static String s, int x \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tstatic String s;\n"
- + "\tint x;\n"
- + "\tpublic int foo() {}\n"
- + "\tint bar() {}\n"
- + "}";
-
- String testName = "test55: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 78,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has 2 fields ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 55, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 70, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field x", 72, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 76, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 2 methods ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 20, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 38, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method bar", 40, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method bar", 52, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test56() {
-
- String s =
- "class X { \n" +
- " String s; \n" +
- " \n" +
- " public void foo( \n" +
- " static int x \n" +
- "} \n";
-
-
- String expectedUnitToString =
- "class X {\n"
- + "\tString s;\n"
- + "\tstatic int x;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tpublic void foo() {}\n"
- + "}";
-
- String testName = "test56: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 75,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has 2 fields ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 16, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 24, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field x", 60, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 71, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 1 method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 39, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test57() {
-
- String s =
- "class X { \n" +
- " String s; \n" +
- " \n" +
- " public void foo( \n" +
- " static int x \n" +
- "} \n";
-
-
- String expectedUnitToString =
- "class X {\n"
- + "\tString s;\n"
- + "\tstatic int x;\n"
- + "\tpublic void foo() {}\n"
- + "}";
-
- String testName = "test57: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 75,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has 2 fields ", 2, fields.length);
-
- assertEquals("Invalid declaration source start for field s", 16, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field s", 24, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field x", 60, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 71, fields[1].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 1 method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 39, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test58() {
-
- String s =
- "public class X { \n"+
- " int foo(){ \n"+
- " String s = \" \n"+
- " } \n"+
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test58: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 62,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 1 method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 21, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 54, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test59() {
-
- String s =
-
- "class X { \n" +
- " int foo(AA a, BB b, IOEx \n" +
- " \n";
-
- String expectedUnitToString =
- "class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo(AA a, BB b, ) {}\n"
- + "}";
-
- String testName = "test59: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 60,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 1 method ", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 20, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 60, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test60() {
-
- String s =
- "public class X { \n"+
- " final static int foo(){ \n"+
- " return \"1; \n"+
- " } \n"+
- " public static void main(String argv[]){ \n"+
- " foo(); \n"+
- " } \n"+
- "} \n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tfinal static int foo() {}\n"
- + "\tpublic static void main(String[] argv, ) {}\n"
- + "}";
-
- String testName = "test60: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 161,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has 1 method ", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 25, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 75, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method main", 89, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method main", 148, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method main", "main", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test61() {
-
- String s =
- "public class X { \n"+
- " { \n"+
- " int x;";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\t{}\n"
- + "\tjava.lang.Object(0)\n"
- + "}";
-
- String testName = "test61: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 47,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
-
- assertEquals("Invalid declaration source start for initializer", 25, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for initializer", 47, fields[0].getDeclarationSourceEnd());
-
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test62() {
-
- String s =
- "public class X { \n"+
- " int foo(){ \n"+
- " if(true){ \n"+
- " int x;";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test62: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 78,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has one method", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 78, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test63() {
-
- String s =
- "public class X { \n"+
- " int foo(){} \n"+
- "} \n"+
- "int x;\n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test63: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 66,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 60, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 65, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has one method", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 37, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test64() {
-
- String s =
- "public class X { \n"+
- " int foo(){} \n"+
- "} \n"+
- "int x;\n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint x;\n"
- + "\tint foo() {}\n"
- + "}";
-
- String testName = "test64: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 66,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field x", 60, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field x", 65, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has one method", 1, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 37, methods[0].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test65() {
-
- String s =
- "public class X { \n"+
- " int foo(){} \n"+
- "} \n"+
- "int x();\n";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test65: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 68,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 37, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 60, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 67, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test66() {
-
- String s =
- "public interface X { \n"+
- " int foo() {}; \n"+
- "} \n"+
- "int x();\n";
-
- String expectedUnitToString =
- "public interface X {\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test66: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 72,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 41, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 64, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 71, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test67() {
-
- String s =
- "public interface X { \n"+
- " int foo() {}; \n"+
- " int x(); \n"+
- "}";
-
- String expectedUnitToString =
- "public interface X {\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test67: diet parse";
- dietParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 71,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 41, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 54, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 61, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test68() {
-
- String s =
- "public interface X { \n"+
- " int foo() {}; \n"+
- " int x(); \n"+
- "}";
-
- String expectedUnitToString =
- "public interface X {\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test68: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 71,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 41, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 54, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 61, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test69() {
-
- String s =
- "public interface X { \n"+
- "float y; \n"+
- " int foo() ; \n"+
- " int x(); \n"+
- "}";
-
- String expectedUnitToString =
- "public interface X {\n"
- + "\tfloat y;\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test69: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 87,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field y", 27, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field y", 34, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 58, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 70, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 77, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test70() {
-
- String s =
- "public interface X { \n"+
- " int foo(); \n"+
- " int x(); \n"+
- "}";
-
- String expectedUnitToString =
- "public interface X {\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test70: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 69,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields == null);
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 39, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 52, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 59, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test71() {
-
- String s =
- "public interface X { \n"+
- " int[] i = ; \n"+
- " int foo() {} \n"+
- " int x(); \n"+
- "}";
-
- String expectedUnitToString =
- "public interface X {\n"
- + "\tint[] i;\n"
- + "\tjava.lang.Object(0)\n"
- + "\tint foo() {}\n"
- + "\tint x() {}\n"
- + "}";
-
- String testName = "test71: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 93,
- currentType.getDeclarationSourceEnd());
-
- assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null);
-
- SourceField[] fields = currentType.getFields();
- assertTrue(" invalid fields ", fields != null);
- assertEquals("has one field", 1, fields.length);
-
- assertEquals("Invalid declaration source start for field i", 30, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field i", 49, fields[0].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods != null);
- assertEquals("has two methods", 2, methods.length);
-
- assertEquals("Invalid declaration source start for method foo", 53, methods[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method foo", 64, methods[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for method x", 76, methods[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for method x", 83, methods[1].getDeclarationSourceEnd());
-
- assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName());
-
- assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName());
-
- SourceType[] members = currentType.getMemberTypes();
- assertTrue(" invalid members ", members == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test72() {
-
- String s =
- "public class X { \n"+
- " X() { \n" +
- " this(); \n" +
- " } \n" +
- "}";
-
- String expectedUnitToString =
- "public class X {\n"
- + "\tX() {\n"
- + "\t\tX(0)\n"
- + "\t}\n"
- + "}";
-
- String testName = "test72: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test73() {
-
- String s =
- "public class X extends Toto { \n"+
- " X() { \n" +
- " this(); \n" +
- " } \n" +
- " X(int i) { \n" +
- " super(); \n" +
- " } \n" +
- " X() { \n" +
- " this(0); \n" +
- " } \n" +
- "}";
-
- String expectedUnitToString =
- "public class X extends Toto {\n"
- + "\tX() {\n"
- + "\t\tX(0)\n"
- + "\t}\n"
- + "\tX(int i, ) {\n"
- + "\t\tToto(0)\n"
- + "\t}\n"
- + "\tX() {\n"
- + "\t\tX(1)\n"
- + "\t}\n"
- + "}";
-
- String testName = "test73: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test74() {
-
- String s =
- "public class X extends Toto { \n"+
- " class Y extends Throwable { \n" +
- " } \n" +
- " X() { \n" +
- " this(); \n" +
- " } \n" +
- " X(int i) { \n" +
- " super(); \n" +
- " } \n" +
- " X() { \n" +
- " this(0); \n" +
- " } \n" +
- " public Object foo(int i) { \n" +
- " return new Object() {}; \n" +
- " } \n" +
- "}";
-
- String expectedUnitToString =
- "public class X extends Toto {\n"
- + "\tclass Y extends Throwable {\n"
- + "\t\tThrowable(0)\n"
- + "\t}\n"
- + "\tX() {\n"
- + "\t\tX(0)\n"
- + "\t}\n"
- + "\tX(int i, ) {\n"
- + "\t\tToto(0)\n"
- + "\t}\n"
- + "\tX() {\n"
- + "\t\tX(1)\n"
- + "\t}\n"
- + "\tpublic Object foo(int i, ) {}\n"
- + "}";
-
- String testName = "test74: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-/*
- * bugs 16126
- */
-public void test75() {
- String s =
- "public class P#AField {\n" +
- " public void setP#A(String P#A) {\n" +
- " this.P#A = P#A;\n" +
- " }\n" +
- "}";
-
- String expectedUnitToString =
- "public class P {\n" +
- " {}\n" +
- " public void setP;\n" +
- " java.lang.Object(0)\n" +
- " A(String P, ) {}\n" +
- "}";
-
- String testName = "test75: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-public void test76() {
-
- String s =
- "class X {\n" +
- " public static int j = 0;\n" +
- " /* static */ {\n" +
- " }" +
- " public static int i = 9;\n" +
- "}\n";
-
- String expectedUnitToString =
- "class X {\n" +
- " public static int j;\n" +
- " {}\n" +
- " public static int i;\n" +
- " java.lang.Object(0)\n" +
- "}";
-
- String testName = "test01: full parse";
- fullParse(s,testName);
-
- assertEquals(
- "Invalid class declarationSourceStart ",
- 0,
- currentType.getDeclarationSourceStart());
-
- assertEquals(
- "Invalid class declarationSourceEnd ",
- 84,
- currentType.getDeclarationSourceEnd());
-
- SourceField[] fields = currentType.getFields();
- assertTrue("invalid fields ", fields != null);
- assertEquals("Invalid fields length ", 3, fields.length);
-
- assertEquals("Invalid declaration source start for field j", 12, fields[0].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for field j", 35, fields[0].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for initializer", 39, fields[1].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end for initializer", 56, fields[1].getDeclarationSourceEnd());
-
- assertEquals("Invalid declaration source start for field i", 59, fields[2].getDeclarationSourceStart());
- assertEquals("Invalid declaration source end field i", 82, fields[2].getDeclarationSourceEnd());
-
- SourceMethod[] methods = currentType.getMethods();
- assertTrue(" invalid methods ", methods == null);
-
- assertEquals(
- "Invalid source " + testName,
- expectedUnitToString,
- currentType.toString());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java
deleted file mode 100644
index dcc3780..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import org.eclipse.jdt.internal.compiler.env.IConstants;
-import org.eclipse.jdt.internal.compiler.env.ISourceField;
-
-public class SourceField implements ISourceField, IConstants {
- protected int modifiers;
- protected char[] typeName;
- protected char[] name;
- protected int declarationStart;
- protected int declarationEnd;
- protected int nameSourceStart;
- protected int nameSourceEnd;
- protected char[] source;
-public SourceField(
- int declarationStart,
- int modifiers,
- char[] typeName,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[] source) {
-
- this.declarationStart = declarationStart;
- this.modifiers = modifiers;
- this.typeName = typeName;
- this.name = name;
- this.nameSourceStart = nameSourceStart;
- this.nameSourceEnd = nameSourceEnd;
- this.source = source;
-}
-public String displayModifiers() {
- StringBuffer buffer = new StringBuffer();
-
- if (this.modifiers == 0)
- return null;
- if ((this.modifiers & AccPublic) != 0)
- buffer.append("public ");
- if ((this.modifiers & AccProtected) != 0)
- buffer.append("protected ");
- if ((this.modifiers & AccPrivate) != 0)
- buffer.append("private ");
- if ((this.modifiers & AccFinal) != 0)
- buffer.append("final ");
- if ((this.modifiers & AccStatic) != 0)
- buffer.append("static ");
- if ((this.modifiers & AccAbstract) != 0)
- buffer.append("abstract ");
- if ((this.modifiers & AccNative) != 0)
- buffer.append("native ");
- if ((this.modifiers & AccSynchronized) != 0)
- buffer.append("synchronized ");
- return buffer.toString();
-}
-public String getActualName() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(source, nameSourceStart, nameSourceEnd - nameSourceStart + 1);
- return buffer.toString();
-}
-public int getDeclarationSourceEnd() {
- return declarationEnd;
-}
-public int getDeclarationSourceStart() {
- return declarationStart;
-}
-public char[] getInitializationSource() {
- return null;
-}
-public int getModifiers() {
- return modifiers;
-}
-public char[] getName() {
- return name;
-}
-public int getNameSourceEnd() {
- return nameSourceEnd;
-}
-public int getNameSourceStart() {
- return nameSourceStart;
-}
-public char[] getTypeName() {
- return typeName;
-}
-protected void setDeclarationSourceEnd(int position) {
- declarationEnd = position;
-}
-public String tabString(int tab) {
- /*slow code*/
-
- String s = "";
- for (int i = tab; i > 0; i--)
- s = s + "\t";
- return s;
-}
-public String toString() {
- return toString(0);
-}
-public String toString(int tab) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(tabString(tab));
- String displayModifiers = displayModifiers();
- if (displayModifiers != null) {
- buffer.append(displayModifiers);
- }
- buffer.append(typeName).append(" ").append(name);
- buffer.append(";");
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceImport.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceImport.java
deleted file mode 100644
index e1349c0..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceImport.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class SourceImport {
- int declarationSourceStart;
- int declarationSourceEnd;
- char[] name;
- boolean onDemand;
- int modifiers;
- char[] source;
-/**
- * @param declarationSourceStart int
- * @param declarationSourceEnd int
- * @param name char[]
- * @param onDemand boolean
- */
-public SourceImport(
- int declarationSourceStart,
- int declarationSourceEnd,
- char[] name,
- boolean onDemand,
- int modifiers,
- char[] source) {
-
- this.declarationSourceStart = declarationSourceStart;
- this.declarationSourceEnd = declarationSourceEnd;
- this.name = name;
- this.onDemand = onDemand;
- this.modifiers = modifiers;
- this.source = source;
-}
-/**
- *
- * @return java.lang.String
- */
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer
- .append(
- source,
- declarationSourceStart,
- declarationSourceEnd - declarationSourceStart + 1)
- .append("\n");
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java
deleted file mode 100644
index e843b72..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class SourceInitializer extends SourceField {
-public SourceInitializer(
- int declarationStart,
- int modifiers) {
- super(declarationStart, modifiers, null, null, -1, -1, null);
-}
-
-public void setDeclarationSourceEnd(int declarationSourceEnd) {
- this.declarationEnd = declarationSourceEnd;
-}
-
-public String toString(int tab) {
- if (modifiers == AccStatic) {
- return tabString(tab) + "static {}";
- }
- return tabString(tab) + "{}";
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java
deleted file mode 100644
index 53c6dfd..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import org.eclipse.jdt.internal.compiler.env.IConstants;
-import org.eclipse.jdt.internal.compiler.env.ISourceMethod;
-
-public class SourceMethod implements ISourceMethod, IConstants {
- private int modifiers;
- private int declarationStart;
- private int declarationEnd;
- private char[] returnTypeName;
- private char[] selector;
- private int nameSourceStart;
- private int nameSourceEnd;
- private char[][] argumentTypeNames;
- private char[][] argumentNames;
- private char[][] exceptionTypeNames;
- private char[] source;
- private String explicitConstructorCall;
-public SourceMethod(
- int declarationStart,
- int modifiers,
- char[] returnTypeName,
- char[] selector,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] argumentTypeNames,
- char[][] argumentNames,
- char[][] exceptionTypeNames,
- char[] source) {
-
- this.declarationStart = declarationStart;
- this.modifiers = modifiers;
- this.returnTypeName = returnTypeName;
- this.selector = selector;
- this.nameSourceStart = nameSourceStart;
- this.nameSourceEnd = nameSourceEnd;
- this.argumentTypeNames = argumentTypeNames;
- this.argumentNames = argumentNames;
- this.exceptionTypeNames = exceptionTypeNames;
- this.source = source;
-}
-public String displayModifiers() {
- StringBuffer buffer = new StringBuffer();
-
- if (this.modifiers == 0)
- return null;
- if ((this.modifiers & AccPublic) != 0)
- buffer.append("public ");
- if ((this.modifiers & AccProtected) != 0)
- buffer.append("protected ");
- if ((this.modifiers & AccPrivate) != 0)
- buffer.append("private ");
- if ((this.modifiers & AccFinal) != 0)
- buffer.append("final ");
- if ((this.modifiers & AccStatic) != 0)
- buffer.append("static ");
- if ((this.modifiers & AccAbstract) != 0)
- buffer.append("abstract ");
- if ((this.modifiers & AccNative) != 0)
- buffer.append("native ");
- if ((this.modifiers & AccSynchronized) != 0)
- buffer.append("synchronized ");
- if (buffer.toString().trim().equals(""))
- return null;
- return buffer.toString().trim();
-}
-public String getActualName() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(source, nameSourceStart, nameSourceEnd - nameSourceStart + 1);
- return buffer.toString();
-}
-public char[][] getArgumentNames() {
- return argumentNames;
-}
-public char[][] getArgumentTypeNames() {
- return argumentTypeNames;
-}
-public int getDeclarationSourceEnd() {
- return declarationEnd;
-}
-public int getDeclarationSourceStart() {
- return declarationStart;
-}
-public char[][] getExceptionTypeNames() {
- return exceptionTypeNames;
-}
-public int getModifiers() {
- return modifiers;
-}
-public int getNameSourceEnd() {
- return nameSourceEnd;
-}
-public int getNameSourceStart() {
- return nameSourceStart;
-}
-public char[] getReturnTypeName() {
- return returnTypeName;
-}
-public char[] getSelector() {
- return selector;
-}
-public boolean isConstructor() {
- return returnTypeName == null;
-}
-protected void setDeclarationSourceEnd(int position) {
- declarationEnd = position;
-}
-protected void setExplicitConstructorCall(String s) {
- explicitConstructorCall = s;
-}
-public String tabString(int tab) {
- /*slow code*/
-
- String s = "";
- for (int i = tab; i > 0; i--)
- s = s + "\t";
- return s;
-}
-public String toString() {
- return toString(0);
-}
-public String toString(int tab) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(tabString(tab));
- String displayModifiers = displayModifiers();
- if (displayModifiers != null) {
- buffer.append(displayModifiers).append(" ");
- }
- if (returnTypeName != null) {
- buffer.append(returnTypeName).append(" ");
- }
- buffer.append(selector).append("(");
- if (argumentTypeNames != null) {
- for (int i = 0, max = argumentTypeNames.length; i < max; i++) {
- buffer.append(argumentTypeNames[i]).append(" ").append(
- argumentNames[i]).append(
- ", ");
- }
- }
- buffer.append(") ");
- if (exceptionTypeNames != null) {
- buffer.append("throws ");
- for (int i = 0, max = exceptionTypeNames.length; i < max; i++) {
- buffer.append(exceptionTypeNames[i]).append(", ");
- }
- }
- if (explicitConstructorCall != null) {
- buffer.append("{\n").append(tabString(tab+1)).append(explicitConstructorCall).append(tabString(tab)).append("}");
- } else {
- buffer.append("{}");
- }
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourcePackage.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourcePackage.java
deleted file mode 100644
index dc2a038..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourcePackage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-public class SourcePackage {
- int declarationSourceStart;
- int declarationSourceEnd;
- char[] name;
- char[] source;
-/**
- * @param declarationSourceStart int
- * @param declarationSourceEnd int
- * @param name char[]
- * @param onDemand boolean
- */
-public SourcePackage(
- int declarationSourceStart,
- int declarationSourceEnd,
- char[] name,
- char[] source) {
-
- this.declarationSourceStart = declarationSourceStart;
- this.declarationSourceEnd = declarationSourceEnd;
- this.name = name;
- this.source = source;
-}
-/**
- *
- * @return java.lang.String
- */
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer
- .append(
- source,
- declarationSourceStart,
- declarationSourceEnd - declarationSourceStart + 1)
- .append("\n");
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java
deleted file mode 100644
index e082a97..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import org.eclipse.jdt.internal.compiler.env.IConstants;
-import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers;
-
-public final class SourceType implements CompilerModifiers, IConstants {
- private int modifiers;
- private int declarationStart;
- private int declarationEnd;
- private char[] fileName;
- private SourcePackage packageName;
- private SourceImport[] imports;
- private char[] enclosingTypeName;
- private char[] name;
- private int nameSourceStart;
- private int nameSourceEnd;
- private char[] superclassName;
- private char[][] interfaceNames;
- private SourceType[] memberTypes;
- private int numberOfMemberTypes;
- private SourceMethod[] methods;
- private int numberOfMethods;
- private SourceField[] fields;
- private int numberOfFields;
- private char[] source;
- SourceType parent;
-
- // Buffering.
- private char[] qualifiedName;
- private String defaultConstructor;
-public SourceType(
- char[] enclosingTypeName,
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[] superclassName,
- char[][] interfaceNames,
- char[] source) {
-
- this.enclosingTypeName = enclosingTypeName;
- this.declarationStart = declarationStart;
-
- this.modifiers = modifiers;
- this.name = name;
- this.nameSourceStart = nameSourceStart;
- this.nameSourceEnd = nameSourceEnd;
- this.superclassName = superclassName;
- this.interfaceNames = interfaceNames;
- this.source = source;
-}
-protected void addField(SourceField sourceField) {
- if (fields == null) {
- fields = new SourceField[4];
- }
-
- if (numberOfFields == fields.length) {
- System.arraycopy(
- fields,
- 0,
- fields = new SourceField[numberOfFields * 2],
- 0,
- numberOfFields);
- }
- fields[numberOfFields++] = sourceField;
-}
-protected void addMemberType(SourceType sourceMemberType) {
- if(memberTypes == null) {
- memberTypes = new SourceType[4];
- }
-
- if(numberOfMemberTypes == memberTypes.length) {
- System.arraycopy(memberTypes, 0, memberTypes = new SourceType[numberOfMemberTypes * 2], 0, numberOfMemberTypes);
- }
- memberTypes[numberOfMemberTypes++] = sourceMemberType;
-}
-protected void addMethod(SourceMethod sourceMethod) {
- if (methods == null) {
- methods = new SourceMethod[4];
- }
-
- if (numberOfMethods == methods.length) {
- System.arraycopy(
- methods,
- 0,
- methods = new SourceMethod[numberOfMethods * 2],
- 0,
- numberOfMethods);
- }
- methods[numberOfMethods++] = sourceMethod;
-}
-public String displayModifiers() {
- StringBuffer buffer = new StringBuffer();
-
- if (this.modifiers == 0)
- return null;
- if ((this.modifiers & AccPublic) != 0)
- buffer.append("public ");
- if ((this.modifiers & AccProtected) != 0)
- buffer.append("protected ");
- if ((this.modifiers & AccPrivate) != 0)
- buffer.append("private ");
- if ((this.modifiers & AccFinal) != 0)
- buffer.append("final ");
- if ((this.modifiers & AccStatic) != 0)
- buffer.append("static ");
- if ((this.modifiers & AccAbstract) != 0)
- buffer.append("abstract ");
- if ((this.modifiers & AccNative) != 0)
- buffer.append("native ");
- if ((this.modifiers & AccSynchronized) != 0)
- buffer.append("synchronized ");
- return buffer.toString().trim();
-}
-public String getActualName() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(source, nameSourceStart, nameSourceEnd - nameSourceStart + 1);
- return buffer.toString();
-}
-public int getDeclarationSourceEnd() {
- return declarationEnd;
-}
-public int getDeclarationSourceStart() {
- return declarationStart;
-}
-public char[] getEnclosingTypeName() {
- return enclosingTypeName;
-}
-public SourceField[] getFields() {
- if (fields != null && fields.length != numberOfFields) {
- System.arraycopy(fields, 0, fields = new SourceField[numberOfFields], 0, numberOfFields);
- }
- return fields;
-}
-public char[] getFileName() {
- return fileName;
-}
-public char[][] getImports() {
- if (imports == null) return null;
- int importLength = imports.length;
- char[][] importNames = new char[importLength][];
- for (int i = 0, max = importLength; i < max; i++) {
- importNames[i] = imports[i].name;
- }
- return importNames;
-}
-public char[][] getInterfaceNames() {
- return interfaceNames;
-}
-public SourceType[] getMemberTypes() {
- if (memberTypes != null && memberTypes.length != numberOfMemberTypes) {
- System.arraycopy(
- memberTypes,
- 0,
- memberTypes = new SourceType[numberOfMemberTypes],
- 0,
- numberOfMemberTypes);
- }
- return memberTypes;
-}
-public SourceMethod[] getMethods() {
- if (methods != null && methods.length != numberOfMethods) {
- System.arraycopy(methods, 0, methods = new SourceMethod[numberOfMethods], 0, numberOfMethods);
- }
- return methods;
-}
-public int getModifiers() {
- return modifiers;
-}
-public char[] getName() {
- return name;
-}
-public int getNameSourceEnd() {
- return nameSourceEnd;
-}
-public int getNameSourceStart() {
- return nameSourceStart;
-}
-public char[] getPackageName() {
- return packageName.name;
-}
-public char[] getQualifiedName() {
- if (qualifiedName == null) {
- StringBuffer temp = new StringBuffer();
- temp.append(packageName);
- temp.append('.');
- temp.append(name);
- qualifiedName = temp.toString().toCharArray();
- }
- return qualifiedName;
-}
-public char[] getSuperclassName() {
- return superclassName;
-}
-public boolean isBinaryType() {
- return false;
-}
-public boolean isClass() {
- return (modifiers & AccInterface) == 0;
-}
-public boolean isInterface() {
- return (modifiers & AccInterface) == AccInterface;
-}
-public void setDeclarationSourceEnd(int position) {
- declarationEnd = position;
-}
-public void setDefaultConstructor(String s) {
- this.defaultConstructor = s;
-}
-public void setImports(SourceImport[] imports) {
- this.imports = imports;
-}
-public void setPackage(SourcePackage sourcePackage) {
- packageName = sourcePackage;
-}
-public void setSuperclass(char[] superclassName) {
- this.superclassName = superclassName;
-}
-public void setSuperinterfaces(char[][] superinterfacesNames) {
- this.interfaceNames = superinterfacesNames;
-}
-public String tabString(int tab) {
- /*slow code*/
-
- String s = "";
- for (int i = tab; i > 0; i--)
- s = s + "\t";
- return s;
-}
-public String toString() {
- return toString(0);
-}
-public String toString(int tab) {
-
- StringBuffer buffer = new StringBuffer();
- if (packageName != null) {
- buffer.append(tabString(tab)).append(packageName);
- }
- if (imports != null) {
- for (int i = 0, max = imports.length; i < max; i++) {
- buffer.append(tabString(tab)).append(imports[i]);
- }
- }
- buffer.append(tabString(tab));
- String displayModifiers = displayModifiers();
- if (displayModifiers != null) {
- buffer.append(displayModifiers).append(" ");
- }
- buffer.append(isInterface() ? "interface " : "class ").append(name).append(" ");
- if (superclassName != null) {
- buffer.append("extends ").append(superclassName).append(" ");
- }
- if (interfaceNames != null) {
- buffer.append("implements ");
- for (int i = 0, max = interfaceNames.length; i < max; i++) {
- buffer.append(interfaceNames[i]).append(", ");
- }
- }
- buffer.append("{\n");
- if (memberTypes != null) {
- for (int i = 0, max = numberOfMemberTypes; i < max; i++) {
- buffer.append(memberTypes[i].toString(tab + 1)).append("\n");
- }
- }
- if (fields != null) {
- for (int i = 0, max = numberOfFields; i < max; i++) {
- buffer.append(fields[i].toString(tab + 1)).append("\n");
- }
- }
- if (defaultConstructor != null) {
- buffer.append(tabString(tab + 1)).append(defaultConstructor);
- }
- if (methods != null) {
- for (int i = 0, max = numberOfMethods; i < max; i++) {
- buffer.append(methods[i].toString(tab + 1)).append("\n");
- }
- }
- buffer.append(tabString(tab)).append("}");
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java
deleted file mode 100644
index a29606a..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import java.util.Locale;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
-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.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;
-
-public class SyntaxErrorTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
- public static boolean optimizeStringLiterals = false;
- public static long sourceLevel = CompilerOptions.JDK1_3; //$NON-NLS-1$
-
- public SyntaxErrorTest(String testName){
- super(testName);
-}
-public void checkParse(
- char[] source,
- String expectedSyntaxErrorDiagnosis,
- String testName) {
-
- /* using regular parser in DIET mode */
- Parser parser =
- new Parser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(),
- new DefaultProblemFactory(Locale.getDefault())),
- optimizeStringLiterals,
- sourceLevel);
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
- parser.parse(sourceUnit, compilationResult);
-
- StringBuffer buffer = new StringBuffer(100);
- if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
- IProblem[] problems = compilationResult.getAllProblems();
- int count = problems.length;
- int problemCount = 0;
- 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()));
- try {
- buffer.append(((DefaultProblem)problems[i]).errorReportSource(compilationResult.compilationUnit));
- buffer.append("\n");
- buffer.append(problems[i].getMessage());
- buffer.append("\n");
- } catch (Exception e) {
- }
- buffer.append("----------\n");
- }
- };
- }
- String computedSyntaxErrorDiagnosis = buffer.toString();
- //System.out.println(Util.displayString(computedSyntaxErrorDiagnosis));
- assertEquals(
- "Invalid syntax error diagnosis" + testName,
- expectedSyntaxErrorDiagnosis,
- computedSyntaxErrorDiagnosis);
-}
-/*
- * Should diagnose parenthesis mismatch
- */
-public void test01() {
-
- String s =
- "public class X { \n"+
- " public void solve(){ \n"+
- " \n"+
- " X[] results = new X[10]; \n"+
- " for(int i = 0; i < 10; i++){ \n"+
- " X result = results[i]; \n"+
- " boolean found = false; \n"+
- " for(int j = 0; j < 10; j++){ \n"+
- " if (this.equals(result.documentName){ \n"+
- " found = true; \n"+
- " break; \n"+
- " } \n"+
- " } \n"+
- " } \n"+
- " return andResult; \n"+
- " } \n"+
- "} \n";
-
- String expectedSyntaxErrorDiagnosis =
- "----------\n" +
- "1. ERROR in <parenthesis mismatch> (at line 9)\n" +
- " if (this.equals(result.documentName){ \n" +
- " ^\n" +
- "Unmatched bracket\n" +
- "----------\n" +
- "2. ERROR in <parenthesis mismatch> (at line 9)\n" +
- " if (this.equals(result.documentName){ \n" +
- " ^\n" +
- "Syntax error on token \"{\", \")\" expected\n" +
- "----------\n";
-
- String testName = "<parenthesis mismatch>";
- checkParse(
- s.toCharArray(),
- expectedSyntaxErrorDiagnosis,
- testName);
-}
-/*
- * Should diagnose brace mismatch
- */
-public void test02() {
-
- String s =
- "class Bar { \n"+
- " Bar() { \n"+
- " this(fred().x{);\n"+
- " } \n"+
- "} \n";
-
- String expectedSyntaxErrorDiagnosis =
- "----------\n" +
- "1. ERROR in <brace mismatch> (at line 3)\n" +
- " this(fred().x{);\n" +
- " ^\n" +
- "Unmatched bracket\n" +
- "----------\n" +
- "2. ERROR in <brace mismatch> (at line 3)\n" +
- " this(fred().x{);\n" +
- " ^\n" +
- "Syntax error on token \"{\", \")\" expected\n" +
- "----------\n";
-
- String testName = "<brace mismatch>";
- checkParse(
- s.toCharArray(),
- expectedSyntaxErrorDiagnosis,
- testName);
-}
-/*
- * Should diagnose parenthesis mismatch
- */
-public void test03() {
-
- String s =
- "public class X { // should complain \n"+
- " int foo( \n"+
- " [ arg1, \n"+
- " { arg2, ] \n"+
- " arg3, \n"+
- " ){ \n"+
- " } \n"+
- "} \n";
-
- String expectedSyntaxErrorDiagnosis =
- "----------\n" +
- "1. ERROR in <parenthesis mismatch> (at line 2)\n" +
- " int foo( \n" +
- " ^\n" +
- "Unmatched bracket\n" +
- "----------\n" +
- "2. ERROR in <parenthesis mismatch> (at line 3)\n" +
- " [ arg1, \n" +
- " ^\n" +
- "Syntax error on token \"[\", \"float\", \"double\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"boolean\", \"void\", \"Identifier\" expected\n" +
- "----------\n";
-
- String testName = "<parenthesis mismatch>";
- checkParse(
- s.toCharArray(),
- expectedSyntaxErrorDiagnosis,
- testName);
-}
-/*
- * Should not diagnose parenthesis mismatch
- */
-public void test04() {
-
- String s =
- "public class X { // should not complain \n"+
- " int foo( \n"+
- " { arg1, \n"+
- " { arg2, } \n"+
- " arg3, } \n"+
- " ){ \n"+
- " } \n"+
- "} \n";
-
- String expectedSyntaxErrorDiagnosis =
- "----------\n" +
- "1. ERROR in <no parenthesis mismatch> (at line 3)\n" +
- " { arg1, \n" +
- " ^\n" +
- "Syntax error on token \"{\", \"float\", \"double\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"boolean\", \"void\", \"Identifier\" expected\n" +
- "----------\n";
-
- String testName = "<no parenthesis mismatch>";
- checkParse(
- s.toCharArray(),
- expectedSyntaxErrorDiagnosis,
- testName);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
deleted file mode 100644
index 748f62f..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.jdt.core.tests.junit.extension.ExcludedTestSuite;
-
-/**
- * Run all parser regression tests
- */
-public class TestAll extends TestCase {
- public static boolean EXPERT; // an expert doesn't exclude any tests
- public static String[] EXCLUDED_TESTS = new String[] {
- "CompletionParserTest", "testVB_2", // completion on field access on anonymous inner class with syntax error
- "CompletionParserTest", "testVB_4", // completion on field access on anonymous inner class with syntax error
- "CompletionParserTest", "testVB_5", // completion on field access on anonymous inner class with syntax error
- "LabelStatementCompletionTest", "testInLabeledInnerClassWithErrorBefore", // cannot get labels in recovery mode yet
- };
-/**
- * TestAll constructor comment.
- * @param testName java.lang.String
- */
-public TestAll(String testName) {
- super(testName);
-}
-/**
- * Adds all the tests in the given class to the suite except
- * the ones that are excluded.
- */
-public static void addTest(TestSuite suite, Class testClass) {
- TestSuite innerSuite = new TestSuite(testClass);
- suite.addTest(innerSuite);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite(TestAll.class.getName());
-
- /* completion tests */
- addTest(suite, AllocationExpressionCompletionTest.class);
- addTest(suite, ClassLiteralAccessCompletionTest.class);
- addTest(suite, CompletionParserTest.class);
- addTest(suite, CompletionRecoveryTest.class);
- addTest(suite, DietCompletionTest.class);
- addTest(suite, ExplicitConstructorInvocationCompletionTest.class);
- addTest(suite, FieldAccessCompletionTest.class);
- addTest(suite, InnerTypeCompletionTest.class);
- addTest(suite, LabelStatementCompletionTest.class);
- addTest(suite, MethodInvocationCompletionTest.class);
- addTest(suite, NameReferenceCompletionTest.class);
- addTest(suite, ReferenceTypeCompletionTest.class);
- addTest(suite, CompletionParserTest2.class);
- addTest(suite, CompletionParserTestKeyword.class);
-
- /* selection tests */
- addTest(suite, ExplicitConstructorInvocationSelectionTest.class);
- addTest(suite, SelectionTest.class);
- addTest(suite, SelectionTest2.class);
-
- /* recovery tests */
- addTest(suite, DietRecoveryTest.class);
-
- /* source element parser tests */
- addTest(suite, SourceElementParserTest.class);
-
- /* syntax error diagnosis tests */
- addTest(suite, SyntaxErrorTest.class);
-
- if (EXPERT) {
- return suite;
- } else {
- return new ExcludedTestSuite(suite, EXCLUDED_TESTS);
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java
deleted file mode 100644
index 112c908..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.parser;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
-
-public class TestSourceElementRequestor implements ISourceElementRequestor {
-/**
- * DummySourceElementRequestor constructor comment.
- */
-public TestSourceElementRequestor() {
- super();
-}
-/**
- * acceptConstructorReference method comment.
- */
-public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition) {}
-/**
- * acceptFieldReference method comment.
- */
-public void acceptFieldReference(char[] fieldName, int sourcePosition) {}
-/**
- * acceptImport method comment.
- */
-public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand, int modifiers) {}
-/**
- * acceptLineSeparatorPositions method comment.
- */
-public void acceptLineSeparatorPositions(int[] positions) {}
-/**
- * acceptMethodReference method comment.
- */
-public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition) {}
-/**
- * acceptPackage method comment.
- */
-public void acceptPackage(int declarationStart, int declarationEnd, char[] name) {}
-/**
- * acceptProblem method comment.
- */
-public void acceptProblem(IProblem problem) {}
-/**
- * acceptTypeReference method comment.
- */
-public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {}
-/**
- * acceptTypeReference method comment.
- */
-public void acceptTypeReference(char[] typeName, int sourcePosition) {}
-/**
- * acceptUnknownReference method comment.
- */
-public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {}
-/**
- * acceptUnknownReference method comment.
- */
-public void acceptUnknownReference(char[] name, int sourcePosition) {}
-/**
- * enterClass method comment.
- */
-public void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces) {}
-/**
- * enterCompilationUnit method comment.
- */
-public void enterCompilationUnit() {}
-/**
- * enterConstructor method comment.
- */
-public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {}
-/**
- * enterField method comment.
- */
-public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd) {}
-/**
- * enterInterface method comment.
- */
-public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces) {}
-/**
- * enterMethod method comment.
- */
-public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {}
-/**
- * exitClass method comment.
- */
-public void exitClass(int declarationEnd) {}
-/**
- * exitCompilationUnit method comment.
- */
-public void exitCompilationUnit(int declarationEnd) {}
-/**
- * exitConstructor method comment.
- */
-public void exitConstructor(int declarationEnd) {}
-/**
- * exitField method comment.
- */
-public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {}
-/**
- * exitInterface method comment.
- */
-public void exitInterface(int declarationEnd) {}
-/**
- * exitMethod method comment.
- */
-public void exitMethod(int declarationEnd) {}
-
-/**
- * enterInitializer method comment.
- */
-public void enterInitializer(int sourceStart, int sourceEnd) {
-}
-
-/**
- * exitInitializer method comment.
- */
-public void exitInitializer(int sourceEnd) {
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
deleted file mode 100644
index 0213e47..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.core.tests.junit.extension.StopableTestCase;
-import org.eclipse.jdt.core.tests.util.*;
-import org.eclipse.jdt.internal.compiler.*;
-import org.eclipse.jdt.internal.compiler.batch.*;
-import org.eclipse.jdt.internal.compiler.Compiler;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-
-import java.io.*;
-import java.util.*;
-import junit.framework.*;
-
-public abstract class AbstractRegressionTest extends StopableTestCase {
- public static String OUTPUT_DIR = Util.getOutputDirectory() + File.separator + "regression";
- public static String JAVA_CLASS_LIB_PATH = Util.getJavaClassLib();
-
- protected INameEnvironment javaClassLib;
- protected String[] classpaths;
- protected TestVerifier verifier;
- protected boolean createdVerifier;
-public AbstractRegressionTest(String name) {
- super(name);
-}
-protected CompilationUnit[] compilationUnits(String[] testFiles) {
- int length = (int)(testFiles.length / 2);
- CompilationUnit[] result = new CompilationUnit[length];
- int index = 0;
- for (int i = 0; i < length; i++) {
- result[i] = new CompilationUnit(testFiles[index + 1].toCharArray(), testFiles[index], null);
- index += 2;
- }
- return result;
-}
-protected INameEnvironment[] getClassLibs() {
- String encoding = (String) getCompilerOptions().get(CompilerOptions.OPTION_Encoding);
- if ("".equals(encoding)) encoding = null;
-
- int length = this.classpaths.length;
- INameEnvironment[] classLibs = new INameEnvironment[length];
- for (int i = 0; i < length; i++) {
- String classpath = this.classpaths[i];
- if (classpath.equals(JAVA_CLASS_LIB_PATH)) {
- if (this.javaClassLib == null) {
- this.javaClassLib =
- new FileSystem(
- new String[] {classpath},
- new String[] {}, // ignore initial file names
- encoding // default encoding
- );
- }
- classLibs[i] = this.javaClassLib;
- } else {
- classLibs[i] =
- new FileSystem(
- new String[] {classpath},
- new String[] {}, // ignore initial file names
- encoding // default encoding
- );
- }
- }
- return classLibs;
-}
-protected Map getCompilerOptions() {
- Map defaultOptions = Main.getDefaultOptions();
- defaultOptions.put(
- CompilerOptions.OPTION_LocalVariableAttribute,
- CompilerOptions.GENERATE);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportUnusedPrivateMember,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportLocalVariableHiding,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportFieldHiding,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_PreserveUnusedLocal,
- CompilerOptions.PRESERVE);
- return defaultOptions;
-}
-protected String[] getDefaultClassPaths() {
- return new String[] {JAVA_CLASS_LIB_PATH, OUTPUT_DIR};
-}
-protected IErrorHandlingPolicy getErrorHandlingPolicy() {
- return new IErrorHandlingPolicy() {
- public boolean stopOnFirstError() {
- return false;
- }
- public boolean proceedOnErrors() {
- return true;
- }
- };
-}
-/*
- * Will consider first the source units passed as arguments, then
- * investigate the classpath: jdklib + output dir
- */
-protected INameEnvironment getNameEnvironment(final String[] testFiles, String[] classPaths) {
- this.classpaths =
- classPaths == null ?
- this.getDefaultClassPaths() :
- classPaths;
- return
- new InMemoryNameEnvironment(
- testFiles,
- this.getClassLibs()
- );
-}
-protected IProblemFactory getProblemFactory() {
- return new DefaultProblemFactory(Locale.getDefault());
-}
-protected Requestor getRequestor(IProblemFactory problemFactory) {
- return new Requestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator, false);
-}
-
-protected Requestor getRequestor(IProblemFactory problemFactory, boolean generateOutPut) {
- return new Requestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator, generateOutPut);
-}
-
-protected void runConformTest(String[] testFiles) {
- this.runConformTest(testFiles, null, null, true, null);
-}
-
-protected void runConformTest(String[] testFiles, String[] vmArguments) {
- this.runConformTest(testFiles, null, null, true, vmArguments);
-}
-protected void runConformTest(String[] testFiles, String expectedSuccessOutputString, String[] vmArguments) {
- this.runConformTest(testFiles, expectedSuccessOutputString, null, true, vmArguments);
-}
-
-protected void runConformTest(String[] testFiles, String expectedSuccessOutputString) {
- this.runConformTest(testFiles, expectedSuccessOutputString, null, true, null);
-}
-protected void runConformTest(String[] testFiles, String expectedSuccessOutputString, String[] classLib, boolean shouldFlushOutputDirectory, String[] vmArguments) {
- this.runConformTest( testFiles, expectedSuccessOutputString, classLib, shouldFlushOutputDirectory, vmArguments, null);
-}
-
-protected void runConformTest(String[] testFiles, String expectedSuccessOutputString, String[] classLib, boolean shouldFlushOutputDirectory, String[] vmArguments, Map customOptions) {
-
- if (shouldFlushOutputDirectory) Util.flushDirectoryContent(new File(OUTPUT_DIR));
-
- IProblemFactory problemFactory = getProblemFactory();
- LogRequestor requestor = new LogRequestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator);
-
- Map options = getCompilerOptions();
- if (customOptions != null){
- options.putAll(customOptions);
- }
- Compiler batchCompiler =
- new Compiler(
- getNameEnvironment(new String[] {}, classLib),
- getErrorHandlingPolicy(),
- options,
- requestor,
- problemFactory);
- batchCompiler.compile(compilationUnits(testFiles)); // compile all files together
- if (!requestor.hasErrors) {
- String sourceFile = testFiles[0];
-
- // Compute class name by removing ".java" and replacing slashes with dots
- String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.');
-
- if (vmArguments != null) {
- if (this.verifier != null) {
- this.verifier.shutDown();
- }
- this.verifier = new TestVerifier(false);
- this.createdVerifier = true;
- }
- boolean passed = this.verifier.verifyClassFiles(sourceFile, className, expectedSuccessOutputString, this.classpaths, null, vmArguments);
- assertTrue(
- this.verifier.failureReason, // computed by verifyClassFiles(...) action
- passed
- );
- if (vmArguments != null) {
- if (this.verifier != null) {
- this.verifier.shutDown();
- }
- this.verifier = new TestVerifier(false);
- this.createdVerifier = true;
- }
- } else {
- assertTrue("Unexpected problems: " + requestor.problemLog, false);
- }
-}
-
-protected void runConformTestThrowingError(String[] testFiles, String expectedSuccessOutputString, String[] classLib, boolean shouldFlushOutputDirectory, String[] vmArguments) {
-
- if (shouldFlushOutputDirectory) Util.flushDirectoryContent(new File(OUTPUT_DIR));
-
- IProblemFactory problemFactory = getProblemFactory();
- LogRequestor requestor = new LogRequestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator);
- Compiler batchCompiler =
- new Compiler(
- getNameEnvironment(new String[] {}, classLib),
- getErrorHandlingPolicy(),
- getCompilerOptions(),
- requestor,
- problemFactory);
- batchCompiler.compile(compilationUnits(testFiles)); // compile all files together
- if (!requestor.hasErrors) {
- String sourceFile = testFiles[0];
-
- // Compute class name by removing ".java" and replacing slashes with dots
- String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.');
-
- boolean passed = this.verifier.verifyClassFilesThrowingError(sourceFile, className, expectedSuccessOutputString, this.classpaths, null, vmArguments);
- assertTrue(
- this.verifier.failureReason, // computed by verifyClassFiles(...) action
- passed
- );
- } else {
- assertTrue("Unexpected problems: " + requestor.problemLog, false);
- }
-}
-
-protected void runNegativeTest(String[] testFiles, ExpectedProblem[] expectedProblems) {
- this.runNegativeTest(testFiles, expectedProblems, null, true);
-}
-protected void runNegativeTest(String[] testFiles, ExpectedProblem[] expectedProblems, String[] classLib, boolean shouldFlushOutputDirectory) {
-
- if (shouldFlushOutputDirectory) Util.flushDirectoryContent(new File(OUTPUT_DIR));
-
- IProblemFactory problemFactory = getProblemFactory();
- Requestor requestor = getRequestor(problemFactory);
- requestor.expectedProblems(expectedProblems);
- Compiler batchCompiler =
- new Compiler(
- getNameEnvironment(new String[] {}, classLib),
- getErrorHandlingPolicy(),
- getCompilerOptions(),
- requestor,
- problemFactory);
- batchCompiler.compile(compilationUnits(testFiles)); // compile all files together
- if (!requestor.hasErrors) {
- String sourceFile = testFiles[0];
-
- // Compute class name by removing ".java" and replacing slashes with dots
- String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.');
-
- assertTrue(
- this.verifier.failureReason,
- this.verifier.verifyClassFiles(sourceFile, className, null, this.classpaths)
- );
- }
-}
-protected void runNegativeTest(String[] testFiles, ExpectedProblem[] expectedProblems, String[] classLib, boolean shouldFlushOutputDirectory, boolean generateOutput) {
-
-
- if (shouldFlushOutputDirectory) Util.flushDirectoryContent(new File(OUTPUT_DIR));
-
-
- IProblemFactory problemFactory = getProblemFactory();
- Requestor requestor = getRequestor(problemFactory, generateOutput);
- requestor.expectedProblems(expectedProblems);
- Compiler batchCompiler =
- new Compiler(
- getNameEnvironment(new String[] {}, classLib),
- getErrorHandlingPolicy(),
- getCompilerOptions(),
- requestor,
- problemFactory);
- batchCompiler.compile(compilationUnits(testFiles)); // compile all files together
- if (!requestor.hasErrors) {
- String sourceFile = testFiles[0];
-
- // Compute class name by removing ".java" and replacing slashes with dots
- String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.');
-
- assertTrue(
- this.verifier.failureReason,
- this.verifier.verifyClassFiles(sourceFile, className, null, this.classpaths)
- );
- }
-}
-
-/**
- * Log contains all problems (warnings+errors)
- */
-protected void runNegativeTest(String[] testFiles, String expectedProblemLog) {
- this.runNegativeTest(testFiles, expectedProblemLog, null, true);
-}
-
-/**
- * Log contains all problems (warnings+errors)
- */
-protected void runNegativeTest(String[] testFiles, String expectedProblemLog, String[] classLib, boolean shouldFlushOutputDirectory) {
- this.runNegativeTest(testFiles, expectedProblemLog, classLib, shouldFlushOutputDirectory, null);
-}
-/**
- * Log contains all problems (warnings+errors)
- */
-protected void runNegativeTest(String[] testFiles, String expectedProblemLog, String[] classLib, boolean shouldFlushOutputDirectory, Map customOptions) {
-
- if (shouldFlushOutputDirectory) Util.flushDirectoryContent(new File(OUTPUT_DIR));
-
- IProblemFactory problemFactory = getProblemFactory();
- LogRequestor requestor = new LogRequestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator);
- Map options = getCompilerOptions();
- if (customOptions != null){
- options.putAll(customOptions);
- }
- Compiler batchCompiler =
- new Compiler(
- getNameEnvironment(new String[] {}, classLib),
- getErrorHandlingPolicy(),
- options,
- requestor,
- problemFactory);
- batchCompiler.compile(compilationUnits(testFiles)); // compile all files together
-
- String computedProblemLog = requestor.problemLog.toString();
- if (!expectedProblemLog.equals(computedProblemLog)){
- System.out.println(Util.displayString(computedProblemLog, 2));
- }
- assertEquals(
- "Invalid problem log ",
- expectedProblemLog,
- computedProblemLog);
-}
-protected void setUp() throws Exception {
- if (this.verifier == null) {
- this.verifier = new TestVerifier(true);
- this.createdVerifier = true;
- }
-}
-public static Test setupSuite(Class clazz) {
- return new RegressionTestSetup(suite(clazz));
-}
-public void stop() {
- this.verifier.shutDown();
-}
-public static Test suite(Class evaluationTestClass) {
- TestSuite suite = new TestSuite(evaluationTestClass);
- return suite;
-}
-protected void tearDown() throws Exception {
- if (this.createdVerifier) {
- this.stop();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java
deleted file mode 100644
index 2d277b9..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-
-public class AssertionTest extends AbstractRegressionTest {
-
- /*
- * Toggle compiler in mode -1.4
- */
- protected Map getCompilerOptions() {
- Map options = super.getCompilerOptions();
- options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
- options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
- return options;
- }
-
- public AssertionTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return setupSuite(testClass());
- }
-
- public static Class testClass() {
- return AssertionTest.class;
- }
-
- public void testAssertAsAnIdentifier() {
- this.runNegativeTest(
- new String[] {
- "assert.java",
- "public class assert {}\n",
- },
- "----------\n" +
- "1. ERROR in assert.java (at line 1)\n" +
- " public class assert {}\n" +
- " ^^^^^^\n" +
- "Syntax error on keyword \"assert\"; \"Identifier\" expected\n" +
- "----------\n");
- }
-
- public void testAssertionEnabled() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " int i = 4;\n"
- + " assert i != 4;\n"
- + " System.out.println(i);\n"
- + " } catch(AssertionError e){ \n"
- + " System.out.print(\"SUCCESS\"); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "SUCCESS", //expected display
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-ea"});
- }
-
- public void testAssertionDisabled() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " int i = 4;\n"
- + " assert i != 4;\n"
- + " System.out.println(i);\n"
- + " } \n"
- + "} \n" },
- "4",
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-da"});
- }
- public void testAssertionWithObjectArguments() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " assert false : \"SUC\"; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.print(e.getMessage()); \n"
- + " } \n"
- + " try { \n"
- + " assert false : new Object(){ public String toString(){ return \"CESS\";}}; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.println(e.getMessage()); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "SUCCESS", //expected display
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-ea"});
- }
- public void testAssertionWithIntArguments() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " assert false : 1; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.print(e.getMessage()); \n"
- + " } \n"
- + " try { \n"
- + " int i = 2; \n"
- + " assert false : i; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.println(e.getMessage()); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "12", //expected display
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-ea"});
- }
- public void testAssertionWithUnboundVariable() {
- this.runNegativeTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " assert false : unbound; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.println(e.getMessage()); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "----------\n" +
- "1. ERROR in A4.java (at line 4)\n" +
- " assert false : unbound; \n" +
- " ^^^^^^^\n" +
- "unbound cannot be resolved\n" +
- "----------\n");
- }
- public void testAssertionWithLongArguments() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " assert false : 1L; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.print(e.getMessage()); \n"
- + " } \n"
- + " try { \n"
- + " assert false : 0L; \n" // 0L isn't 0
- + " } catch(AssertionError e){ \n"
- + " System.out.print(e.getMessage()); \n"
- + " } \n"
- + " try { \n"
- + " long l = 2L; \n"
- + " assert false : l; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.println(e.getMessage()); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "102", //expected display
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-ea"});
- }
- public void testAssertionWithFloatArguments() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " assert false : 1.0f; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.print(e.getMessage()); \n"
- + " } \n"
- + " try { \n"
- + " float f = 2.0f; \n"
- + " assert false : f; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.println(e.getMessage()); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "1.02.0", //expected display
- null, // use default class-path
- true, // do not flush previous output dir content
- new String[] {"-ea"});
- }
- public void testAssertionWithDoubleArguments() {
- this.runConformTest(new String[] {
- "A4.java",
- "public class A4 { \n"
- + " public static void main(String[] args) {\n"
- + " try { \n"
- + " assert false : 1.0; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.print(e.getMessage()); \n"
- + " } \n"
- + " try { \n"
- + " double d = 2.0; \n"
- + " assert false : d; \n"
- + " } catch(AssertionError e){ \n"
- + " System.out.println(e.getMessage()); \n"
- + " } \n"
- + " } \n"
- + "} \n" },
- "1.02.0", //expected display
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-ea"});
- }
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=22334
- public void testAssertionInInterfaceStaticMember() {
- this.runConformTest(new String[] {
- "X.java",
- "public class X { \n" +
- " public static void main(String[] args) { \n" +
- " I.Inner inner = new I.Inner(); \n" +
- " try { \n" +
- " inner.test(); \n" +
- " System.out.println(\"FAILED\"); \n" +
- " } catch(AssertionError e){ \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n" +
- "} \n" +
- "interface I { \n" +
- " public static class Inner { \n" +
- " public void test() { \n" +
- " assert false; \n" +
- " } \n" +
- " } \n" +
- "} \n" },
- "SUCCESS",
- null, // use default class-path
- true, // flush previous output dir content
- new String[] {"-ea"});
- }
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
deleted file mode 100644
index 4b04cd0..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.internal.compiler.batch.Main;
-
-public class BatchCompilerTest extends AbstractRegressionTest {
-public BatchCompilerTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public void test01() {
-
- String commandLine = "-classpath \"D:/a folder\";d:/jdk1.4/jre/lib/rt.jar -1.4 -preserveAllLocals -g -verbose d:/eclipse/workspaces/development2.0/plugins/Bar/src2/ -d d:/test";
- String expected = " <-classpath> <D:/a folder;d:/jdk1.4/jre/lib/rt.jar> <-1.4> <-preserveAllLocals> <-g> <-verbose> <d:/eclipse/workspaces/development2.0/plugins/Bar/src2/> <-d> <d:/test>";
-
- String[] args = Main.tokenize(commandLine);
- StringBuffer buffer = new StringBuffer(30);
- for (int i = 0; i < args.length; i++){
- buffer.append(" <"+args[i]+">");
- }
- String result = buffer.toString();
- //System.out.println(Util.displayString(result, 2));
- assertEquals("incorrect tokenized command line",
- expected,
- result);
-}
-public void test02() {
-
- String commandLine = "-classpath \"a folder\";\"b folder\"";
- String expected = " <-classpath> <a folder;b folder>";
-
- String[] args = Main.tokenize(commandLine);
- StringBuffer buffer = new StringBuffer(30);
- for (int i = 0; i < args.length; i++){
- buffer.append(" <"+args[i]+">");
- }
- String result = buffer.toString();
- //System.out.println(Util.displayString(result, 2));
- assertEquals("incorrect tokenized command line",
- expected,
- result);
-}
-public void test03() {
-
- String commandLine = "-classpath \"a folder;b folder\"";
- String expected = " <-classpath> <a folder;b folder>";
-
- String[] args = Main.tokenize(commandLine);
- StringBuffer buffer = new StringBuffer(30);
- for (int i = 0; i < args.length; i++){
- buffer.append(" <"+args[i]+">");
- }
- String result = buffer.toString();
- //System.out.println(Util.displayString(result, 2));
- assertEquals("incorrect tokenized command line",
- expected,
- result);
-}
-public void test04() {
-
- String commandLine = "\"d:/tmp A/\"A.java -classpath \"d:/tmp A\";d:/jars/rt.jar -nowarn -time -g -d d:/tmp";
- String expected = " <d:/tmp A/A.java> <-classpath> <d:/tmp A;d:/jars/rt.jar> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
-
- String[] args = Main.tokenize(commandLine);
- StringBuffer buffer = new StringBuffer(30);
- for (int i = 0; i < args.length; i++){
- buffer.append(" <"+args[i]+">");
- }
- String result = buffer.toString();
- //System.out.println(Util.displayString(result, 2));
- assertEquals("incorrect tokenized command line",
- expected,
- result);
-}
-public void test05() {
-
- String commandLine = "\"d:/tmp A/\"A.java -classpath d:/jars/rt.jar;\"d:/tmp A\";\"toto\" -nowarn -time -g -d d:/tmp";
- String expected = " <d:/tmp A/A.java> <-classpath> <d:/jars/rt.jar;d:/tmp A;toto> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
-
- String[] args = Main.tokenize(commandLine);
- StringBuffer buffer = new StringBuffer(30);
- for (int i = 0; i < args.length; i++){
- buffer.append(" <"+args[i]+">");
- }
- String result = buffer.toString();
- //System.out.println(Util.displayString(result, 2));
- assertEquals("incorrect tokenized command line",
- expected,
- result);
-}
-public void test06() {
-
- String commandLine = "\"d:/tmp A/A.java\" -classpath d:/jars/rt.jar;\"d:/tmp A\";d:/tmpB/ -nowarn -time -g -d d:/tmp";
- String expected = " <d:/tmp A/A.java> <-classpath> <d:/jars/rt.jar;d:/tmp A;d:/tmpB/> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
-
- String[] args = Main.tokenize(commandLine);
- StringBuffer buffer = new StringBuffer(30);
- for (int i = 0; i < args.length; i++){
- buffer.append(" <"+args[i]+">");
- }
- String result = buffer.toString();
- //System.out.println(Util.displayString(result, 2));
- assertEquals("incorrect tokenized command line",
- expected,
- result);
-}
-public static Class testClass() {
- return BatchCompilerTest.class;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileComparatorTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileComparatorTest.java
deleted file mode 100644
index 12fe950..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileComparatorTest.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import junit.framework.Test;
-import java.io.*;
-import junit.framework.Assert;
-
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
-
-public class ClassFileComparatorTest extends AbstractRegressionTest {
- private static final String SOURCE_DIRECTORY = Util.getOutputDirectory() + File.separator + "source";
- private static final String EVAL_DIRECTORY = Util.getOutputDirectory() + File.separator + "eval";
-
- public ClassFileComparatorTest(String name) {
- super(name);
- }
- public static Test suite() {
- return setupSuite(testClass());
- }
-
- public static Class testClass() {
- return ClassFileComparatorTest.class;
- }
-
- public void removeTempClass(String className) {
- File dir = new File(SOURCE_DIRECTORY);
- String[] fileNames = dir.list();
- if (fileNames != null) {
- for (int i = 0, max = fileNames.length; i < max; i++) {
- if (fileNames[i].indexOf(className) != -1) {
- new File(SOURCE_DIRECTORY + File.separator + fileNames[i]).delete();
- }
- }
- }
-
- dir = new File(EVAL_DIRECTORY);
- fileNames = dir.list();
- if (fileNames != null) {
- for (int i = 0, max = fileNames.length; i < max; i++) {
- if (fileNames[i].indexOf(className) != -1) {
- new File(EVAL_DIRECTORY + File.separator + fileNames[i]).delete();
- }
- }
- }
-
- }
-
- public void compileAndDeploy(String source, String className) {
- File directory = new File(SOURCE_DIRECTORY);
- if (!directory.exists()) {
- if (!directory.mkdirs()) {
- System.out.println("Could not create " + SOURCE_DIRECTORY);
- return;
- }
- }
- String fileName = SOURCE_DIRECTORY + File.separator + className + ".java";
- try {
- BufferedWriter writer = new BufferedWriter(new FileWriter(fileName));
- writer.write(source);
- writer.flush();
- writer.close();
- } catch (IOException e) {
- e.printStackTrace();
- return;
- }
- StringBuffer buffer = new StringBuffer();
- buffer
- .append("\"")
- .append(fileName)
- .append("\" -d \"")
- .append(EVAL_DIRECTORY)
- .append("\" -nowarn -g -classpath \"")
- .append(Util.getJREDirectory() + "/lib/rt.jar;")
- .append(SOURCE_DIRECTORY)
- .append("\"");
- org.eclipse.jdt.internal.compiler.batch.Main.compile(buffer.toString());
- }
-
- public boolean areStructurallyDifferent(String classFile1, String classFile2, boolean orderRequired, boolean excludeSynthetic) {
- try {
- ClassFileReader reader = ClassFileReader.read(EVAL_DIRECTORY + File.separator + classFile1 + ".class");
- int fileLength;
- File file = new File(EVAL_DIRECTORY + File.separator + classFile2 + ".class");
- byte classFileBytes[] = new byte[fileLength = (int) file.length()];
- java.io.FileInputStream stream = new java.io.FileInputStream(file);
- int bytesRead = 0;
- int lastReadSize = 0;
- while ((lastReadSize != -1) && (bytesRead != fileLength)) {
- lastReadSize = stream.read(classFileBytes, bytesRead, fileLength - bytesRead);
- bytesRead += lastReadSize;
- }
- stream.close();
- return reader.hasStructuralChanges(classFileBytes, orderRequired, excludeSynthetic);
- } catch(IOException e) {
- return true;
- } catch(ClassFormatException e) {
- return true;
- }
- }
-
- public void test001() {
- try {
- String sourceA001 =
- "public class A001 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA001, "A001");
- String sourceA001_2 =
- "public class A001_2 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA001_2, "A001_2");
- Assert.assertTrue(!areStructurallyDifferent("A001", "A001_2", false, false));
- } finally {
- removeTempClass("A001");
- }
- }
-
- public void test002() {
- try {
- String sourceA002 =
- "public class A002 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA002, "A002");
- String sourceA002_2 =
- "public class A002_2 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA002_2, "A002_2");
- Assert.assertTrue(areStructurallyDifferent("A002", "A002_2", false, false));
- } finally {
- removeTempClass("A002");
- }
- }
-
- public void test003() {
- try {
- String sourceA003 =
- "public class A003 {\n" +
- "public static final int II = 5;\n" +
- "}";
- compileAndDeploy(sourceA003, "A003");
- String sourceA003_2 =
- "public class A003_2 {\n" +
- "public static final int II = 6;\n" +
- "}";
- compileAndDeploy(sourceA003_2, "A003_2");
- Assert.assertTrue(areStructurallyDifferent("A003", "A003_2", false, false));
- } finally {
- removeTempClass("A003");
- }
- }
- public void test004() {
- try {
- String sourceA004 =
- "public class A004 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA004, "A004");
- String sourceA004_2 =
- "public class A004_2 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA004_2, "A004_2");
- Assert.assertTrue(!areStructurallyDifferent("A004", "A004_2", true, true));
- } finally {
- removeTempClass("A004");
- }
- }
- public void test005() {
- try {
- String sourceA005 =
- "public class A005 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA005, "A005");
- String sourceA005_2 =
- "public class A005_2 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA005_2, "A005_2");
- Assert.assertTrue(areStructurallyDifferent("A005", "A005_2", true, true));
- } finally {
- removeTempClass("A005");
- }
- }
- public void test006() {
- try {
- String sourceA006 =
- "public class A006 {\n" +
- "public static final int II = 5;\n" +
- "}";
- compileAndDeploy(sourceA006, "A006");
- String sourceA006_2 =
- "public class A006_2 {\n" +
- "public static final int II = 6;\n" +
- "}";
- compileAndDeploy(sourceA006_2, "A006_2");
- Assert.assertTrue(areStructurallyDifferent("A006", "A006_2", true, true));
- } finally {
- removeTempClass("A006");
- }
- }
-
- public void test007() {
- try {
- String sourceA007 =
- "public class A007 {\n" +
- "public static final int II = 6;\n" +
- "public Runnable foo() {\n" +
- "\treturn null;\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA007, "A007");
- String sourceA007_2 =
- "public class A007_2 {\n" +
- "public static final int II = 6;\n" +
- "public Runnable foo() {\n" +
- "\treturn new Runnable() {public void run() {}};\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA007_2, "A007_2");
- Assert.assertTrue(!areStructurallyDifferent("A007", "A007_2", true, true));
- } finally {
- removeTempClass("A007");
- }
- }
- public void test008() {
- try {
- String sourceA008 =
- "public class A008 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\treturn i;\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA008, "A008");
- String sourceA008_2 =
- "public class A008_2 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\treturn 2;\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA008_2, "A008_2");
- Assert.assertTrue(!areStructurallyDifferent("A008", "A008_2", true, false));
- } finally {
- removeTempClass("A008");
- }
- }
-
- public void test009() {
- try {
- String sourceA009 =
- "public class A009 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\tclass A {\n" +
- "\t\tint get() {\n" +
- "\t\t\treturn i;\n" +
- "\t\t}\n" +
- "\t}\n" +
- "\treturn new A().get();\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA009, "A009");
- String sourceA009_2 =
- "public class A009_2 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\treturn 2;\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA009_2, "A009_2");
- Assert.assertTrue(areStructurallyDifferent("A009", "A009_2", true, false));
- } finally {
- removeTempClass("A009");
- }
- }
- public void test010() {
- try {
- String sourceA010 =
- "public class A010 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\tclass A {\n" +
- "\t\tint get() {\n" +
- "\t\t\treturn i;\n" +
- "\t\t}\n" +
- "\t}\n" +
- "\treturn new A().get();\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA010, "A010");
- String sourceA010_2 =
- "public class A010_2 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\treturn 2;\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA010_2, "A010_2");
- Assert.assertTrue(!areStructurallyDifferent("A010", "A010_2", true, true));
- } finally {
- removeTempClass("A010");
- }
- }
-
- public void test011() {
- try {
- String sourceA011 =
- "public class A011 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\tclass A {\n" +
- "\t\tint get() {\n" +
- "\t\t\treturn i;\n" +
- "\t\t}\n" +
- "\t}\n" +
- "\treturn new A().get();\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA011, "A011");
- String sourceA011_2 =
- "public class A011_2 {\n" +
- "private int i = 6;\n" +
- "public int foo() {\n" +
- "\treturn 2;\n"+
- "}\n" +
- "}";
- compileAndDeploy(sourceA011_2, "A011_2");
- Assert.assertTrue(!areStructurallyDifferent("A011", "A011_2", false, true));
- } finally {
- removeTempClass("A011");
- }
- }
- public void test012() {
- try {
- String sourceA012 =
- "public class A012 {\n" +
- "public Class foo() {\n" +
- "\treturn null;\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA012, "A012");
- String sourceA012_2 =
- "public class A012_2 {\n" +
- "public Class foo() {\n" +
- "\treturn A012_2.class;\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA012_2, "A012_2");
- Assert.assertTrue(areStructurallyDifferent("A012", "A012_2", false, false));
- } finally {
- removeTempClass("A012");
- }
- }
- public void test013() {
- try {
- String sourceA013 =
- "public class A013 {\n" +
- "public Class foo() {\n" +
- "\treturn null;\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA013, "A013");
- String sourceA013_2 =
- "public class A013_2 {\n" +
- "public Class foo() {\n" +
- "\treturn A013_2.class;\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA013_2, "A013_2");
- Assert.assertTrue(!areStructurallyDifferent("A013", "A013_2", false, true));
- } finally {
- removeTempClass("A013");
- }
- }
- public void test014() {
- try {
- String sourceA014 =
- "public class A014 {\n" +
- "public Class foo() {\n" +
- "\treturn null;\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA014, "A014");
- String sourceA014_2 =
- "public class A014_2 {\n" +
- "public Class foo() {\n" +
- "\treturn A014_2.class;\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA014_2, "A014_2");
- Assert.assertTrue(!areStructurallyDifferent("A014", "A014_2", true, true));
- } finally {
- removeTempClass("A014");
- }
- }
-
- public void test015() {
- try {
- String sourceA015 =
- "public class A015 {\n" +
- " public class B {\n" +
- " }\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA015, "A015");
- Assert.assertTrue(!areStructurallyDifferent("A015$B", "A015$B", false, false));
- } finally {
- removeTempClass("A015");
- }
- }
-
- public void test016() {
- try {
- String sourceA016 =
- "public class A016 {\n" +
- "public void boo() {\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA016, "A016");
- String sourceA016_2 =
- "public class A016_2 {\n" +
- "public void foo() {\n" +
- "}\n" +
- "}";
- compileAndDeploy(sourceA016_2, "A016_2");
- Assert.assertTrue(areStructurallyDifferent("A016", "A016_2", false, false));
- } finally {
- removeTempClass("A016");
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest.java
deleted file mode 100644
index 81ae2b9..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest.java
+++ /dev/null
@@ -1,2059 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.ToolFactory;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.core.util.IClassFileReader;
-import org.eclipse.jdt.core.util.ICodeAttribute;
-import org.eclipse.jdt.core.util.IExceptionTableEntry;
-import org.eclipse.jdt.core.util.ILineNumberAttribute;
-import org.eclipse.jdt.core.util.IMethodInfo;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.jdt.internal.compiler.classfmt.MethodInfo;
-import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
-
-public class ClassFileReaderTest extends AbstractRegressionTest {
- private static final String SOURCE_DIRECTORY = Util.getOutputDirectory() + File.separator + "source";
- private static final String EVAL_DIRECTORY = Util.getOutputDirectory() + File.separator + "eval";
-
- public ClassFileReaderTest(String name) {
- super(name);
- }
- public static Test suite() {
- return setupSuite(testClass());
- }
-
- public static Class testClass() {
- return ClassFileReaderTest.class;
- }
-
- public void removeTempClass(String className) {
- File dir = new File(SOURCE_DIRECTORY);
- String[] fileNames = dir.list();
- if (fileNames != null) {
- for (int i = 0, max = fileNames.length; i < max; i++) {
- if (fileNames[i].indexOf(className) != -1) {
- new File(SOURCE_DIRECTORY + File.separator + fileNames[i]).delete();
- }
- }
- }
-
- dir = new File(EVAL_DIRECTORY);
- fileNames = dir.list();
- if (fileNames != null) {
- for (int i = 0, max = fileNames.length; i < max; i++) {
- if (fileNames[i].indexOf(className) != -1) {
- new File(EVAL_DIRECTORY + File.separator + fileNames[i]).delete();
- }
- }
- }
-
- }
-
- public void compileAndDeploy(String source, String className) {
- File directory = new File(SOURCE_DIRECTORY);
- if (!directory.exists()) {
- if (!directory.mkdirs()) {
- System.out.println("Could not create " + SOURCE_DIRECTORY);
- return;
- }
- }
- String fileName = SOURCE_DIRECTORY + File.separator + className + ".java";
- try {
- BufferedWriter writer = new BufferedWriter(new FileWriter(fileName));
- writer.write(source);
- writer.flush();
- writer.close();
- } catch (IOException e) {
- e.printStackTrace();
- return;
- }
- StringBuffer buffer = new StringBuffer();
- buffer
- .append("\"")
- .append(fileName)
- .append("\" -d \"")
- .append(EVAL_DIRECTORY)
- .append("\" -preserveAllLocals -nowarn -g -classpath \"")
- .append(Util.getJREDirectory() + "/lib/rt.jar;")
- .append(SOURCE_DIRECTORY)
- .append("\"");
- org.eclipse.jdt.internal.compiler.batch.Main.compile(buffer.toString());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=15051
- */
- public void test001() {
- try {
- String sourceA001 =
- "public class A001 {\n" +
- " private int i = 6;\n" +
- " public int foo() {\n" +
- " class A {\n" +
- " int get() {\n" +
- " return i;\n" +
- " }\n" +
- " }\n" +
- " return new A().get();\n" +
- " }\n" +
- "};";
- compileAndDeploy(sourceA001, "A001");
- try {
- org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.read(EVAL_DIRECTORY + File.separator + "A001.class");
- IBinaryMethod[] methods = classFileReader.getMethods();
- assertEquals("wrong size", 3, methods.length);
- MethodInfo methodInfo = (MethodInfo) methods[2];
- assertEquals("wrong name", "access$0", new String(methodInfo.getSelector()));
- assertTrue("Not synthetic", methodInfo.isSynthetic());
- } catch (ClassFormatException e) {
- assertTrue(false);
- } catch (IOException e) {
- assertTrue(false);
- }
- } finally {
- removeTempClass("A001");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25188
- */
- public void test002() {
- try {
- String sourceA002 =
- "public class A002 {\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(); /* \\u000d: CARRIAGE RETURN */\n" +
- " System.out.println();\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA002, "A002");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A002.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 3, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 6, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 12, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- } finally {
- removeTempClass("A002");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26098
- */
- public void test003() {
- try {
- String sourceA003 =
- "public class A003 {\n" +
- "\n" +
- " public int bar() {\n" +
- " return 0;\n" +
- " }\n" +
- " \n" +
- " public void foo() {\n" +
- " System.out.println(bar());\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA003, "A003");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A003.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 3, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[2];
- assertEquals("wrong name", "foo", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 2, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 8, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 10, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 9, lineNumberTable[1][1]);
- } finally {
- removeTempClass("A003");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test004() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " && !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 11, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 22, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test005() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " && true) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test006() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " && false) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 2, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 8, lineNumberTable[1][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test007() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (true\n" +
- " && !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test008() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (false\n" +
- " && !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 2, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 8, lineNumberTable[1][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test009() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " || !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 11, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 22, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test010() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " || true) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 3, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 6, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 10, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 8, lineNumberTable[2][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test011() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " || false) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test012() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (true\n" +
- " || !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 3, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 6, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 8, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 8, lineNumberTable[2][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test013() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (false\n" +
- " || !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test014() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " == !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 28, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 35, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test015() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " == true) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test016() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " == false) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test017() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (true\n" +
- " == !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test018() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (false\n" +
- " == !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- * http: //bugs.eclipse.org/bugs/show_bug.cgi?id=26881
- */
- public void test019() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 5)\n" +
- " ? b : !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 10, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 21, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 28, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test020() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " >= 5) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 5, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 4, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 8, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 8, lineNumberTable[4][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test021() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " >= 0) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test022() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (0\n" +
- " >= i) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test023() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " > 0) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test024() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (0\n" +
- " > i) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test025() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " > 5) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 5, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 4, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 8, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 8, lineNumberTable[4][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test026() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " < 0) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test027() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (0\n" +
- " < i) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test028() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " < 5) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 5, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 4, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 8, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 8, lineNumberTable[4][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test029() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " <= 0) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test030() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (0\n" +
- " <= i) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 7, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 14, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test031() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " <= 5) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 5, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 4, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 8, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 8, lineNumberTable[4][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test032() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if (i\n" +
- " <= 5) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 5, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 4, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 8, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 15, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 8, lineNumberTable[4][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test033() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " & !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 29, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 36, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test034() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " & true) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test035() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " & false) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 2, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 8, lineNumberTable[1][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test036() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (true\n" +
- " & !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test037() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (false\n" +
- " & !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 2, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 8, lineNumberTable[1][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test038() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " | !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 29, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 36, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test039() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " | true) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 3, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 6, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 10, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 8, lineNumberTable[2][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test040() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " | false) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test041() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (true\n" +
- " | !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 3, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 6, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 8, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 8, lineNumberTable[2][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test042() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (false\n" +
- " | !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test043() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " ^ !b) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 6, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 5, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 5, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 6, lineNumberTable[3][1]);
- assertEquals("wrong pc[4]", 29, lineNumberTable[4][0]);
- assertEquals("wrong line[4]", 7, lineNumberTable[4][1]);
- assertEquals("wrong pc[5]", 36, lineNumberTable[5][0]);
- assertEquals("wrong line[5]", 9, lineNumberTable[5][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test044() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " ^ true) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test045() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 6;\n" +
- " if ((i == 6) \n" +
- " ^ false) { \n" +
- " System.out.println(i);\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 3, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 4, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 9, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 16, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test046() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (true\n" +
- " ^ !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26753
- */
- public void test047() {
- try {
- String sourceA =
- "public class A {\n" +
- " public static void main(String[] args) {\n" +
- " boolean b = false;\n" +
- " if (false\n" +
- " ^ !b) { \n" +
- " System.out.println();\n" +
- " }\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methodInfos = classFileReader.getMethodInfos();
- assertEquals("wrong size", 2, methodInfos.length);
- IMethodInfo methodInfo = methodInfos[1];
- assertEquals("wrong name", "main", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertNotNull("No code attribute", codeAttribute);
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- assertNotNull("No code line number attribute", lineNumberAttribute);
- int[][] lineNumberTable = lineNumberAttribute.getLineNumberTable();
- assertEquals("wrong size", 4, lineNumberTable.length);
- assertEquals("wrong pc[0]", 0, lineNumberTable[0][0]);
- assertEquals("wrong line[0]", 3, lineNumberTable[0][1]);
- assertEquals("wrong pc[1]", 2, lineNumberTable[1][0]);
- assertEquals("wrong line[1]", 5, lineNumberTable[1][1]);
- assertEquals("wrong pc[2]", 6, lineNumberTable[2][0]);
- assertEquals("wrong line[2]", 6, lineNumberTable[2][1]);
- assertEquals("wrong pc[3]", 12, lineNumberTable[3][0]);
- assertEquals("wrong line[3]", 8, lineNumberTable[3][1]);
- } finally {
- removeTempClass("A");
- }
- }
-
- public void test048() {
- try {
- String sourceA =
- "public class A {\n" +
- "\n" +
- " static int foo(boolean bool) {\n" +
- " int j;\n" +
- " try {\n" +
- " if (bool) return 1;\n" +
- " j = 2;\n" +
- " } finally {\n" +
- " j = 3;\n" +
- " }\n" +
- " return j;\n" +
- " }\n" +
- "\n" +
- " public static void main(String[] args) {\n" +
- " foo(false);\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA, "A");
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(EVAL_DIRECTORY + File.separator + "A.class", IClassFileReader.ALL);
- IMethodInfo[] methods = classFileReader.getMethodInfos();
- assertEquals("wrong size", 3, methods.length);
- IMethodInfo methodInfo = (IMethodInfo) methods[1];
- assertEquals("wrong name", "foo", new String(methodInfo.getName()));
- ICodeAttribute codeAttribute = methodInfo.getCodeAttribute();
- assertEquals("Wrong size", 3, codeAttribute.getExceptionTableLength());
- IExceptionTableEntry[] entries = codeAttribute.getExceptionTable();
- // any exception handler
- assertEquals("Wrong index", 0, entries[0].getCatchTypeIndex());
- assertEquals("Wrong index", 0, entries[1].getCatchTypeIndex());
- assertEquals("Wrong index", 0, entries[2].getCatchTypeIndex());
-
- assertEquals("Wrong startpc", 0, entries[0].getStartPC());
- assertEquals("Wrong endpc", 7, entries[0].getEndPC());
-
- assertEquals("Wrong startpc", 9, entries[1].getStartPC());
- assertEquals("Wrong endpc", 14, entries[1].getEndPC());
-
- assertEquals("Wrong startpc", 25, entries[2].getStartPC());
- assertEquals("Wrong endpc", 28, entries[2].getEndPC());
-
- ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute();
- if (lineNumberAttribute != null) {
- int[][] lineEntries = lineNumberAttribute.getLineNumberTable();
- assertNotNull("No entries", lineEntries);
- assertEquals("wrong size", 7, lineEntries.length);
- lineEntries[0][0] = 0;
- lineEntries[0][1] = 6;
- lineEntries[1][0] = 9;
- lineEntries[1][1] = 7;
- lineEntries[2][0] = 14;
- lineEntries[2][1] = 8;
- lineEntries[3][0] = 21;
- lineEntries[3][1] = 9;
- lineEntries[4][0] = 23;
- lineEntries[4][1] = 10;
- lineEntries[5][0] = 25;
- lineEntries[5][1] = 8;
- lineEntries[6][0] = 28;
- lineEntries[6][1] = 11;
- }
- } finally {
- removeTempClass("A");
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java
deleted file mode 100644
index 5483f6f..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java
+++ /dev/null
@@ -1,1667 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.ToolFactory;
-import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.util.Util;
-import org.eclipse.jdt.internal.core.index.IDocument;
-import org.eclipse.jdt.internal.core.index.IIndexerOutput;
-import org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer;
-
-public class Compliance_1_3 extends AbstractRegressionTest {
-public Compliance_1_3(String name) {
- super(name);
-}
-
-/*
- * Toggle compiler in mode -1.3
- */
-protected Map getCompilerOptions() {
- Map options = super.getCompilerOptions();
- options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
- return options;
-}
-public static Test suite() {
- return setupSuite(testClass());
-/*
- TestSuite ts;
- //some of the tests depend on the order of this suite.
- ts = new TestSuite();
- //
- ts.addTest(new Compliance_1_3("test17"));
- return new RegressionTestSetup(ts);
-*/
-}
-public void test01() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " class M { \n"+
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " M m; \n"+
- " }; \n"+
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " class M {} \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 10)\n" +
- " M m; \n" +
- " ^\n" +
- "The field type M is defined in an inherited type and an enclosing scope\n" +
- "----------\n"
- );
-}
-public void test02() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar() { \n"+
- " return \"FAILED\"; \n" +
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar(); \n" +
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " String bar(){ return \"FAILED\"; } \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 11)\n" +
- " String z = bar(); \n" +
- " ^^^\n" +
- "The method bar is defined in an inherited type and an enclosing scope\n" +
- "----------\n"
- );
-}
-public void test03() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar = \"FAILED\";"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar; \n"+
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " String bar = \"FAILED\"; \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 8)\n" +
- " String z = bar; \n" +
- " ^^^\n" +
- "The field bar is defined in an inherited type and an enclosing scope \n" +
- "----------\n"
- );
-}
-public void test04() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar() { \n"+
- " return \"SUCCESS\"; \n" +
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar(); \n" +
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " private String bar(){ return \"FAILED\"; } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test05() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar = \"SUCCESS\";"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar; \n"+
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " private String bar = \"FAILED\"; \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test06() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " String bar() { \n"+
- " return \"SUCCESS\"; \n" +
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar(); \n" +
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " String bar(int i){ return \"FAILED\"; } \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 8)\n" +
- " String z = bar(); \n" +
- " ^^^\n" +
- "The method bar(int) in the type Secondary is not applicable for the arguments ()\n" +
- "----------\n");
-}
-public void test07() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " try { \n" +
- " throw null; \n"+
- " } catch(NullPointerException e){ \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 5)\n" +
- " throw null; \n" +
- " ^^^^^^^^^^\n" +
- "Cannot throw null\n" +
- "----------\n"
- );
-}
-public void test08() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "import Test2; \n" +
- "import Test2.Member; \n" +
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n"+
- "} \n",
- "Test2.java",
- "public class Test2 { \n"+
- " public class Member { \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-// binary compatibility
-public void test09() {
- this.runConformTest(
- new String[] {
- "p1/Z.java",
- "package p1; \n"+
- "public class Z { \n" +
- " public static void main(String[] arguments) { \n"+
- " Y y = new Y(); \n" +
- " System.out.print(y.field); \n" +
- " System.out.print(y.staticField); \n" +
- " System.out.print(y.method()); \n" +
- " System.out.println(y.staticMethod()); \n" +
- " } \n"+
- "} \n",
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " public String field = \"X.field-\"; \n" +
- " public static String staticField = \"X.staticField-\"; \n" +
- " public String method(){ return \"X.method()-\"; } \n" +
- " public static String staticMethod(){ return \"X.staticMethod()-\"; } \n" +
- "} \n",
- "p1/Y.java",
- "package p1; \n"+
- "public class Y extends X { \n"+
- "} \n"
- },
- "X.field-X.staticField-X.method()-X.staticMethod()-");
-
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n"+
- "public class Y extends X { \n"+
- " public static void main(String[] arguments) { \n"+
- " Z.main(arguments); \n" +
- " } \n" +
- " public String field = \"Y.field-\"; \n" +
- " public static String staticField = \"Y.staticField-\"; \n" +
- " public String method(){ return \"Y.method()-\"; } \n" +
- " public static String staticMethod(){ return \"Y.staticMethod()-\"; } \n" +
- "} \n"
- },
- "X.field-X.staticField-Y.method()-X.staticMethod()-", // expected output
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-
-// check actualReceiverType when array type
-public void test10() {
- this.runConformTest(
- new String[] {
- "p1/Z.java",
- "package p1; \n"+
- "public class Z { \n" +
- " public static void main(String[] arguments) { \n"+
- " String[] s = new String[]{\"SUCCESS\" }; \n" +
- " System.out.print(s.length); \n" +
- " System.out.print(((String[])s.clone())[0]); \n" +
- " } \n"+
- "} \n"
- },
- "1SUCCESS");
-}
-// test unreachable code complaints
-public void test11() {
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " void foo() { \n"+
- " while (false); \n" +
- " while (false) System.out.println(\"unreachable\"); \n" +
- " do ; while (false); \n" +
- " do System.out.println(\"unreachable\"); while (false); \n" +
- " for (;false;); \n" +
- " for (;false;) System.out.println(\"unreachable\"); \n" +
- " if (false); \n" +
- " if (false)System.out.println(\"unreachable\"); \n" +
- " } \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 5)\n" +
- " while (false) System.out.println(\"unreachable\"); \n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 9)\n" +
- " for (;false;) System.out.println(\"unreachable\"); \n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Unreachable code\n" +
- "----------\n"
- );
-}
-// binary compatibility
-public void test12() {
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n" +
- "class Store { \n" +
- " String value; \n" +
- " Store(String value){ \n" +
- " this.value = value; \n" +
- " } \n" +
- "} \n" +
- "class Top { \n" +
- " static String bar = \"Top.bar\"; \n" +
- " String foo = \"Top.foo\"; \n" +
- " Store store = new Store(\"Top.store\"); \n" +
- " static Store sstore = new Store(\"Top.sstore\"); \n" +
- " static Top ss = new Top(); \n" +
- "} \n" +
- "public class Y extends Updated { \n" +
- " public static void main(String[] arguments) { \n" +
- " new Y().test(); \n" +
- " } \n" +
- " void test() { \n" +
- " System.out.print(\"*** FIELD ACCESS ***\"); \n" +
- " System.out.print(\"*1* new Updated().bar: \" + new Updated().bar); \n" +
- " System.out.print(\"*2* new Updated().foo: \" + new Updated().foo); \n" +
- " System.out.print(\"*3* new Y().foo: \" + new Y().foo); \n" +
- " System.out.print(\"*4* new Y().bar: \" + new Y().bar); \n" +
- " System.out.print(\"*5* bar: \" + bar); \n" +
- " System.out.print(\"*6* foo: \" + foo); \n" +
- " System.out.print(\"*7* Y.bar: \" + Y.bar); \n" +
- " System.out.print(\"*8* this.bar: \" + this.bar); \n" +
- " System.out.print(\"*9* this.foo: \" + this.foo); \n" +
- " System.out.print(\"*10* store.value: \" + store.value); \n" +
- " System.out.print(\"*11* sstore.value: \" + sstore.value); \n" +
- " System.out.print(\"*12* ss.sstore.value: \" + ss.sstore.value); \n" +
- " } \n" +
- "} \n",
- "p1/Updated.java",
- "package p1; \n" +
- "public class Updated extends Top { \n" +
- "} \n"
- },
- "*** FIELD ACCESS ***"
- +"*1* new Updated().bar: Top.bar"
- +"*2* new Updated().foo: Top.foo"
- +"*3* new Y().foo: Top.foo"
- +"*4* new Y().bar: Top.bar"
- +"*5* bar: Top.bar"
- +"*6* foo: Top.foo"
- +"*7* Y.bar: Top.bar"
- +"*8* this.bar: Top.bar"
- +"*9* this.foo: Top.foo"
- +"*10* store.value: Top.store"
- +"*11* sstore.value: Top.sstore"
- +"*12* ss.sstore.value: Top.sstore");
-
- this.runConformTest(
- new String[] {
- "p1/Updated.java",
- "package p1; \n"+
- "public class Updated extends Top { \n"+
- " public static void main(String[] arguments) { \n"+
- " Y.main(arguments); \n" +
- " } \n" +
- " static String bar = \"Updated.bar\"; \n" +
- " String foo = \"Updated.foo\"; \n" +
- " Store store = new Store(\"Updated.store\"); \n" +
- " static Store sstore = new Store(\"Updated.sstore\"); \n" +
- " static Updated ss = new Updated(); \n" +
- "} \n"
- },
- "*** FIELD ACCESS ***"
- +"*1* new Updated().bar: Top.bar"
- +"*2* new Updated().foo: Top.foo"
- +"*3* new Y().foo: Top.foo"
- +"*4* new Y().bar: Top.bar"
- +"*5* bar: Top.bar"
- +"*6* foo: Top.foo"
- +"*7* Y.bar: Top.bar"
- +"*8* this.bar: Top.bar"
- +"*9* this.foo: Top.foo"
- +"*10* store.value: Top.store"
- +"*11* sstore.value: Top.sstore"
- +"*12* ss.sstore.value: Top.sstore",
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-// binary compatibility
-public void test13() {
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n" +
- "class Store { \n" +
- " String value; \n" +
- " Store(String value){ \n" +
- " this.value = value; \n" +
- " } \n" +
- "} \n" +
- "class Top { \n" +
- " static String bar() { return \"Top.bar()\"; } \n" +
- " String foo() { return \"Top.foo()\"; } \n" +
- "} \n" +
- "public class Y extends Updated { \n" +
- " public static void main(String[] arguments) { \n" +
- " new Y().test(); \n" +
- " } \n" +
- " void test() { \n" +
- " System.out.print(\"*** METHOD ACCESS ***\"); \n" +
- " System.out.print(\"*1* new Updated().bar(): \" + new Updated().bar()); \n" +
- " System.out.print(\"*2* new Updated().foo(): \" + new Updated().foo()); \n" +
- " System.out.print(\"*3* new Y().foo(): \" + new Y().foo()); \n" +
- " System.out.print(\"*4* new Y().bar(): \" + new Y().bar()); \n" +
- " System.out.print(\"*5* bar(): \" + bar()); \n" +
- " System.out.print(\"*6* foo(): \" + foo()); \n" +
- " System.out.print(\"*7* Y.bar(): \" + Y.bar()); \n" +
- " System.out.print(\"*8* this.bar(): \" + this.bar()); \n" +
- " System.out.print(\"*9* this.foo(): \" + this.foo()); \n" +
- " } \n" +
- "} \n",
- "p1/Updated.java",
- "package p1; \n" +
- "public class Updated extends Top { \n" +
- "} \n"
- },
- "*** METHOD ACCESS ***"
- +"*1* new Updated().bar(): Top.bar()"
- +"*2* new Updated().foo(): Top.foo()"
- +"*3* new Y().foo(): Top.foo()"
- +"*4* new Y().bar(): Top.bar()"
- +"*5* bar(): Top.bar()"
- +"*6* foo(): Top.foo()"
- +"*7* Y.bar(): Top.bar()"
- +"*8* this.bar(): Top.bar()"
- +"*9* this.foo(): Top.foo()");
-
- this.runConformTest(
- new String[] {
- "p1/Updated.java",
- "package p1; \n"+
- "public class Updated extends Top { \n"+
- " public static void main(String[] arguments) { \n"+
- " Y.main(arguments); \n" +
- " } \n" +
- " static String bar() { return \"Updated.bar()\"; } \n" +
- " String foo() { return \"Updated.foo()\"; } \n" +
- "} \n"
- },
- "*** METHOD ACCESS ***"
- +"*1* new Updated().bar(): Top.bar()"
- +"*2* new Updated().foo(): Updated.foo()"
- +"*3* new Y().foo(): Updated.foo()"
- +"*4* new Y().bar(): Top.bar()"
- +"*5* bar(): Top.bar()"
- +"*6* foo(): Updated.foo()"
- +"*7* Y.bar(): Top.bar()"
- +"*8* this.bar(): Top.bar()"
- +"*9* this.foo(): Updated.foo()",
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-
-public void test14() {
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n" +
- "class T { \n" +
- " void foo(boolean b) { \n" +
- " System.out.print(\"T.foo(boolean)#\"); \n" +
- " } \n" +
- " boolean bar = false; \n" +
- " class Member { \n" +
- " void display(){ System.out.print(\"T.Member#\"); } \n" +
- " } \n" +
- "} \n" +
- "public class X { \n" +
- " void foo(int i) { \n" +
- " System.out.println(\"X.foo(int)#\"); \n" +
- " } \n" +
- " int bar; \n" +
- " class Member { \n" +
- " void display(){ System.out.print(\"X.Member#\"); } \n" +
- " } \n" +
- " public static void main(String[] arguments) { \n" +
- " new X().bar(); \n" +
- " } \n" +
- " void bar() { \n" +
- " new T() { \n" +
- " { \n" +
- " foo(true); \n" +
- " System.out.print((boolean)bar + \"#\"); \n" +
- " Member m = new Member(); \n" +
- " m.display(); \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 25)\n" +
- " foo(true); \n" +
- " ^^^\n" +
- "The method foo is defined in an inherited type and an enclosing scope\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 26)\n" +
- " System.out.print((boolean)bar + \"#\"); \n" +
- " ^^^\n" +
- "The field bar is defined in an inherited type and an enclosing scope \n" +
- "----------\n" +
- "3. ERROR in p1\\X.java (at line 27)\n" +
- " Member m = new Member(); \n" +
- " ^^^^^^\n" +
- "The type Member is defined in an inherited type and an enclosing scope\n" +
- "----------\n" +
- "4. ERROR in p1\\X.java (at line 27)\n" +
- " Member m = new Member(); \n" +
- " ^^^^^^\n" +
- "The type Member is defined in an inherited type and an enclosing scope\n" +
- "----------\n"
- );
-}
-
-/*
- * check handling of default abstract methods
- */
-public void test15() {
- this.runConformTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " public static void main(String[] arguments) { \n"+
- " C c = new C() { \n"+
- " public void doSomething(){ \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- " }; \n"+
- " c.doSomething(); \n"+
- " } \n"+
- "} \n"+
- "interface I { \n"+
- " void doSomething(); \n"+
- "} \n"+
- "abstract class C implements I { \n"+
- "} \n"
- },
- "SUCCESS");
-}
-
-public void test16() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(boolean b) {} \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " foo(0); \n" +
- " ^^^\n" +
- "The method foo(boolean) in the type T is not applicable for the arguments (int)\n" +
- "----------\n");
-}
-
-public void test17() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(boolean b) {} \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(false); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " foo(false); \n" +
- " ^^^\n" +
- "The method foo is defined in an inherited type and an enclosing scope\n" +
- "----------\n");
-}
-
-public void test18() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(int j) {} \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " foo(0); \n" +
- " ^^^\n" +
- "The method foo is defined in an inherited type and an enclosing scope\n" +
- "----------\n");
-}
-public void test19() {
- this.runConformTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(int j) { System.out.println(\"SUCCESS\"); } \n"+
- "} \n"+
- "class U { \n"+
- " void foo(int j) { System.out.println(\"FAILED\"); } \n"+
- "} \n"+
- "public class X extends U { \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().bar(); \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-public void test20() {
- this.runConformTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(int j) { System.out.println(\"SUCCESS\"); } \n"+
- "} \n"+
- "class U { \n"+
- " void foo(boolean j) { System.out.println(\"FAILED\"); } \n"+
- "} \n"+
- "public class X extends U { \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().bar(); \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-// binary check for 11511
-public void test21() {
- this.runConformTest(
- new String[] {
- "p1/Z.java",
- "package p1; \n" +
- "public class Z extends AbstractA { \n" +
- " public static void main(String[] arguments) { \n" +
- " new Z().init(); \n" +
- " } \n" +
- "} \n" +
- "abstract class AbstractB implements K { \n" +
- " public void init() { \n" +
- " System.out.println(\"AbstractB.init()\"); \n" +
- " } \n" +
- "} \n" +
- "interface K { \n" +
- " void init(); \n" +
- " void init(int i); \n" +
- "} \n",
- "p1/AbstractA.java",
- "package p1; \n" +
- "public abstract class AbstractA extends AbstractB implements K { \n" +
- " public void init(int i) { \n" +
- " } \n" +
- "} \n"
- },
- "AbstractB.init()"); // no special vm args
-
- // check that "new Z().init()" is bound to "AbstractB.init()"
- final StringBuffer references = new StringBuffer(10);
- try {
- BinaryIndexer indexer = new BinaryIndexer(true);
- indexer.index(
- new IDocument() {
- public byte[] getByteContent() throws IOException {
- return Util.getFileByteContent(new File(OUTPUT_DIR + "/p1/Z.class"));
- }
- public char[] getCharContent() throws IOException { return null; }
- public String getName() { return "Z.class"; }
- public String getStringContent() throws IOException { return null; }
- public String getType() { return "class"; }
- public String getEncoding() { return ""; }
-
- },
- new IIndexerOutput() {
- public void addDocument(IDocument document) { }
- public void addRef(char[] word) {
- references.append(word);
- references.append('\n');
- }
- public void addRef(String word) {
- //System.out.println(word);
- }
- });
- } catch(IOException e) {
- }
- String computedReferences = references.toString();
- boolean check = computedReferences.indexOf("typeRef/AbstractB\nref/p1\nref/AbstractB\nmethodRef/init/0") >= 0;
- if (!check){
- System.out.println(computedReferences);
- }
- assertTrue("did not bind 'new Z().init()' to AbstractB.init()'", check);
-}
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis
- */
-public void test22() {
-
- this.runNegativeTest(
- new String[] {
- "p1/T.java",
- "package p1; \n"+
- "interface II {} \n"+
- "class TT { \n"+
- " void foo(boolean b) {} \n"+
- " void foo(int i, boolean b) {} \n"+
- " void foo(String s) {} \n"+
- "} \n"+
- "public abstract class T implements II { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(0); // should say that foo(int, boolean) isn't applicable \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void boo() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(true); // should complain ambiguity \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\T.java (at line 13)\n" +
- " foo(0); // should say that foo(int, boolean) isn\'t applicable \n" +
- " ^^^\n" +
- "The method foo(int, boolean) in the type TT is not applicable for the arguments (int)\n" +
- "----------\n" +
- "2. ERROR in p1\\T.java (at line 20)\n" +
- " foo(true); // should complain ambiguity \n" +
- " ^^^\n" +
- "The method foo is defined in an inherited type and an enclosing scope\n" +
- "----------\n");
-}
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis
- */
-public void test23() {
-
- this.runNegativeTest(
- new String[] {
- "p1/T.java",
- "package p1; \n"+
- "interface II {} \n"+
- "abstract class TT { \n"+ // 259+ABSTRACT
- " void foo(boolean b) {} \n"+
- " void foo(int i, boolean b) {} \n"+
- " void foo(String s) {} \n"+
- "} \n"+
- "public abstract class T implements II { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(0); // should say that foo(int, boolean) isn't applicable \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void boo() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(true); // should complain ambiguity \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\T.java (at line 13)\n" +
- " foo(0); // should say that foo(int, boolean) isn\'t applicable \n" +
- " ^^^\n" +
- "The method foo(int, boolean) in the type TT is not applicable for the arguments (int)\n" +
- "----------\n" +
- "2. ERROR in p1\\T.java (at line 20)\n" +
- " foo(true); // should complain ambiguity \n" +
- " ^^^\n" +
- "The method foo is defined in an inherited type and an enclosing scope\n" +
- "----------\n");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis
- */
-public void test24() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "interface II {} \n"+
- "abstract class T implements II { \n"+
- " void foo(boolean b) {} \n"+
- " void foo(int i, boolean b) {} \n"+
- "} \n"+
- "abstract class TT implements II { \n"+
- " void foo(boolean b) {} \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); // javac says foo cannot be resolved because of multiple matches \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void bar2() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(0); // should say that foo(boolean) isn't applicable \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void boo() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(true); // should complain ambiguity \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 15)\n" +
- " foo(0); // javac says foo cannot be resolved because of multiple matches \n" +
- " ^^^\n" +
- "The method foo(int, boolean) in the type T is not applicable for the arguments (int)\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 22)\n" +
- " foo(0); // should say that foo(boolean) isn\'t applicable \n" +
- " ^^^\n" +
- "The method foo(boolean) in the type TT is not applicable for the arguments (int)\n" +
- "----------\n" +
- "3. ERROR in p1\\X.java (at line 29)\n" +
- " foo(true); // should complain ambiguity \n" +
- " ^^^\n" +
- "The method foo is defined in an inherited type and an enclosing scope\n" +
- "----------\n");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis (no matter if super is abstract or not)
- */
-public void test25() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X extends AbstractY { \n"+
- " void bar(){ \n"+
- " init(\"hello\"); \n"+
- " } \n"+
- "} \n"+
- "abstract class AbstractY implements I { \n"+
- "} \n"+
- "interface I { \n"+
- " void init(String s, int i); \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 2)\n" +
- " public class X extends AbstractY { \n" +
- " ^\n" +
- "Class must implement the inherited abstract method I.init(String, int)\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 4)\n" +
- " init(\"hello\"); \n" +
- " ^^^^\n" +
- "The method init(String, int) in the type AbstractY is not applicable for the arguments (String)\n" +
- "----------\n");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis (no matter if super is abstract or not)
- */
-public void test26() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X extends AbstractY { \n"+
- " void bar(){ \n"+
- " init(\"hello\"); \n"+
- " } \n"+
- "} \n"+
- "class AbstractY implements I { \n"+
- "} \n"+
- "interface I { \n"+
- " void init(String s, int i); \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 4)\n" +
- " init(\"hello\"); \n" +
- " ^^^^\n" +
- "The method init(String, int) in the type I is not applicable for the arguments (String)\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 7)\n" +
- " class AbstractY implements I { \n" +
- " ^^^^^^^^^\n" +
- "Class must implement the inherited abstract method I.init(String, int)\n" +
- "----------\n"
-);
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11922
- * code gen for for(;false;...)
- */
-public void test27() {
-
- this.runConformTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " public static void main(String[] arguments) { \n"+
- " for (;false;p()); \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- " static void p(){ \n"+
- " System.out.println(\"FAILED\"); \n"+
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=12445
- * should report unreachable empty statement
- */
-public void test28() {
-
- this.runConformTest(
- new String[] {
- "p1/X.java",
- "package p1; \n" +
- "interface FooInterface { \n" +
- " public boolean foo(int a); \n" +
- " public boolean bar(int a); \n" +
- "} \n" +
- "public class X extends Z { \n" +
- " public boolean foo(int a){ return true; } \n" +
- " public boolean bar(int a){ return false; } \n" +
- " public static void main(String[] arguments) { \n"+
- " System.out.println(new X().test(0)); \n"+
- " } \n" +
- "}\n" +
- "abstract class Z implements FooInterface { \n" +
- " public boolean foo(int a, int b) { \n" +
- " return true; \n" +
- " } \n" +
- " public String test(int a) { \n" +
- " boolean result = foo(a); \n" +
- " if (result) \n" +
- " return \"SUCCESS\"; \n" +
- " else \n" +
- " return \"FAILED\"; \n" +
- " } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * verify error on qualified name ref in 1.4
- */
-public void test29() {
-
- this.runConformTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X { \n" +
- " public static void main(String[] args) { \n" +
- " new X(); \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " Woof woof_1; \n" +
- " public class Honk { \n" +
- " Integer honks; \n" +
- " } \n" +
- " public class Meow { \n" +
- " Honk honk_1; \n" +
- " } \n" +
- " public class Woof { \n" +
- " Meow meow_1; \n" +
- " } \n" +
- " public void setHonks(int num) { \n" +
- " // This is the line that causes the VerifyError \n" +
- " woof_1.meow_1.honk_1.honks = new Integer(num); \n" +
- " // Here is equivalent code that does not cause the error. \n" +
- " // Honk h = woof_1.moo_1.meow_1.honk_1; \n" +
- " // h.honks = new Integer(num); \n" +
- " } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * 1.4 signals invocations of non-visible abstract protected method implementations.
- */
-public void test30() {
-
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X { \n" +
- " public static void main(String[] args){ \n" +
- " new q.X2().foo(\"String\"); \n" +
- " new q.X2().bar(\"String\"); \n" +
- " new q.X2().barbar(\"String\"); \n" +
- " new q.X2().baz(\"String\"); \n" +
- " } \n" +
- "} \n",
-
- "p/X1.java",
- "package p; \n" +
- "public abstract class X1 { \n" +
- " protected void foo(Object o){ System.out.println(\"X1.foo(Object)\"); } \n" +
- " protected void bar(Object o){ System.out.println(\"X1.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X1.barbar(Object)\"); } \n" +
- " protected void baz(Object o) { System.out.println(\"X1.baz(Object)\"); } \n" +
- "} \n",
-
- "q/X2.java",
- "package q; \n" +
- "public class X2 extends p.X1 { \n" +
- " protected void foo(int i) { System.out.println(\"X2.foo(int)\"); } \n" +
- " protected void bar(Object o) { System.out.println(\"X2.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " protected void baz(String s) { System.out.println(\"X2.baz(String)\"); } \n" +
- "} \n",
- },
- "----------\n" +
- "1. ERROR in p\\X.java (at line 6)\n" +
- " new q.X2().barbar(\"String\"); \n" +
- " ^^^^^^\n" +
- "The method barbar(Object) from the type X2 is not visible\n" +
- "----------\n" +
- "----------\n" +
- "1. WARNING in q\\X2.java (at line 5)\n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The method X2.barbar(Object) does not override the inherited method from X1 since it is private to a different package.\n" +
- "----------\n");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * 1.4 signals invocations of non-visible abstract protected method implementations.
- */
-public void test31() {
-
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X extends q.X2 { \n" +
- " public static void main(String[] args){ \n" +
- " new X().doSomething(); \n" +
- " } \n" +
- " void doSomething(){ \n" +
- " foo(\"String\"); \n" +
- " bar(\"String\"); \n" +
- " barbar(\"String\"); \n" +
- " baz(\"String\"); \n" +
- " } \n" +
- "} \n",
-
- "p/X1.java",
- "package p; \n" +
- "public abstract class X1 { \n" +
- " protected void foo(Object o){ System.out.println(\"X1.foo(Object)\"); } \n" +
- " protected void bar(Object o){ System.out.println(\"X1.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X1.barbar(Object)\"); } \n" +
- " protected void baz(Object o) { System.out.println(\"X1.baz(Object)\"); } \n" +
- "} \n",
-
- "q/X2.java",
- "package q; \n" +
- "public class X2 extends p.X1 { \n" +
- " protected void foo(int i) { System.out.println(\"X2.foo(int)\"); } \n" +
- " protected void bar(Object o) { System.out.println(\"X2.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " protected void baz(String s) { System.out.println(\"X2.baz(String)\"); } \n" +
- "} \n",
- },
- "----------\n" +
- "1. ERROR in p\\X.java (at line 9)\n" +
- " barbar(\"String\"); \n" +
- " ^^^^^^\n" +
- "The method barbar(Object) from the type X2 is not visible\n" +
- "----------\n" +
- "----------\n" +
- "1. WARNING in q\\X2.java (at line 5)\n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The method X2.barbar(Object) does not override the inherited method from X1 since it is private to a different package.\n" +
- "----------\n"
-);
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * 1.4 signals invocations of non-visible abstract protected field implementations.
- */
-public void test32() {
-
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X { \n" +
- " public static void main(String[] args){ \n" +
- " System.out.println(new q.X2().foo); \n" +
- " System.out.println(new q.X2().bar); \n" +
- " } \n" +
- "} \n",
-
- "p/X1.java",
- "package p; \n" +
- "public abstract class X1 { \n" +
- " protected String foo = \"X1.foo\"; \n" +
- " String bar = \"X1.bar\"; \n" +
- "} \n",
-
- "q/X2.java",
- "package q; \n" +
- "public class X2 extends p.X1 { \n" +
- " protected String foo = \"X2.foo\"; \n" +
- " String bar = \"X2.bar\"; \n" +
- "} \n",
- },
- "----------\n" +
- "1. ERROR in p\\X.java (at line 4)\n" +
- " System.out.println(new q.X2().foo); \n" +
- " ^^^\n" +
- "The field foo is not visible\n" +
- "----------\n" +
- "2. ERROR in p\\X.java (at line 5)\n" +
- " System.out.println(new q.X2().bar); \n" +
- " ^^^\n" +
- "The field bar is not visible\n" +
- "----------\n");
-}
-/*
- * Initialization of synthetic fields prior to super constructor call
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23075
- */
-public void test33() {
-
- this.runConformTest(
- new String[] {
- "A.java",
- "public class A { \n"+
- " public int m; \n"+
- " public void pp() { \n"+
- " C c = new C(4); \n"+
- " System.out.println(c.get()); \n"+
- " } \n"+
- " public static void main(String[] args) { \n"+
- " A a = new A(); \n"+
- " try { \n"+
- " a.pp(); \n"+
- " System.out.println(\"SyntheticInit BEFORE SuperConstructorCall\"); \n"+
- " } catch(NullPointerException e) { \n"+
- " System.out.println(\"SyntheticInit AFTER SuperConstructorCall\"); // should no longer occur with target 1.4 \n"+
- " } \n"+
- " } \n"+
- " class C extends B { \n"+
- " public C(int x1) { \n"+
- " super(x1); \n"+
- " } \n"+
- " protected void init(int x1) { \n"+
- " x = m * x1; // <- NULL POINTER EXCEPTION because of m \n"+
- " } \n"+
- " } \n"+
- "} \n"+
- "class B { \n"+
- " int x; \n"+
- " public B(int x1) { \n"+
- " init(x1); \n"+
- " } \n"+
- " protected void init(int x1) { \n"+
- " x = x1; \n"+
- " } \n"+
- " public int get() { \n"+
- " return x; \n"+
- " } \n"+
- "} \n"
- },
- "SyntheticInit AFTER SuperConstructorCall");
-}
-
-/*
- * Initialization of synthetic fields prior to super constructor call - NPE check
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25174
- */
-public void test34() {
-
- this.runConformTest(
- new String[] {
- "X.java",
- "public class X { \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().new X2(); \n"+
- " } \n"+
- " class X1 { \n"+
- " X1(){ \n"+
- " this.baz(); \n"+
- " } \n"+
- " void baz() { \n"+
- " System.out.println(\"-X1.baz()\"); \n"+
- " } \n"+
- " } \n"+
- " class X2 extends X1 { \n"+
- " void baz() { \n"+
- " System.out.print(X.this==null ? \"X.this == null\" : \"X.this != null\"); \n"+
- " X1 x1 = X.this.new X1(){ \n"+
- " void baz(){ \n"+
- " System.out.println(\"-X$1.baz()\"); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " } \n"+
- "}\n",
- },
- "X.this == null-X$1.baz()");
-}
-
-public void test35() {
- this.runConformTest(
- new String[] {
- /* p1/X.java */
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " class Y { Y(int i){} } \n"+
- " public static void main(String[] arguments) { \n"+
- " int i = 1; \n" +
- " try { \n" +
- " X x =null; \n" +
- " x.new Y(++i); \n" +
- " System.out.println(\"SUCCESS:\"+i); \n" +
- " } catch(NullPointerException e){ \n" +
- " System.out.println(\"FAILED\"); \n" +
- " } \n" +
- " } \n"+
- "} \n",
- },
- "SUCCESS:2"
- );
-}
-
-public void test36() {
- this.runConformTest(
- new String[] {
- /* p1/X.java */
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " class Y {} \n"+
- " static class Z extends Y { \n"+
- " Z (X x){ \n"+
- " x.super(); \n" +
- " } \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " try { \n" +
- " new Z(null); \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } catch(NullPointerException e){ \n" +
- " System.out.println(\"FAILED\"); \n" +
- " } \n" +
- " } \n"+
- "} \n",
- },
- "SUCCESS"
- );
-}
-
-/*
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=24744
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23096
- */
-public void test37() {
- Map customOptions = getCompilerOptions();
- customOptions.put(CompilerOptions.OPTION_TaskTags, "TODO:");
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n"+
- "public class X {\n"+
- "}\n"+
- "// TODO: something"
- },
- "----------\n" +
- "1. WARNING in p\\X.java (at line 4)\n" +
- " // TODO: something\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "TODO: something\n" +
- "----------\n",
- null,
- true,
- customOptions);
-}
-
-/*
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=24833
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23096
- */
-public void test38() {
- Map customOptions = getCompilerOptions();
- customOptions.put(CompilerOptions.OPTION_TaskTags, "TODO:");
- this.runNegativeTest(
- new String[] {
- "X.java",
- "// TODO: something"
- },
- "----------\n" +
- "1. WARNING in X.java (at line 1)\n" +
- " // TODO: something\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "TODO: something\n" +
- "----------\n",
- null,
- true,
- customOptions);
-}
-
-/*
- * unreachable empty statement/block not diagnosed in 1.3
- */
-public void test39() {
- this.runConformTest(
- new String[] {
- "X.java",
- "public class X { \n" +
- " public static void main(String[] args){ \n"+
- " for (;null != null;); \n"+
- " for (;null != null;){} \n"+
- " for (;false;); \n"+
- " for (;false;){} \n"+
- " while (false); \n"+
- " while (false){} \n"+
- " if (false) {} else {} \n"+
- " if (false) ; else ; \n"+
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n"+
- "} \n",
- },
- "SUCCESS");
-}
-
-// jls6.5.5.1 - simple type names favor member type over toplevel one.
-//http://bugs.eclipse.org/bugs/show_bug.cgi?id=30705
-public void test40() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "public class X { \n"+
- " interface Homonym {} \n"+ // takes precedence over others.
- " void foo() { \n"+
- " class Homonym extends X { \n"+
- " { \n"+
- " class Y extends Homonym {}; \n"+ // X$Homonym
- " } \n"+
- " } \n"+
- " } \n"+
- "} \n"+
- "class Homonym extends X { \n"+
- " { \n"+
- " class Y extends Homonym {}; \n"+ // X$Homonym
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 6)\n" +
- " class Y extends Homonym {}; \n" +
- " ^^^^^^^\n" +
- "Superclass Homonym is defined in an inherited type and an enclosing scope\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 13)\n" +
- " class Y extends Homonym {}; \n" +
- " ^^^^^^^\n" +
- "Superclass Homonym is defined in an inherited type and an enclosing scope\n" +
- "----------\n");
-}
-/*
- * 30856 - 1.4 compliant mode should consider abstract method matches
- */
-public void test41() {
- this.runConformTest(
- new String[] {
- "p/X.java", //================================
- "package p; \n" +
- "public class X { \n" +
- " void foo(int i, float f){} \n" +
- " public static void main(String[] args) { \n" +
- " q.Y y = new q.Y.Z(); \n" +
- " y.bar(); \n" +
- " } \n" +
- "} \n",
- "q/Y.java", //================================
- "package q; \n" +
- "public abstract class Y extends p.X implements I { \n" +
- " public void bar(){ foo(1, 2); } \n" +
- " public static class Z extends Y { \n" +
- " public void foo(float f, int i) { \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n" +
- "} \n" +
- "interface I { \n" +
- " void foo(float f, int i); \n" +
- "} \n",
- },
- "SUCCESS");
-}
-/*
- * variation - 30856 - 1.4 compliant mode should consider abstract method matches
- */
-public void test42() {
- this.runConformTest(
- new String[] {
- "p/X.java", //================================
- "package p; \n" +
- "public class X extends X0 { \n" +
- " void foo(int i, float f){} \n" +
- " public static void main(String[] args) { \n" +
- " q.Y y = new q.Y.Z(); \n" +
- " y.bar(); \n" +
- " } \n" +
- "} \n" +
- "class X0 { \n" +
- " void foo(int i, double d){} \n" + // extra match
- "} \n",
- "q/Y.java", //================================
- "package q; \n" +
- "public abstract class Y extends p.X implements I { \n" +
- " public void bar(){ foo(1, 2); } \n" +
- " public static class Z extends Y { \n" +
- " public void foo(float f, int i) { \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n" +
- "} \n" +
- "interface I { \n" +
- " void foo(float f, int i); \n" +
- "} \n",
- },
- "SUCCESS");
-}
-
-// binary compatibility
-public void _test43() {
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n" +
- "public class Y extends A implements I { \n" +
- " public static void main(String[] args) { \n" +
- " Y.printValues(); \n" +
- " } \n" +
- " public static void printValues() { \n" +
- " System.out.println(\"i=\"+i+\",j=\"+j+\",Y.i=\"+Y.i+\",Y.j=\"+Y.j); \n" +
- " } \n" +
- "} \n",
- "p1/A.java",
- "package p1; \n" +
- "public class A { \n" +
- " static int i = 1; \n" +
- "} \n",
- "p1/I.java",
- "package p1; \n" +
- "interface I { \n" +
- " int j = \"aa\".length(); \n" +
- "} \n",
- },
- "i=1,j=2,Y.i=1,Y.j=2");
-
- this.runConformTest(
- new String[] {
- "p1/A.java",
- "package p1; \n" +
- "public class A { \n" +
- " static int j = 3; \n" +
- " public static void main(String[] args) { \n" +
- " Y.printValues(); \n" +
- " } \n" +
- "} \n",
- "p1/I.java",
- "package p1; \n" +
- "interface I { \n" +
- " int j = \"aaaa\".length(); \n" +
- "} \n",
- },
- "i=4,j=3,Y.i=4,Y.j=3",
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-/*
- * array.clone() should use array type in methodRef
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36307
- */
-public void test44() {
- this.runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " args.clone(); \n"+
- " System.out.println(\"SUCCESS\");\n" +
- " }\n" +
- "}\n",
- },
- "SUCCESS");
-
- ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
- String actualOutput = null;
- try {
- byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class"));
- actualOutput =
- disassembler.disassemble(
- classFileBytes,
- "\n",
- ClassFileBytesDisassembler.DETAILED);
- } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
- assertTrue("ClassFormatException", false);
- } catch (IOException e) {
- assertTrue("IOException", false);
- }
-
- String expectedOutput =
- " 1 invokevirtual #19 <Method java.lang.Object#clone() java.lang.Object>\n";
-
- if (actualOutput.indexOf(expectedOutput) == -1) {
- System.out.println(org.eclipse.jdt.core.tests.util.Util.displayString(actualOutput, 2));
- }
- assertTrue("unexpected bytecode sequence", actualOutput.indexOf(expectedOutput) != -1);
-}
-
-public static Class testClass() {
- return Compliance_1_3.class;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java
deleted file mode 100644
index 0667873..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java
+++ /dev/null
@@ -1,1655 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.ToolFactory;
-import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.util.Util;
-import org.eclipse.jdt.internal.core.index.IDocument;
-import org.eclipse.jdt.internal.core.index.IIndexerOutput;
-import org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer;
-
-public class Compliance_1_4 extends AbstractRegressionTest {
-public Compliance_1_4(String name) {
- super(name);
-}
-
-/*
- * Toggle compiler in mode -1.4
- */
-protected Map getCompilerOptions() {
- Map options = super.getCompilerOptions();
- options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
- options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
- options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
- return options;
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public void test01() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " class M { \n"+
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " M m; \n"+
- " }; \n"+
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " class M {} \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test02() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar() { \n"+
- " return \"FAILED\"; \n" +
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar(); \n" +
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " String bar(){ return \"SUCCESS\"; } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test03() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar = \"FAILED\";"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar; \n"+
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " String bar = \"SUCCESS\"; \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test04() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar() { \n"+
- " return \"SUCCESS\"; \n" +
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar(); \n" +
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " private String bar(){ return \"FAILED\"; } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test05() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar = \"SUCCESS\";"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar; \n"+
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " private String bar = \"FAILED\"; \n" +
- "} \n"
- },
- "SUCCESS");
-}
-public void test06() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " new Test().foo(); \n"+
- " } \n"+
- " String bar() { \n"+
- " return \"FAILED\"; \n" +
- " } \n"+
- " void foo(){ \n"+
- " class Y extends Secondary { \n"+
- " String z = bar(); \n" +
- " }; \n"+
- " System.out.println(new Y().z); \n" +
- " } \n"+
- "} \n" +
- "class Secondary { \n" +
- " String bar(int i){ return \"SUCCESS\"; } \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 11)\n" +
- " String z = bar(); \n" +
- " ^^^\n" +
- "The method bar(int) in the type Secondary is not applicable for the arguments ()\n" +
- "----------\n"
- );
-}
-public void test07() {
- this.runConformTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " try { \n" +
- " throw null; \n"+
- " } catch(NullPointerException e){ \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-public void test08() {
- this.runNegativeTest(
- new String[] {
- "p1/Test.java",
- "package p1; \n"+
- "import Test2; \n" +
- "import Test2.Member; \n" +
- "public class Test { \n"+
- " public static void main(String[] arguments) { \n"+
- " } \n"+
- "} \n",
- "Test2.java",
- "public class Test2 { \n"+
- " public class Member { \n" +
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\Test.java (at line 2)\n" +
- " import Test2; \n" +
- " ^^^^^\n" +
- "The import Test2 cannot be resolved\n" +
- "----------\n" +
- "2. ERROR in p1\\Test.java (at line 3)\n" +
- " import Test2.Member; \n" +
- " ^^^^^^^^^^^^\n" +
- "The import Test2 cannot be resolved\n" +
- "----------\n"
- );
-}
-// binary compatibility
-public void test09() {
- this.runConformTest(
- new String[] {
- "p1/Z.java",
- "package p1; \n"+
- "public class Z { \n" +
- " public static void main(String[] arguments) { \n"+
- " Y y = new Y(); \n" +
- " System.out.print(y.field); \n" +
- " System.out.print(y.staticField); \n" +
- " System.out.print(y.method()); \n" +
- " System.out.println(y.staticMethod()); \n" +
- " } \n"+
- "} \n",
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " public String field = \"X.field-\"; \n" +
- " public static String staticField = \"X.staticField-\"; \n" +
- " public String method(){ return \"X.method()-\"; } \n" +
- " public static String staticMethod(){ return \"X.staticMethod()-\"; } \n" +
- "} \n",
- "p1/Y.java",
- "package p1; \n"+
- "public class Y extends X { \n"+
- "} \n"
- },
- "X.field-X.staticField-X.method()-X.staticMethod()-");
-
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n"+
- "public class Y extends X { \n"+
- " public static void main(String[] arguments) { \n"+
- " Z.main(arguments); \n" +
- " } \n" +
- " public String field = \"Y.field-\"; \n" +
- " public static String staticField = \"Y.staticField-\"; \n" +
- " public String method(){ return \"Y.method()-\"; } \n" +
- " public static String staticMethod(){ return \"Y.staticMethod()-\"; } \n" +
- "} \n"
- },
- "Y.field-Y.staticField-Y.method()-Y.staticMethod()-", // expected output
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-
-// check actualReceiverType when array type
-public void test10() {
- this.runConformTest(
- new String[] {
- "p1/Z.java",
- "package p1; \n"+
- "public class Z { \n" +
- " public static void main(String[] arguments) { \n"+
- " String[] s = new String[]{\"SUCCESS\" }; \n" +
- " System.out.print(s.length); \n" +
- " System.out.print(((String[])s.clone())[0]); \n" +
- " } \n"+
- "} \n"
- },
- "1SUCCESS");
-}
-// test unreachable code complaints
-public void test11() {
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " void foo() { \n"+
- " while (false); \n" +
- " while (false) System.out.println(\"unreachable\"); \n" +
- " do ; while (false); \n" +
- " do System.out.println(\"unreachable\"); while (false); \n" +
- " for (;false;); \n" +
- " for (;false;) System.out.println(\"unreachable\"); \n" +
- " if (false); \n" +
- " if (false)System.out.println(\"unreachable\"); \n" +
- " } \n" +
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 4)\n" +
- " while (false); \n" +
- " ^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 5)\n" +
- " while (false) System.out.println(\"unreachable\"); \n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "3. ERROR in p1\\X.java (at line 8)\n" +
- " for (;false;); \n" +
- " ^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "4. ERROR in p1\\X.java (at line 9)\n" +
- " for (;false;) System.out.println(\"unreachable\"); \n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Unreachable code\n" +
- "----------\n"
- );
-}
-// binary compatibility
-public void test12() {
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n" +
- "class Store { \n" +
- " String value; \n" +
- " Store(String value){ \n" +
- " this.value = value; \n" +
- " } \n" +
- "} \n" +
- "class Top { \n" +
- " static String bar = \"Top.bar\"; \n" +
- " String foo = \"Top.foo\"; \n" +
- " Store store = new Store(\"Top.store\"); \n" +
- " static Store sstore = new Store(\"Top.sstore\"); \n" +
- " static Top ss = new Top(); \n" +
- "} \n" +
- "public class Y extends Updated { \n" +
- " public static void main(String[] arguments) { \n" +
- " new Y().test(); \n" +
- " } \n" +
- " void test() { \n" +
- " System.out.print(\"*** FIELD ACCESS ***\"); \n" +
- " System.out.print(\"*1* new Updated().bar: \" + new Updated().bar); \n" +
- " System.out.print(\"*2* new Updated().foo: \" + new Updated().foo); \n" +
- " System.out.print(\"*3* new Y().foo: \" + new Y().foo); \n" +
- " System.out.print(\"*4* new Y().bar: \" + new Y().bar); \n" +
- " System.out.print(\"*5* bar: \" + bar); \n" +
- " System.out.print(\"*6* foo: \" + foo); \n" +
- " System.out.print(\"*7* Y.bar: \" + Y.bar); \n" +
- " System.out.print(\"*8* this.bar: \" + this.bar); \n" +
- " System.out.print(\"*9* this.foo: \" + this.foo); \n" +
- " System.out.print(\"*10* store.value: \" + store.value); \n" +
- " System.out.print(\"*11* sstore.value: \" + sstore.value); \n" +
- " System.out.print(\"*12* ss.sstore.value: \" + ss.sstore.value); \n" +
- " } \n" +
- "} \n",
- "p1/Updated.java",
- "package p1; \n" +
- "public class Updated extends Top { \n" +
- "} \n"
- },
- "*** FIELD ACCESS ***"
- +"*1* new Updated().bar: Top.bar"
- +"*2* new Updated().foo: Top.foo"
- +"*3* new Y().foo: Top.foo"
- +"*4* new Y().bar: Top.bar"
- +"*5* bar: Top.bar"
- +"*6* foo: Top.foo"
- +"*7* Y.bar: Top.bar"
- +"*8* this.bar: Top.bar"
- +"*9* this.foo: Top.foo"
- +"*10* store.value: Top.store"
- +"*11* sstore.value: Top.sstore"
- +"*12* ss.sstore.value: Top.sstore");
-
- this.runConformTest(
- new String[] {
- "p1/Updated.java",
- "package p1; \n"+
- "public class Updated extends Top { \n"+
- " public static void main(String[] arguments) { \n"+
- " Y.main(arguments); \n" +
- " } \n" +
- " static String bar = \"Updated.bar\"; \n" +
- " String foo = \"Updated.foo\"; \n" +
- " Store store = new Store(\"Updated.store\"); \n" +
- " static Store sstore = new Store(\"Updated.sstore\"); \n" +
- " static Updated ss = new Updated(); \n" +
- "} \n"
- },
- "*** FIELD ACCESS ***"
- +"*1* new Updated().bar: Updated.bar"
- +"*2* new Updated().foo: Updated.foo"
- +"*3* new Y().foo: Updated.foo"
- +"*4* new Y().bar: Updated.bar"
- +"*5* bar: Top.bar"
- +"*6* foo: Updated.foo"
- +"*7* Y.bar: Updated.bar"
- +"*8* this.bar: Updated.bar"
- +"*9* this.foo: Updated.foo"
- +"*10* store.value: Updated.store"
- +"*11* sstore.value: Top.sstore"
- +"*12* ss.sstore.value: Top.sstore",
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-// binary compatibility
-public void test13() {
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n" +
- "class Store { \n" +
- " String value; \n" +
- " Store(String value){ \n" +
- " this.value = value; \n" +
- " } \n" +
- "} \n" +
- "class Top { \n" +
- " static String bar() { return \"Top.bar()\"; } \n" +
- " String foo() { return \"Top.foo()\"; } \n" +
- "} \n" +
- "public class Y extends Updated { \n" +
- " public static void main(String[] arguments) { \n" +
- " new Y().test(); \n" +
- " } \n" +
- " void test() { \n" +
- " System.out.print(\"*** METHOD ACCESS ***\"); \n" +
- " System.out.print(\"*1* new Updated().bar(): \" + new Updated().bar()); \n" +
- " System.out.print(\"*2* new Updated().foo(): \" + new Updated().foo()); \n" +
- " System.out.print(\"*3* new Y().foo(): \" + new Y().foo()); \n" +
- " System.out.print(\"*4* new Y().bar(): \" + new Y().bar()); \n" +
- " System.out.print(\"*5* bar(): \" + bar()); \n" +
- " System.out.print(\"*6* foo(): \" + foo()); \n" +
- " System.out.print(\"*7* Y.bar(): \" + Y.bar()); \n" +
- " System.out.print(\"*8* this.bar(): \" + this.bar()); \n" +
- " System.out.print(\"*9* this.foo(): \" + this.foo()); \n" +
- " } \n" +
- "} \n",
- "p1/Updated.java",
- "package p1; \n" +
- "public class Updated extends Top { \n" +
- "} \n"
- },
- "*** METHOD ACCESS ***"
- +"*1* new Updated().bar(): Top.bar()"
- +"*2* new Updated().foo(): Top.foo()"
- +"*3* new Y().foo(): Top.foo()"
- +"*4* new Y().bar(): Top.bar()"
- +"*5* bar(): Top.bar()"
- +"*6* foo(): Top.foo()"
- +"*7* Y.bar(): Top.bar()"
- +"*8* this.bar(): Top.bar()"
- +"*9* this.foo(): Top.foo()");
-
- this.runConformTest(
- new String[] {
- "p1/Updated.java",
- "package p1; \n"+
- "public class Updated extends Top { \n"+
- " public static void main(String[] arguments) { \n"+
- " Y.main(arguments); \n" +
- " } \n" +
- " static String bar() { return \"Updated.bar()\"; } \n" +
- " String foo() { return \"Updated.foo()\"; } \n" +
- "} \n"
- },
- "*** METHOD ACCESS ***"
- +"*1* new Updated().bar(): Updated.bar()"
- +"*2* new Updated().foo(): Updated.foo()"
- +"*3* new Y().foo(): Updated.foo()"
- +"*4* new Y().bar(): Updated.bar()"
- +"*5* bar(): Top.bar()"
- +"*6* foo(): Updated.foo()"
- +"*7* Y.bar(): Updated.bar()"
- +"*8* this.bar(): Updated.bar()"
- +"*9* this.foo(): Updated.foo()",
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-
-public void test14() {
- this.runConformTest(
- new String[] {
- "p1/X.java",
- "package p1; \n" +
- "class T { \n" +
- " void foo(boolean b) { \n" +
- " System.out.print(\"T.foo(boolean)#\"); \n" +
- " } \n" +
- " boolean bar = false; \n" +
- " class Member { \n" +
- " void display(){ System.out.print(\"T.Member#\"); } \n" +
- " } \n" +
- "} \n" +
- "public class X { \n" +
- " void foo(int i) { \n" +
- " System.out.println(\"X.foo(int)#\"); \n" +
- " } \n" +
- " int bar; \n" +
- " class Member { \n" +
- " void display(){ System.out.print(\"X.Member#\"); } \n" +
- " } \n" +
- " public static void main(String[] arguments) { \n" +
- " new X().bar(); \n" +
- " } \n" +
- " void bar() { \n" +
- " new T() { \n" +
- " { \n" +
- " foo(true); \n" +
- " System.out.print((boolean)bar + \"#\"); \n" +
- " Member m = new Member(); \n" +
- " m.display(); \n" +
- " } \n" +
- " }; \n" +
- " } \n" +
- "} \n"
- },
- "T.foo(boolean)#false#T.Member");
-}
-
-/*
- * check handling of default abstract methods
- */
-public void test15() {
- this.runConformTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " public static void main(String[] arguments) { \n"+
- " C c = new C() { \n"+
- " public void doSomething(){ \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- " }; \n"+
- " c.doSomething(); \n"+
- " } \n"+
- "} \n"+
- "interface I { \n"+
- " void doSomething(); \n"+
- "} \n"+
- "abstract class C implements I { \n"+
- "} \n"
- },
- "SUCCESS");
-}
-
-public void test16() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(boolean b) {} \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " foo(0); \n" +
- " ^^^\n" +
- "The method foo(boolean) in the type T is not applicable for the arguments (int)\n" +
- "----------\n");
-}
-
-public void test17() {
- this.runConformTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(boolean b) { System.out.println(\"SUCCESS\"); } \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(false); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().bar(); \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-
-public void test18() {
- this.runConformTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(int j) { System.out.println(\"SUCCESS\"); } \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().bar(); \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-public void test19() {
- this.runConformTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(int j) { System.out.println(\"SUCCESS\"); } \n"+
- "} \n"+
- "class U { \n"+
- " void foo(int j) { System.out.println(\"FAILED\"); } \n"+
- "} \n"+
- "public class X extends U { \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().bar(); \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-public void test20() {
- this.runConformTest(
- new String[] {
- "X.java",
- "class T { \n"+
- " void foo(int j) { System.out.println(\"SUCCESS\"); } \n"+
- "} \n"+
- "class U { \n"+
- " void foo(boolean j) { System.out.println(\"FAILED\"); } \n"+
- "} \n"+
- "public class X extends U { \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().bar(); \n" +
- " } \n"+
- "} \n"
- },
- "SUCCESS");
-}
-// binary check for 11511
-public void test21() {
- this.runConformTest(
- new String[] {
- "p1/Z.java",
- "package p1; \n" +
- "public class Z extends AbstractA { \n" +
- " public static void main(String[] arguments) { \n" +
- " new Z().init(); \n" +
- " } \n" +
- "} \n" +
- "abstract class AbstractB implements K { \n" +
- " public void init() { \n" +
- " System.out.println(\"AbstractB.init()\"); \n" +
- " } \n" +
- "} \n" +
- "interface K { \n" +
- " void init(); \n" +
- " void init(int i); \n" +
- "} \n",
- "p1/AbstractA.java",
- "package p1; \n" +
- "public abstract class AbstractA extends AbstractB implements K { \n" +
- " public void init(int i) { \n" +
- " } \n" +
- "} \n"
- },
- "AbstractB.init()"); // no special vm args
-
- // check that "new Z().init()" is bound to "Z.init()"
- final StringBuffer references = new StringBuffer(10);
- try {
- BinaryIndexer indexer = new BinaryIndexer(true);
- indexer.index(
- new IDocument() {
- public byte[] getByteContent() throws IOException {
- return Util.getFileByteContent(new File(OUTPUT_DIR + "/p1/Z.class"));
- }
- public char[] getCharContent() throws IOException { return null; }
- public String getName() { return "Z.class"; }
- public String getStringContent() throws IOException { return null; }
- public String getType() { return "class"; }
- public String getEncoding() { return null; }
- },
- new IIndexerOutput() {
- public void addDocument(IDocument document) { }
- public void addRef(char[] word) {
- references.append(word);
- references.append('\n');
- }
- public void addRef(String word) {
- //System.out.println(word);
- }
- });
- } catch(IOException e) {
- }
- String computedReferences = references.toString();
- boolean check = computedReferences.indexOf("constructorRef/Z/0\nmethodRef/init/0") >= 0;
- if (!check){
- System.out.println(computedReferences);
- }
- assertTrue("did not bind 'new Z().init()' to Z.init()'", check);
-}
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis
- */
-public void test22() {
-
- this.runNegativeTest(
- new String[] {
- "p1/T.java",
- "package p1; \n"+
- "interface II {} \n"+
- "class TT { \n"+
- " void foo(boolean b) {} \n"+
- " void foo(int i, boolean b) {} \n"+
- " void foo(String s) {} \n"+
- "} \n"+
- "public abstract class T implements II { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(0); // should say that foo(int, boolean) isn't applicable \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void boo() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(true); // should not complain about ambiguity \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\T.java (at line 13)\n" +
- " foo(0); // should say that foo(int, boolean) isn\'t applicable \n" +
- " ^^^\n" +
- "The method foo(int, boolean) in the type TT is not applicable for the arguments (int)\n" +
- "----------\n");
-}
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis
- */
-public void test23() {
-
- this.runNegativeTest(
- new String[] {
- "p1/T.java",
- "package p1; \n"+
- "interface II {} \n"+
- "abstract class TT { \n"+ // 259+ABSTRACT
- " void foo(boolean b) {} \n"+
- " void foo(int i, boolean b) {} \n"+
- " void foo(String s) {} \n"+
- "} \n"+
- "public abstract class T implements II { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(0); // should say that foo(int, boolean) isn't applicable \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void boo() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(true); // should complain ambiguity \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\T.java (at line 13)\n" +
- " foo(0); // should say that foo(int, boolean) isn\'t applicable \n" +
- " ^^^\n" +
- "The method foo(int, boolean) in the type TT is not applicable for the arguments (int)\n" +
- "----------\n");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis
- */
-public void test24() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "interface II {} \n"+
- "abstract class T implements II { \n"+
- " void foo(boolean b) {} \n"+
- " void foo(int i, boolean b) {} \n"+
- "} \n"+
- "abstract class TT implements II { \n"+
- " void foo(boolean b) {} \n"+
- "} \n"+
- "public class X { \n"+
- " void foo(int i) {} \n"+
- " void bar() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(0); // javac says foo cannot be resolved because of multiple matches \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void bar2() { \n"+
- " new TT() { \n"+
- " { \n"+
- " foo(0); // should say that foo(boolean) isn't applicable \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " void boo() { \n"+
- " new T() { \n"+
- " { \n"+
- " foo(true); // should complain ambiguity \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 15)\n" +
- " foo(0); // javac says foo cannot be resolved because of multiple matches \n" +
- " ^^^\n" +
- "The method foo(int, boolean) in the type T is not applicable for the arguments (int)\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 22)\n" +
- " foo(0); // should say that foo(boolean) isn\'t applicable \n" +
- " ^^^\n" +
- "The method foo(boolean) in the type TT is not applicable for the arguments (int)\n" +
- "----------\n");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis (no matter if super is abstract or not)
- */
-public void test25() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X extends AbstractY { \n"+
- " void bar(){ \n"+
- " init(\"hello\"); \n"+
- " } \n"+
- "} \n"+
- "abstract class AbstractY implements I { \n"+
- "} \n"+
- "interface I { \n"+
- " void init(String s, int i); \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 2)\n" +
- " public class X extends AbstractY { \n" +
- " ^\n" +
- "Class must implement the inherited abstract method I.init(String, int)\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 4)\n" +
- " init(\"hello\"); \n" +
- " ^^^^\n" +
- "The method init(String, int) in the type I is not applicable for the arguments (String)\n" +
- "----------\n");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11511
- * variant - applicable error diagnosis (no matter if super is abstract or not)
- */
-public void test26() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X extends AbstractY { \n"+
- " void bar(){ \n"+
- " init(\"hello\"); \n"+
- " } \n"+
- "} \n"+
- "class AbstractY implements I { \n"+
- "} \n"+
- "interface I { \n"+
- " void init(String s, int i); \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 4)\n" +
- " init(\"hello\"); \n" +
- " ^^^^\n" +
- "The method init(String, int) in the type I is not applicable for the arguments (String)\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 7)\n" +
- " class AbstractY implements I { \n" +
- " ^^^^^^^^^\n" +
- "Class must implement the inherited abstract method I.init(String, int)\n" +
- "----------\n"
-);
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11922
- * should report unreachable empty statement
- */
-public void test27() {
-
- this.runNegativeTest(
- new String[] {
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " public static void main(String[] arguments) { \n"+
- " for (;false;p()); \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- " static void p(){ \n"+
- " System.out.println(\"FAILED\"); \n"+
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in p1\\X.java (at line 4)\n" +
- " for (;false;p()); \n" +
- " ^\n" +
- "Unreachable code\n" +
- "----------\n");
-}
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=12445
- * should report unreachable empty statement
- */
-public void test28() {
-
- this.runConformTest(
- new String[] {
- "p1/X.java",
- "package p1; \n" +
- "interface FooInterface { \n" +
- " public boolean foo(int a); \n" +
- " public boolean bar(int a); \n" +
- "} \n" +
- "public class X extends Z { \n" +
- " public boolean foo(int a){ return true; } \n" +
- " public boolean bar(int a){ return false; } \n" +
- " public static void main(String[] arguments) { \n"+
- " System.out.println(new X().test(0)); \n"+
- " } \n" +
- "}\n" +
- "abstract class Z implements FooInterface { \n" +
- " public boolean foo(int a, int b) { \n" +
- " return true; \n" +
- " } \n" +
- " public String test(int a) { \n" +
- " boolean result = foo(a); \n" +
- " if (result) \n" +
- " return \"SUCCESS\"; \n" +
- " else \n" +
- " return \"FAILED\"; \n" +
- " } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * verify error on qualified name ref in 1.4
- */
-public void test29() {
-
- this.runConformTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X { \n" +
- " public static void main(String[] args) { \n" +
- " new X(); \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " Woof woof_1; \n" +
- " public class Honk { \n" +
- " Integer honks; \n" +
- " } \n" +
- " public class Meow { \n" +
- " Honk honk_1; \n" +
- " } \n" +
- " public class Woof { \n" +
- " Meow meow_1; \n" +
- " } \n" +
- " public void setHonks(int num) { \n" +
- " // This is the line that causes the VerifyError \n" +
- " woof_1.meow_1.honk_1.honks = new Integer(num); \n" +
- " // Here is equivalent code that does not cause the error. \n" +
- " // Honk h = woof_1.moo_1.meow_1.honk_1; \n" +
- " // h.honks = new Integer(num); \n" +
- " } \n" +
- "} \n"
- },
- "SUCCESS");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * 1.4 signals invocations of non-visible abstract protected method implementations.
- */
-public void test30() {
-
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X { \n" +
- " public static void main(String[] args){ \n" +
- " new q.X2().foo(\"String\"); \n" +
- " new q.X2().bar(\"String\"); \n" +
- " new q.X2().barbar(\"String\"); \n" +
- " new q.X2().baz(\"String\"); \n" +
- " } \n" +
- "} \n",
-
- "p/X1.java",
- "package p; \n" +
- "public abstract class X1 { \n" +
- " protected void foo(Object o){ System.out.println(\"X1.foo(Object)\"); } \n" +
- " protected void bar(Object o){ System.out.println(\"X1.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X1.barbar(Object)\"); } \n" +
- " protected void baz(Object o) { System.out.println(\"X1.baz(Object)\"); } \n" +
- "} \n",
-
- "q/X2.java",
- "package q; \n" +
- "public class X2 extends p.X1 { \n" +
- " protected void foo(int i) { System.out.println(\"X2.foo(int)\"); } \n" +
- " protected void bar(Object o) { System.out.println(\"X2.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " protected void baz(String s) { System.out.println(\"X2.baz(String)\"); } \n" +
- "} \n",
- },
- "----------\n" +
- "1. ERROR in p\\X.java (at line 5)\n" +
- " new q.X2().bar(\"String\"); \n" +
- " ^^^\n" +
- "The method bar(Object) from the type X2 is not visible\n" +
- "----------\n" +
- "2. ERROR in p\\X.java (at line 6)\n" +
- " new q.X2().barbar(\"String\"); \n" +
- " ^^^^^^\n" +
- "The method barbar(Object) from the type X2 is not visible\n" +
- "----------\n" +
- "----------\n" +
- "1. WARNING in q\\X2.java (at line 5)\n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The method X2.barbar(Object) does not override the inherited method from X1 since it is private to a different package.\n" +
- "----------\n");
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * 1.4 signals invocations of non-visible abstract protected method implementations.
- */
-public void test31() {
-
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X extends q.X2 { \n" +
- " public static void main(String[] args){ \n" +
- " new X().doSomething(); \n" +
- " } \n" +
- " void doSomething(){ \n" +
- " foo(\"String\"); \n" +
- " bar(\"String\"); \n" +
- " barbar(\"String\"); \n" +
- " baz(\"String\"); \n" +
- " } \n" +
- "} \n",
-
- "p/X1.java",
- "package p; \n" +
- "public abstract class X1 { \n" +
- " protected void foo(Object o){ System.out.println(\"X1.foo(Object)\"); } \n" +
- " protected void bar(Object o){ System.out.println(\"X1.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X1.barbar(Object)\"); } \n" +
- " protected void baz(Object o) { System.out.println(\"X1.baz(Object)\"); } \n" +
- "} \n",
-
- "q/X2.java",
- "package q; \n" +
- "public class X2 extends p.X1 { \n" +
- " protected void foo(int i) { System.out.println(\"X2.foo(int)\"); } \n" +
- " protected void bar(Object o) { System.out.println(\"X2.bar(Object)\"); } \n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " protected void baz(String s) { System.out.println(\"X2.baz(String)\"); } \n" +
- "} \n",
- },
- "----------\n" +
- "1. ERROR in p\\X.java (at line 9)\n" +
- " barbar(\"String\"); \n" +
- " ^^^^^^\n" +
- "The method barbar(Object) from the type X2 is not visible\n" +
- "----------\n" +
- "----------\n" +
- "1. WARNING in q\\X2.java (at line 5)\n" +
- " void barbar(Object o){ System.out.println(\"X2.barbar(Object)\"); } \n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The method X2.barbar(Object) does not override the inherited method from X1 since it is private to a different package.\n" +
- "----------\n"
-);
-}
-
-/*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=21580
- * 1.4 signals invocations of non-visible abstract protected field implementations.
- */
-public void test32() {
-
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n" +
- "public class X { \n" +
- " public static void main(String[] args){ \n" +
- " System.out.println(new q.X2().foo); \n" +
- " System.out.println(new q.X2().bar); \n" +
- " } \n" +
- "} \n",
-
- "p/X1.java",
- "package p; \n" +
- "public abstract class X1 { \n" +
- " protected String foo = \"X1.foo\"; \n" +
- " String bar = \"X1.bar\"; \n" +
- "} \n",
-
- "q/X2.java",
- "package q; \n" +
- "public class X2 extends p.X1 { \n" +
- " protected String foo = \"X2.foo\"; \n" +
- " String bar = \"X2.bar\"; \n" +
- "} \n",
- },
- "----------\n" +
- "1. ERROR in p\\X.java (at line 4)\n" +
- " System.out.println(new q.X2().foo); \n" +
- " ^^^\n" +
- "The field foo is not visible\n" +
- "----------\n" +
- "2. ERROR in p\\X.java (at line 5)\n" +
- " System.out.println(new q.X2().bar); \n" +
- " ^^^\n" +
- "The field bar is not visible\n" +
- "----------\n");
-}
-
-/*
- * Initialization of synthetic fields prior to super constructor call
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23075
- */
-public void test33() {
-
- this.runConformTest(
- new String[] {
- "A.java",
- "public class A { \n"+
- " public int m; \n"+
- " public void pp() { \n"+
- " C c = new C(4); \n"+
- " System.out.println(c.get()); \n"+
- " } \n"+
- " public static void main(String[] args) { \n"+
- " A a = new A(); \n"+
- " try { \n"+
- " a.pp(); \n"+
- " System.out.println(\"SyntheticInit BEFORE SuperConstructorCall\"); \n"+
- " } catch(NullPointerException e) { \n"+
- " System.out.println(\"SyntheticInit AFTER SuperConstructorCall\"); // should no longer occur with target 1.4 \n"+
- " } \n"+
- " } \n"+
- " class C extends B { \n"+
- " public C(int x1) { \n"+
- " super(x1); \n"+
- " } \n"+
- " protected void init(int x1) { \n"+
- " x = m * x1; // <- NULL POINTER EXCEPTION because of m \n"+
- " } \n"+
- " } \n"+
- "} \n"+
- "class B { \n"+
- " int x; \n"+
- " public B(int x1) { \n"+
- " init(x1); \n"+
- " } \n"+
- " protected void init(int x1) { \n"+
- " x = x1; \n"+
- " } \n"+
- " public int get() { \n"+
- " return x; \n"+
- " } \n"+
- "} \n"
- },
- "SyntheticInit BEFORE SuperConstructorCall");
-}
-/*
- * Initialization of synthetic fields prior to super constructor call - NPE check
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25174
- */
-public void test34() {
-
- this.runConformTest(
- new String[] {
- "X.java",
- "public class X { \n"+
- " public static void main(String[] arguments) { \n"+
- " new X().new X2(); \n"+
- " } \n"+
- " class X1 { \n"+
- " X1(){ \n"+
- " this.baz(); \n"+
- " } \n"+
- " void baz() { \n"+
- " System.out.println(\"-X1.baz()\"); \n"+
- " } \n"+
- " } \n"+
- " class X2 extends X1 { \n"+
- " void baz() { \n"+
- " System.out.print(X.this==null ? \"X.this == null\" : \"X.this != null\"); \n"+
- " X1 x1 = X.this.new X1(){ \n"+
- " void baz(){ \n"+
- " System.out.println(\"-X$1.baz()\"); \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " } \n"+
- "}\n",
- },
- "X.this != null-X$1.baz()");
-}
-
-public void test35() {
- this.runConformTest(
- new String[] {
- /* p1/X.java */
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " class Y { Y(int i){} } \n"+
- " public static void main(String[] arguments) { \n"+
- " int i = 1; \n" +
- " try { \n" +
- " X x =null; \n" +
- " x.new Y(++i); \n" + // i won't get incremented before NPE
- " System.out.println(\"FAILED\"); \n" +
- " } catch(NullPointerException e){ \n" +
- " System.out.println(\"SUCCESS:\"+i); \n" +
- " } \n" +
- " } \n"+
- "} \n",
- },
- "SUCCESS:1"
- );
-}
-
-public void test36() {
- this.runConformTest(
- new String[] {
- /* p1/X.java */
- "p1/X.java",
- "package p1; \n"+
- "public class X { \n"+
- " class Y {} \n"+
- " static class Z extends Y { \n"+
- " Z (X x){ \n"+
- " x.super(); \n" +
- " } \n"+
- " } \n"+
- " public static void main(String[] arguments) { \n"+
- " try { \n" +
- " new Z(null); \n" +
- " System.out.println(\"FAILED\"); \n" +
- " } catch(NullPointerException e){ \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n"+
- "} \n",
- },
- "SUCCESS"
- );
-}
-
-/*
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=24744
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23096
- *
- * NOTE: since JLS got revised to allow unterminated line comments (32476)
- */
-public void test37() {
- Map customOptions = getCompilerOptions();
- customOptions.put(CompilerOptions.OPTION_TaskTags, "TODO:");
- this.runNegativeTest(
- new String[] {
- "p/X.java",
- "package p; \n"+
- "public class X {\n"+
- "}\n"+
- "// TODO: something"
- },
- "----------\n" +
- "1. WARNING in p\\X.java (at line 4)\n" +
- " // TODO: something\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "TODO: something\n" +
- "----------\n",
- null,
- true,
- customOptions);
-}
-
-/*
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=24833
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23096
- *
- * NOTE: since JLS got revised to allow unterminated line comments (32476)
- */
-public void test38() {
- Map customOptions = getCompilerOptions();
- customOptions.put(CompilerOptions.OPTION_TaskTags, "TODO:");
- this.runNegativeTest(
- new String[] {
- "X.java",
- "// TODO: something"
- },
- "----------\n" +
- "1. WARNING in X.java (at line 1)\n" +
- " // TODO: something\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "TODO: something\n" +
- "----------\n",
- null,
- true,
- customOptions);
-}
-
-/*
- * unreachable empty statement/block are diagnosed in 1.3
- */
-public void test39() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "public class X { \n" +
- " public static void main(String[] args){ \n"+
- " for (;null != null;); \n"+
- " for (;null != null;){} \n"+
- " for (;false;); \n"+
- " for (;false;){} \n"+
- " while (false); \n"+
- " while (false){} \n"+
- " if (false) {} else {} \n"+
- " if (false) ; else ; \n"+
- " System.out.println(\"FAILED\"); \n" +
- " } \n"+
- "} \n",
- },
- "----------\n" +
- "1. ERROR in X.java (at line 5)\n" +
- " for (;false;); \n" +
- " ^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 6)\n" +
- " for (;false;){} \n" +
- " ^^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 7)\n" +
- " while (false); \n" +
- " ^\n" +
- "Unreachable code\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 8)\n" +
- " while (false){} \n" +
- " ^^\n" +
- "Unreachable code\n" +
- "----------\n");
-}
-// jls6.5.5.1 - simple type names favor member type over toplevel one.
-//http://bugs.eclipse.org/bugs/show_bug.cgi?id=30705
-public void test40() {
- this.runNegativeTest(
- new String[] {
- "X.java",
- "public class X { \n"+
- " interface Homonym {} \n"+ // takes precedence over others.
- " void foo() { \n"+
- " class Homonym extends X { \n"+
- " { \n"+
- " class Y extends Homonym {}; \n"+ // X$Homonym
- " } \n"+
- " } \n"+
- " } \n"+
- "} \n"+
- "class Homonym extends X { \n"+
- " { \n"+
- " class Y extends Homonym {}; \n"+ // X$Homonym
- " } \n"+
- "} \n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 6)\n" +
- " class Y extends Homonym {}; \n" +
- " ^^^^^^^\n" +
- "The interface X.Homonym cannot be the superclass of Y; a superclass must be a class\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 13)\n" +
- " class Y extends Homonym {}; \n" +
- " ^^^^^^^\n" +
- "The interface X.Homonym cannot be the superclass of Y; a superclass must be a class\n" +
- "----------\n");
-}
-/*
- * 30856 - 1.4 compliant mode should consider abstract method matches
- */
-public void test41() {
- this.runConformTest(
- new String[] {
- "p/X.java", //================================
- "package p; \n" +
- "public class X { \n" +
- " void foo(int i, float f){} \n" +
- " public static void main(String[] args) { \n" +
- " q.Y y = new q.Y.Z(); \n" +
- " y.bar(); \n" +
- " } \n" +
- "} \n",
- "q/Y.java", //================================
- "package q; \n" +
- "public abstract class Y extends p.X implements I { \n" +
- " public void bar(){ foo(1, 2); } \n" +
- " public static class Z extends Y { \n" +
- " public void foo(float f, int i) { \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n" +
- "} \n" +
- "interface I { \n" +
- " void foo(float f, int i); \n" +
- "} \n",
- },
- "SUCCESS");
-}
-/*
- * variation - 30856 - 1.4 compliant mode should consider abstract method matches
- */
-public void test42() {
- this.runConformTest(
- new String[] {
- "p/X.java", //================================
- "package p; \n" +
- "public class X extends X0 { \n" +
- " void foo(int i, float f){} \n" +
- " public static void main(String[] args) { \n" +
- " q.Y y = new q.Y.Z(); \n" +
- " y.bar(); \n" +
- " } \n" +
- "} \n" +
- "class X0 { \n" +
- " void foo(int i, double d){} \n" + // extra match
- "} \n",
- "q/Y.java", //================================
- "package q; \n" +
- "public abstract class Y extends p.X implements I { \n" +
- " public void bar(){ foo(1, 2); } \n" +
- " public static class Z extends Y { \n" +
- " public void foo(float f, int i) { \n" +
- " System.out.println(\"SUCCESS\"); \n" +
- " } \n" +
- " } \n" +
- "} \n" +
- "interface I { \n" +
- " void foo(float f, int i); \n" +
- "} \n",
- },
- "SUCCESS");
-}
-
-// binary compatibility
-public void _test43() {
- this.runConformTest(
- new String[] {
- "p1/Y.java",
- "package p1; \n" +
- "public class Y extends A implements I { \n" +
- " public static void main(String[] args) { \n" +
- " Y.printValues(); \n" +
- " } \n" +
- " public static void printValues() { \n" +
- " System.out.println(\"i=\"+i+\",j=\"+j+\",Y.i=\"+Y.i+\",Y.j=\"+Y.j); \n" +
- " } \n" +
- "} \n",
- "p1/A.java",
- "package p1; \n" +
- "public class A { \n" +
- " static int i = 1; \n" +
- "} \n",
- "p1/I.java",
- "package p1; \n" +
- "interface I { \n" +
- " int j = \"aa\".length(); \n" +
- "} \n",
- },
- "i=1,j=2,Y.i=1,Y.j=2");
-
- this.runConformTest(
- new String[] {
- "p1/A.java",
- "package p1; \n" +
- "public class A { \n" +
- " static int j = 3; \n" +
- " public static void main(String[] args) { \n" +
- " Y.printValues(); \n" +
- " } \n" +
- "} \n",
- "p1/I.java",
- "package p1; \n" +
- "interface I { \n" +
- " int j = \"aaaa\".length(); \n" +
- "} \n",
- },
- "i=4,j=3,Y.i=4,Y.j=3",
- null, // use default class-path
- false, // do not flush previous output dir content
- null); // no special vm args
-}
-/*
- * array.clone() should use array type in methodRef
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36307
- */
-public void test44() {
- this.runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " args.clone(); \n"+
- " System.out.println(\"SUCCESS\");\n" +
- " }\n" +
- "}\n",
- },
- "SUCCESS");
-
- ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
- String actualOutput = null;
- try {
- byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class"));
- actualOutput =
- disassembler.disassemble(
- classFileBytes,
- "\n",
- ClassFileBytesDisassembler.DETAILED);
- } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
- assertTrue("ClassFormatException", false);
- } catch (IOException e) {
- assertTrue("IOException", false);
- }
-
- String expectedOutput =
- " 1 invokevirtual #21 <Method [Ljava.lang.String;#clone() java.lang.Object>\n";
-
- if (actualOutput.indexOf(expectedOutput) == -1) {
- System.out.println(org.eclipse.jdt.core.tests.util.Util.displayString(actualOutput, 2));
- }
- assertTrue("unexpected bytecode sequence", actualOutput.indexOf(expectedOutput) != -1);
-}
-public static Class testClass() {
- return Compliance_1_4.class;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java
deleted file mode 100644
index 5650295..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import junit.framework.Test;
-
-public class DeprecatedTest extends AbstractRegressionTest {
-public DeprecatedTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public void test1() {
- this.runNegativeTest(new String[] {
- "p/B.java",
- "package p;\n" +
- "class B extends A {\n" +
- " float x = super.x;\n" +
- "}\n",
-
- "p/A.java",
- "package p;\n" +
- "class A {\n" +
- " /** @deprecated */\n" +
- " int x = 1;\n" +
- "}\n",
- },
- "----------\n" +
- "1. WARNING in p\\B.java (at line 3)\n" +
- " float x = super.x;\n" +
- " ^\n" +
- "The field B.x is hiding a field from type A\n" +
- "----------\n" +
- "2. WARNING in p\\B.java (at line 3)\n" +
- " float x = super.x;\n" +
- " ^^^^^^^\n" +
- "The field A.x is deprecated\n" +
- "----------\n"
- );
-}
-public void test2() {
- this.runNegativeTest(new String[] {
- "p/C.java",
- "package p;\n" +
- "class C {\n" +
- " static int x = new A().x;\n" +
- "}\n",
-
- "p/A.java",
- "package p;\n" +
- "class A {\n" +
- " /** @deprecated */\n" +
- " int x = 1;\n" +
- "}\n",
-
- },
- "----------\n" +
- "1. WARNING in p\\C.java (at line 3)\n" +
- " static int x = new A().x;\n" +
- " ^\n" +
- "The field A.x is deprecated\n" +
- "----------\n"
- );
-}
-public void test3() {
- this.runNegativeTest(new String[] {
- "p/Top.java",
- "package p;\n" +
- "public class Top {\n" +
- " \n" +
- " class M1 {\n" +
- " class M2 {}\n" +
- " };\n" +
- " \n" +
- " static class StaticM1 {\n" +
- " static class StaticM2 {\n" +
- " class NonStaticM3{}};\n" +
- " };\n" +
- " \n" +
- "public static void main(String argv[]){\n" +
- " Top tip = new Top();\n" +
- " System.out.println(\"Still alive 0\");\n" +
- " tip.testStaticMember();\n" +
- " System.out.println(\"Still alive 1\");\n" +
- " tip.testStaticMember1();\n" +
- " System.out.println(\"Still alive 2\");\n" +
- " tip.testStaticMember2();\n" +
- " System.out.println(\"Still alive 3\");\n" +
- " tip.testStaticMember3();\n" +
- " System.out.println(\"Still alive 4\");\n" +
- " tip.testStaticMember4();\n" +
- " System.out.println(\"Completed\");\n" +
- "}\n" +
- " void testMember(){\n" +
- " new M1().new M2();}\n" +
- " void testStaticMember(){\n" +
- " new StaticM1().new StaticM2();}\n" +
- " void testStaticMember1(){\n" +
- " new StaticM1.StaticM2();}\n" +
- " void testStaticMember2(){\n" +
- " new StaticM1.StaticM2().new NonStaticM3();}\n" +
- " void testStaticMember3(){\n" +
- " // define an anonymous subclass of the non-static M3\n" +
- " new StaticM1.StaticM2().new NonStaticM3(){};\n" +
- " } \n" +
- " void testStaticMember4(){\n" +
- " // define an anonymous subclass of the non-static M3\n" +
- " new StaticM1.StaticM2().new NonStaticM3(){\n" +
- " Object hello(){\n" +
- " return new StaticM1.StaticM2().new NonStaticM3();\n" +
- " }};\n" +
- " \n" +
- " } \n" +
- "}\n",
- },
- "----------\n" +
- "1. ERROR in p\\Top.java (at line 30)\n" +
- " new StaticM1().new StaticM2();}\n" +
- " ^^^^^^^^^^^^^^\n" +
- "Illegal enclosing instance specification for type Top.StaticM1.StaticM2\n" +
- "----------\n" );
-}
-/**
- * Regression test for PR #1G9ES9B
- */
-public void test4() {
- this.runNegativeTest(new String[] {
- "p/Warning.java",
- "package p;\n" +
- "import java.util.Date;\n" +
- "public class Warning {\n" +
- "public Warning() {\n" +
- " super();\n" +
- " Date dateObj = new Date();\n" +
- " dateObj.UTC(1,2,3,4,5,6);\n" +
- "}\n" +
- "}\n",
- },
- "----------\n" +
- "1. WARNING in p\\Warning.java (at line 7)\n" +
- " dateObj.UTC(1,2,3,4,5,6);\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The method UTC(int, int, int, int, int, int) from the type Date is deprecated\n" +
- "----------\n" +
- "2. WARNING in p\\Warning.java (at line 7)\n" +
- " dateObj.UTC(1,2,3,4,5,6);\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The static method UTC(int, int, int, int, int, int) from the type Date should be accessed in a static way\n" +
- "----------\n"
-
- );
-}
-public void test5() {
- this.runConformTest(
- new String[] {
- "X.java",
- "public class X {\n"
- + "/**\n"
- + " * @deprecated\n"
- + " */\n"
- + " public static class Y {\n"
- + " }\n" +
- " public static void main(String[] args) { \n" +
- " System.out.print(\"SUCCESS\"); \n" +
- " } \n"
- + "}"
- },
- "SUCCESS", // expected output
- null,
- true, // flush previous output dir content
- null, // special vm args
- null); // custom options
- this.runNegativeTest(
- new String[] {
- "A.java",
- "public class A extends X.Y {}"
- },
- "----------\n" +
- "1. WARNING in A.java (at line 1)\n" +
- " public class A extends X.Y {}\n" +
- " ^\n" +
- "The constructor X.Y() is deprecated\n" +
- "----------\n" +
- "2. WARNING in A.java (at line 1)\n" +
- " public class A extends X.Y {}\n" +
- " ^^^\n" +
- "The type X.Y is deprecated\n" +
- "----------\n",// expected output
- null,
- false, // flush previous output dir content
- null); // custom options
-}
-public static Class testClass() {
- return DeprecatedTest.class;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExpectedProblem.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExpectedProblem.java
deleted file mode 100644
index 9be37f6..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExpectedProblem.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-public class ExpectedProblem {
- String fileName;
- int id;
- String[] arguments;
-public ExpectedProblem(String fileName, int id, String[] arguments) {
- this.fileName = fileName;
- this.id = id;
- this.arguments = arguments;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
deleted file mode 100644
index 3db8392..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
-import org.eclipse.jdt.internal.compiler.env.*;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
-
-public class InMemoryNameEnvironment implements INameEnvironment {
- INameEnvironment[] classLibs;
- HashtableOfObject compilationUnits = new HashtableOfObject();
-public InMemoryNameEnvironment(String[] compilationUnits, INameEnvironment[] classLibs) {
- this.classLibs = classLibs;
- for (int i = 0, length = compilationUnits.length - 1; i < length; i += 2) {
- String fileName = compilationUnits[i];
- char[] contents = compilationUnits[i + 1].toCharArray();
- String dirName = "";
- int lastSlash = -1;
- if ((lastSlash = fileName.lastIndexOf('/')) != -1) {
- dirName = fileName.substring(0, lastSlash);
- }
- char[] packageName = dirName.replace('/', '.').toCharArray();
- char[] cuName = fileName.substring(lastSlash == -1 ? 0 : lastSlash + 1, fileName.length() - 5).toCharArray(); // remove ".java"
- HashtableOfObject cus = (HashtableOfObject)this.compilationUnits.get(packageName);
- if (cus == null) {
- cus = new HashtableOfObject();
- this.compilationUnits.put(packageName, cus);
- }
- CompilationUnit unit = new CompilationUnit(contents, fileName, null);
- cus.put(cuName, unit);
- }
-}
-public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
- return findType(
- compoundTypeName[compoundTypeName.length - 1],
- CharOperation.subarray(compoundTypeName, 0, compoundTypeName.length - 1));
-}
-public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
- HashtableOfObject cus = (HashtableOfObject)this.compilationUnits.get(CharOperation.concatWith(packageName, '.'));
- if (cus == null) {
- return this.findTypeFromClassLibs(typeName, packageName);
- }
- CompilationUnit unit = (CompilationUnit)cus.get(typeName);
- if (unit == null) {
- return this.findTypeFromClassLibs(typeName, packageName);
- }
- return new NameEnvironmentAnswer(unit);
-}
-private NameEnvironmentAnswer findTypeFromClassLibs(char[] typeName, char[][] packageName) {
- for (int i = 0; i < this.classLibs.length; i++) {
- NameEnvironmentAnswer answer = this.classLibs[i].findType(typeName, packageName);
- if (answer != null) {
- return answer;
- }
- }
- return null;
-}
-public boolean isPackage(char[][] parentPackageName, char[] packageName) {
- char[] pkg = CharOperation.concatWith(parentPackageName, packageName, '.');
- return
- this.compilationUnits.get(pkg) != null ||
- this.isPackageFromClassLibs(parentPackageName, packageName);
-}
-public boolean isPackageFromClassLibs(char[][] parentPackageName, char[] packageName) {
- for (int i = 0; i < this.classLibs.length; i++) {
- if (this.classLibs[i].isPackage(parentPackageName, packageName)) {
- return true;
- }
- }
- return false;
-}
-public void cleanup() {
- for (int i = 0, max = this.classLibs.length; i < max; i++) {
- this.classLibs[i].cleanup();
- }
- this.compilationUnits = new HashtableOfObject();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LogRequestor.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LogRequestor.java
deleted file mode 100644
index b5c8bda..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LogRequestor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
-
-public class LogRequestor extends Requestor {
- String problemLog = "";
-public LogRequestor(org.eclipse.jdt.internal.compiler.IProblemFactory problemFactory, String outputPath) {
- super(problemFactory, outputPath, false);
-}
-public void acceptResult(CompilationResult compilationResult) {
- StringBuffer buffer = new StringBuffer(100);
- hasErrors |= compilationResult.hasErrors();
- if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
- IProblem[] problems = compilationResult.getAllProblems();
- int count = problems.length;
- int problemCount = 0;
- 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()));
- try {
- buffer.append(((DefaultProblem)problems[i]).errorReportSource(compilationResult.compilationUnit));
- buffer.append("\n");
- buffer.append(problems[i].getMessage());
- buffer.append("\n");
- } catch (Exception e) {
- }
- buffer.append("----------\n");
- }
- }
- problemLog += buffer.toString();
- }
- outputClassFiles(compilationResult);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
deleted file mode 100644
index 66d4841..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
+++ /dev/null
@@ -1,970 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import junit.framework.Test;
-/**
- * Name Lookup within Inner Classes
- * Creation date: (8/2/00 12:04:53 PM)
- * @author: Dennis Conway
- */
-public class LookupTest extends AbstractRegressionTest {
-public LookupTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-/**
- * Non-static member class
- */
-public void test01() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private static int value = 23; \n"+
- " class B { \n"+
- " private int value; \n"+
- " B (int val) { \n"+
- " value = (A.value * 2) + val; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String args[]) { \n"+
- " int result = new A().new B(12).value; \n"+
- " int expected = 58; \n"+
- " System.out.println( \n"+
- " result == expected \n"+
- " ? \"SUCCESS\" \n"+
- " : \"FAILED : got \"+result+\" instead of \"+ expected); \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-/**
- * Attempt to access non-static field from static inner class (illegal)
- */
-public void test02() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "class A { \n"+
- " private int value; \n"+
- " static class B { \n"+
- " B () { \n"+
- " value = 2; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " B result = new B(); \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. WARNING in p1\\A.java (at line 3)\n" +
- " private int value; \n" +
- " ^^^^^\n" +
- "The private field A.value is never read locally\n" +
- "----------\n" +
- "2. ERROR in p1\\A.java (at line 6)\n" +
- " value = 2; \n" +
- " ^^^^^\n" +
- "Cannot make a static reference to the non-static field value\n" +
- "----------\n"
- );
-}
-/**
- * Access static field from static inner class
- */
-public void test03() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private static int value; \n"+
- " static class B { \n"+
- " B () { \n"+
- " value = 2; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " B result = new B(); \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- "}",
- "SUCCESS"
- }
- );
-}
-/**
- *
- */
-public void test04() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private String value; \n"+
- " private A (String strIn) { \n"+
- " value = new B(strIn, \"E\").str; \n"+
- " } \n"+
- " class B { \n"+
- " String str; \n"+
- " private B (String strFromA, String strIn) {\n"+
- " str = strFromA + strIn + new C(\"S\").str;\n"+
- " } \n"+
- " class C { \n"+
- " String str; \n"+
- " private C (String strIn) { \n"+
- " str = strIn + new D(\"S\").str; \n"+
- " } \n"+
- " class D { \n"+
- " String str; \n"+
- " private D (String strIn) { \n"+
- " str = strIn; \n"+
- " } \n"+
- " } \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " System.out.println(new A(\"SUCC\").value); \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-/**
- *
- */
-public void test05() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private static void doSomething(String showThis) {\n"+
- " System.out.print(showThis); \n"+
- " return; \n"+
- " } \n"+
- " class B { \n"+
- " void aMethod () { \n"+
- " p1.A.doSomething(\"SUCC\"); \n"+
- " A.doSomething(\"ES\"); \n"+
- " doSomething(\"S\"); \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " B foo = new A().new B(); \n"+
- " foo.aMethod(); \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-/**
- * jdk1.2.2 reports: No variable sucess defined in nested class p1.A. B.C.
- * jdk1.3 reports: success has private access in p1.A
- */
-public void test06() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "class A { \n"+
- " private static String success = \"SUCCESS\"; \n"+
- " public interface B { \n"+
- " public abstract void aTask(); \n"+
- " class C extends A implements B { \n"+
- " public void aTask() {System.out.println(this.success);}\n"+
- " } \n"+
- " } \n"+
- " public static void main (String[] argv) { \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. WARNING in p1\\A.java (at line 3)\n" +
- " private static String success = \"SUCCESS\"; \n" +
- " ^^^^^^^\n" +
- "The private field A.success is never read locally\n" +
- "----------\n" +
- "2. ERROR in p1\\A.java (at line 7)\n" +
- " public void aTask() {System.out.println(this.success);}\n" +
- " ^^^^^^^^^^^^\n" +
- "The field success is not visible\n" +
- "----------\n"
-
- );
-}
-/**
- * No errors in jdk1.2.2, jdk1.3
- */
-public void test07() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private static String success = \"SUCCESS\"; \n"+
- " public interface B { \n"+
- " public abstract void aTask(); \n"+
- " class C extends A implements B { \n"+
- " public void aTask() {System.out.println(A.success);}\n"+
- " } \n"+
- " } \n"+
- " public static void main (String[] argv) { \n"+
- " } \n"+
- "}"
- }
- );
-}
-/**
- * jdk1.2.2 reports: Undefined variable: A.this
- * jdk1.3 reports: non-static variable this cannot be referenced from a static context
- */
-public void test08() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "class A { \n"+
- " private static String success = \"SUCCESS\"; \n"+
- " public interface B { \n"+
- " public abstract void aTask(); \n"+
- " class C extends A implements B { \n"+
- " public void aTask() {System.out.println(A.this.success);}\n"+
- " } \n"+
- " } \n"+
- " public static void main (String[] argv) { \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. ERROR in p1\\A.java (at line 7)\n" +
- " public void aTask() {System.out.println(A.this.success);}\n" +
- " ^^^^^^\n" +
- "No enclosing instance of the type A is accessible in scope\n" +
- "----------\n" +
- "2. WARNING in p1\\A.java (at line 7)\n" +
- " public void aTask() {System.out.println(A.this.success);}\n" +
- " ^^^^^^^^^^^^^^\n" +
- "The static field A.success should be accessed in a static way\n" +
- "----------\n"
- );
-}
-/**
- * jdk1.2.2 reports: No variable success defined in nested class p1.A. B.C
- * jdk1.3 reports: success has private access in p1.A
- */
-public void test09() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "class A { \n"+
- " private String success = \"SUCCESS\"; \n"+
- " public interface B { \n"+
- " public abstract void aTask(); \n"+
- " class C extends A implements B { \n"+
- " public void aTask() {System.out.println(this.success);}\n"+
- " } \n"+
- " } \n"+
- " public static void main (String[] argv) { \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. WARNING in p1\\A.java (at line 3)\n" +
- " private String success = \"SUCCESS\"; \n" +
- " ^^^^^^^\n" +
- "The private field A.success is never read locally\n" +
- "----------\n" +
- "2. ERROR in p1\\A.java (at line 7)\n" +
- " public void aTask() {System.out.println(this.success);}\n" +
- " ^^^^^^^^^^^^\n" +
- "The field success is not visible\n" +
- "----------\n"
-
- );
-}
-/**
- * jdk1.2.2 reports: Can't make a static reference to nonstatic variable success in class p1.A
- * jdk1.3 reports: non-static variable success cannot be referenced from a static context
- */
-public void test10() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "class A { \n"+
- " private String success = \"SUCCESS\"; \n"+
- " public interface B { \n"+
- " public abstract void aTask(); \n"+
- " class C extends A implements B { \n"+
- " public void aTask() {System.out.println(A.success);}\n"+
- " } \n"+
- " } \n"+
- " public static void main (String[] argv) { \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. WARNING in p1\\A.java (at line 3)\n" +
- " private String success = \"SUCCESS\"; \n" +
- " ^^^^^^^\n" +
- "The private field A.success is never read locally\n" +
- "----------\n" +
- "2. ERROR in p1\\A.java (at line 7)\n" +
- " public void aTask() {System.out.println(A.success);}\n" +
- " ^^^^^^^^^\n" +
- "Cannot make a static reference to the non-static field A.success\n" +
- "----------\n"
- );
-}
-/**
- *
- */
-public void test11() {
- this.runNegativeTest(
- new String[] {
- /* p2.Aa */
- "p2/Aa.java",
- "package p2; \n"+
- "class Aa extends p1.A{ \n"+
- " class B implements p1.A.C { \n"+
- " } \n"+
- " public static void main (String args[]) { \n"+
- " } \n"+
- "}",
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " public A() { \n"+
- " } \n"+
- " class B implements C { \n"+
- " public int sMethod() { \n"+
- " return 23; \n"+
- " } \n"+
- " } \n"+
- " public interface C { \n"+
- " public abstract int sMethod(); \n"+
- " } \n"+
- "}",
-
- },
- "----------\n" +
- "1. ERROR in p2\\Aa.java (at line 3)\n" +
- " class B implements p1.A.C { \n" +
- " ^\n" +
- "Class must implement the inherited abstract method A.C.sMethod()\n" +
- "----------\n"
- );
-}
-/**
- *
- */
-public void test12() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " public interface B { \n"+
- " public abstract void aMethod (int A); \n"+
- " public interface C { \n"+
- " public abstract void anotherMethod(); \n"+
- " } \n"+
- " } \n"+
- " public class aClass implements B, B.C { \n"+
- " public void aMethod (int A) { \n"+
- " } \n"+
- " public void anotherMethod(){} \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-/**
- *
- */
-public void test13() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " public interface B { \n"+
- " public abstract void aMethod (int A); \n"+
- " public interface C { \n"+
- " public abstract void anotherMethod(int A);\n"+
- " } \n"+
- " } \n"+
- " public class aClass implements B, B.C { \n"+
- " public void aMethod (int A) { \n"+
- " public void anotherMethod(int A) {}; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. ERROR in p1\\A.java (at line 9)\n" +
- " public class aClass implements B, B.C { \n" +
- " ^^^^^^\n" +
- "Class must implement the inherited abstract method A.B.C.anotherMethod(int)\n" +
- "----------\n" +
- "2. ERROR in p1\\A.java (at line 11)\n" +
- " public void anotherMethod(int A) {}; \n" +
- " ^\n" +
- "Syntax error on token \"(\", \";\" expected\n" +
- "----------\n"
- );
-}
-/**
- *
- */
-public void test14() {
- this.runNegativeTest(
- new String[] {
- /* pack1.First */
- "pack1/First.java",
- "package pack1; \n"+
- "public class First { \n"+
- " public static void something() {} \n"+
- " class Inner {} \n"+
- " public static void main (String argv[]) { \n"+
- " First.Inner foo = new First().new Inner(); \n"+
- " foo.something(); \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. ERROR in pack1\\First.java (at line 7)\n" +
- " foo.something(); \n" +
- " ^^^^^^^^^\n" +
- "The method something() is undefined for the type First.Inner\n" +
- "----------\n"
- );
-}
-/**
- *
- */
-public void test15() {
- this.runConformTest(
- new String[] {
- /* pack1.First */
- "pack1/First.java",
- "package pack1; \n"+
- "public class First { \n"+
- " class Inner { \n"+
- " public void something() {} \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " First.Inner foo = new First().new Inner(); \n"+
- " foo.something(); \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-/**
- *
- */
-public void test16() {
- this.runConformTest(
- new String[] {
- /* pack1.Outer */
- "pack1/Outer.java",
- "package pack1; \n"+
- "import pack2.*; \n"+
- "public class Outer { \n"+
- " int time, distance; \n"+
- " public Outer() { \n"+
- " } \n"+
- " public Outer(int d) { \n"+
- " distance = d; \n"+
- " } \n"+
- " public void aMethod() { \n"+
- " this.distance *= 2; \n"+
- " return; \n"+
- " } \n"+
- "}",
- /* pack2.OuterTwo */
- "pack2/OuterTwo.java",
- "package pack2; \n"+
- "import pack1.*; \n"+
- "public class OuterTwo extends Outer { \n"+
- " public OuterTwo(int bar) { \n"+
- " Outer A = new Outer(3) { \n"+
- " public void bMethod(){ \n"+
- " final class X { \n"+
- " int price; \n"+
- " public X(int inp) { \n"+
- " price = inp + 32; \n"+
- " } \n"+
- " } \n"+
- " } \n"+
- " }; \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " System.out.println(\"\"); \n"+
- " OuterTwo foo = new OuterTwo(12); \n"+
- " Outer bar = new Outer(8); \n"+
- " } \n"+
- "}"
- }
- );
-}
-/**
- *
- */
-public void test17() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " int value; \n"+
- " public A(B bVal) { \n"+
- " bVal.sval += \"V\"; \n"+
- " } \n"+
- " static class B { \n"+
- " public static String sval; \n"+
- " public void aMethod() { \n"+
- " sval += \"S\"; \n"+
- " A bar = new A(this); \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " B foo = new B(); \n"+
- " foo.sval = \"U\"; \n"+
- " foo.aMethod(); \n"+
- " System.out.println(foo.sval); \n"+
- " } \n"+
- "}"
- },
- "USV"
- );
-}
-/**
- * member class
- */
-public void test18() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private String rating; \n"+
- " public class B { \n"+
- " String rating; \n"+
- " public B (A sth) { \n"+
- " sth.rating = \"m\"; \n"+
- " rating = \"er\"; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " A foo = new A(); \n"+
- " foo.rating = \"o\"; \n"+
- " B bar = foo.new B(foo); \n"+
- " System.out.println(foo.rating + bar.rating);\n"+
- " } \n"+
- "}"
- },
- "mer"
- );
-}
-/**
- * member class
- */
-public void test19() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private String rating; \n"+
- " public void setRating(A sth, String setTo) { \n"+
- " sth.rating = setTo; \n"+
- " return; \n"+
- " } \n"+
- " public class B { \n"+
- " public B (A sth) { \n"+
- " setRating(sth, \"m\"); \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " A foo = new A(); \n"+
- " foo.rating = \"o\"; \n"+
- " B bar = foo.new B(foo); \n"+
- " System.out.println(foo.rating + bar.other); \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. ERROR in p1\\A.java (at line 17)\n" +
- " System.out.println(foo.rating + bar.other); \n" +
- " ^^^^^^^^^\n" +
- "bar.other cannot be resolved or is not a field\n" +
- "----------\n"
- );
-}
-/**
- * member class
- */
-public void test20() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private String rating; \n"+
- " public class B { \n"+
- " public B (A sth) { \n"+
- " sth.rating = \"m\"; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " A foo = new A(); \n"+
- " foo.rating = \"o\"; \n"+
- " B bar = foo.new B(foo); \n"+
- " System.out.println(foo.rating + bar.other); \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. WARNING in p1\\A.java (at line 6)\n" +
- " sth.rating = \"m\"; \n" +
- " ^^^^^^^^^^\n" +
- "Write access to enclosing field A.rating is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" +
- "----------\n" +
- "2. ERROR in p1\\A.java (at line 13)\n" +
- " System.out.println(foo.rating + bar.other); \n" +
- " ^^^^^^^^^\n" +
- "bar.other cannot be resolved or is not a field\n" +
- "----------\n"
- );
-}
-/**
- * member class
- */
-public void test21() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " private String rating; \n"+
- " public class B { \n"+
- " public B (A sth) { \n"+
- " sth.rating = \"m\"; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " A foo = new A(); \n"+
- " foo.rating = \"o\"; \n"+
- " B bar = foo.new B(foo); \n"+
- " System.out.println(foo.rating); \n"+
- " } \n"+
- "}"
- }
- );
-}
-/**
- *
- */
-public void test22() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "import p2.*; \n"+
- "public class A { \n"+
- " public int aValue; \n"+
- " public A() {} \n"+
- " public static class C extends A { \n"+
- " public String aString; \n"+
- " public C() { \n"+
- " } \n"+
- " } \n"+
- "}",
- /* p2.B */
- "p2/B.java",
- "package p2; \n"+
- "import p1.*; \n"+
- "public class B extends A.C { \n"+
- " public B() {} \n"+
- " public class D extends A { \n"+
- " public D() { \n"+
- " C val2 = new C(); \n"+
- " val2.aString = \"s\"; \n"+
- " A val = new A(); \n"+
- " val.aValue = 23; \n"+
- " } \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " D foo = new B().new D(); \n"+
- " } \n"+
- "}"
- }
- );
-}
-/**
- *
- */
-public void test23() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1;\n"+
- "public class A implements B { \n"+
- "} \n"+
- "interface B { \n"+
- " public class A implements B { \n"+
- " public static void main (String argv[]) { \n"+
- " class Ba { \n"+
- " int time; \n"+
- " } \n"+
- " Ba foo = new Ba(); \n"+
- " foo.time = 3; \n"+
- " } \n"+
- " interface C { \n"+
- " } \n"+
- " interface Bb extends C { \n"+
- " } \n"+
- " } \n"+
- "}"
- }
- );
-}
-/**
- *
- */
-public void test24() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " protected static String bleh; \n"+
- " interface B { \n"+
- " public String bleh(); \n"+
- " class C{ \n"+
- " public String bleh() {return \"B\";}\n"+
- " } \n"+
- " } \n"+
- " class C implements B { \n"+
- " public String bleh() {return \"A\";} \n"+
- " } \n"+
- " public static void main(String argv[]) { \n"+
- " C foo = new A().new C(); \n"+
- " } \n"+
- "}"
- }
- );
-}
-/**
- *
- */
-public void test25() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "import p2.*; \n"+
- "public class A { \n"+
- " public static class B { \n"+
- " public static int B; \n"+
- " } \n"+
- " public static void main(String argv[]) {\n"+
- " B foo = new A.B(); \n"+
- " B bar = new B(); \n"+
- " foo.B = 2; \n"+
- " p2.B bbar = new p2.B(); \n"+
- " if (bar.B == 35) { \n"+
- " System.out.println(\"SUCCESS\");\n"+
- " } \n"+
- " else { \n"+
- " System.out.println(bar.B); \n"+
- " } \n"+
- " } \n"+
- "}",
- "p2/B.java",
- "package p2; \n"+
- "import p1.*; \n"+
- "public class B extends A { \n"+
- " public B() { \n"+
- " A.B bleh = new A.B(); \n"+
- " bleh.B = 35; \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-/**
- *
- */
-public void test26() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " public static class B { \n"+
- " protected static int B; \n"+
- " } \n"+
- " public static void main(String argv[]) {\n"+
- " B foo = new A.B(); \n"+
- " B bar = new B(); \n"+
- " B.B = 2; \n"+
- " p2.B bbar = new p2.B(); \n"+
- " if (B.B == 35) { \n"+
- " System.out.println(\"SUCCESS\");\n"+
- " } \n"+
- " else { \n"+
- " System.out.println(B.B); \n"+
- " } \n"+
- " } \n"+
- "}",
- "p2/B.java",
- "package p2; \n"+
- "import p1.*; \n"+
- "public class B extends A { \n"+
- " public B() { \n"+
- " A.B bleh = new A.B(); \n"+
- " bleh.B = 35; \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. ERROR in p2\\B.java (at line 6)\n" +
- " bleh.B = 35; \n" +
- " ^^^^^^\n" +
- "The field bleh.B is not visible\n" +
- "----------\n"
- );
-}
-/**
- *
- */
-public void test27() {
- this.runNegativeTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " protected static class B { \n"+
- " public static int B; \n"+
- " } \n"+
- " public static void main(String argv[]) {\n"+
- " B foo = new A.B(); \n"+
- " B bar = new B(); \n"+
- " B.B = 2; \n"+
- " p2.B bbar = new p2.B(); \n"+
- " if (B.B == 35) { \n"+
- " System.out.println(\"SUCCESS\");\n"+
- " } \n"+
- " else { \n"+
- " System.out.println(B.B); \n"+
- " } \n"+
- " } \n"+
- "}",
- "p2/B.java",
- "package p2; \n"+
- "import p1.*; \n"+
- "public class B extends A { \n"+
- " public B() { \n"+
- " A.B bleh = new A.B(); \n"+
- " A.B.B = 35; \n"+
- " } \n"+
- "}"
- },
- "----------\n" +
- "1. ERROR in p2\\B.java (at line 5)\n" +
- " A.B bleh = new A.B(); \n" +
- " ^^^^^^^^^\n" +
- "The constructor A.B() is not visible\n" +
- "----------\n"
- );
-}
-/**
- *
- */
-public void test28() {
- this.runConformTest(
- new String[] {
- /* p1.A */
- "p1/A.java",
- "package p1; \n"+
- "public class A { \n"+
- " static class B { \n"+
- " public static class C { \n"+
- " private static int a; \n"+
- " private int b; \n"+
- " } \n"+
- " } \n"+
- " class D extends B { \n"+
- " int j = p1.A.B.C.a; \n"+
- " } \n"+
- " public static void main (String argv[]) { \n"+
- " System.out.println(\"SUCCESS\"); \n"+
- " } \n"+
- "}"
- },
- "SUCCESS"
- );
-}
-public static Class testClass() {
- return LookupTest.class;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java
deleted file mode 100644
index 0237d49..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.IProblemFactory;
-
-public class ProblemConstructorTest extends AbstractRegressionTest {
-
-public ProblemConstructorTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public static Class testClass() {
- return ProblemConstructorTest.class;
-}
-
-protected Requestor getRequestor(IProblemFactory problemFactory) {
- return new Requestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator, false) {
- public void acceptResult(CompilationResult cr) {
- super.acceptResult(cr);
- outputClassFiles(cr);
- }
-
- protected void outputClassFiles(CompilationResult unitResult) {
-
- if (unitResult != null) {
- Enumeration classFiles = unitResult.compiledTypes.elements();
- if (outputPath != null) {
- while (classFiles.hasMoreElements()) {
- // retrieve the key and the corresponding classfile
- ClassFile classFile = (ClassFile) classFiles.nextElement();
- String relativeName =
- new String(classFile.fileName()).replace('/', File.separatorChar) + ".class";
- try {
- ClassFile.writeToDisk(true, outputPath, relativeName, classFile.getBytes());
- } catch(IOException e) {
- }
- }
- }
- }
- }
- };
-}
-public void test001() {
- this.runNegativeTest(
- new String[] {
- "prs/Test1.java",
- "package prs; \n" +
- "import java.io.IOException; \n" +
- "public class Test1 { \n" +
- "String s = 3; \n" +
- "Test1() throws IOException { \n" +
- "} \n" +
- "}"
- },
- new ExpectedProblem[] {
- new ExpectedProblem("prs/Test1.java", IProblem.TypeMismatch, new String[] {"int", "String"})
- }
- );
-
- this.runNegativeTest(
- new String[] {
- "prs/Test2.java",
- "package prs; \n" +
- "import java.io.IOException; \n" +
- "public class Test2 { \n" +
- "public void foo() { \n" +
- "try { \n" +
- "Test1 t = new Test1(); \n" +
- "System.out.println(); \n" +
- "} catch(IOException e) \n" +
- "{ \n" +
- "e.printStackTrace(); \n" +
- "} \n" +
- "} \n" +
- "}"
- },
- new ExpectedProblem[] {},
- null,
- false);
-}
-
-
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java
deleted file mode 100644
index 4fbe780..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.core.tests.util.*;
-import org.eclipse.jdt.internal.compiler.batch.FileSystem;
-import java.util.Enumeration;
-
-import junit.extensions.*;
-import junit.framework.*;
-
-public class RegressionTestSetup extends TestDecorator {
- TestVerifier verifier = new TestVerifier(true);
-public RegressionTestSetup(Test test) {
- super(test);
-}
-private void initTest(Object test, TestVerifier testVerifier, INameEnvironment javaClassLib) {
- if (test instanceof AbstractRegressionTest) {
- AbstractRegressionTest regressionTest = (AbstractRegressionTest)test;
- regressionTest.verifier = testVerifier;
- regressionTest.javaClassLib = javaClassLib;
- return;
- }
- if (test instanceof TestSuite) {
- TestSuite regressionTestClassSuite = (TestSuite) test;
- Enumeration regressionTestClassTests = regressionTestClassSuite.tests();
- while (regressionTestClassTests.hasMoreElements()) {
- initTest(regressionTestClassTests.nextElement(), testVerifier, javaClassLib);
- }
- return;
- }
-
-}
-public void run(TestResult result) {
- try {
- setUp();
- super.run(result);
- } finally {
- tearDown();
- }
-}
-protected void setUp() {
- // Create name environment
- INameEnvironment javaClassLib = new FileSystem(new String[] {Util.getJavaClassLib()}, new String[0], null);
-
- // Init wrapped suite
- initTest(fTest, this.verifier, javaClassLib);
-}
-protected void tearDown() {
- this.verifier.shutDown();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java
deleted file mode 100644
index 7f5c5bd..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import junit.framework.Assert;
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
-import org.eclipse.jdt.internal.compiler.IProblemFactory;
-
-public class Requestor extends Assert implements ICompilerRequestor {
- public boolean hasErrors = false;
- public IProblemFactory problemFactory;
- public String outputPath;
- private boolean generateOutput;
- public Hashtable expectedProblems = new Hashtable();
-public Requestor(IProblemFactory problemFactory, String outputPath, boolean generateOutput) {
- this.problemFactory = problemFactory;
- this.outputPath = outputPath;
- this.generateOutput = generateOutput;
-}
- public void acceptResult(CompilationResult cr) {
- if (cr.hasProblems() || cr.hasTasks()) {
- if (cr.hasErrors()) {
- this.hasErrors = true;
- }
-
- IProblem[] actualProblems = cr.getAllProblems();
- int actualProblemsCount = actualProblems == null ? 0 : actualProblems.length;
- ExpectedProblem[] problems = (ExpectedProblem[])this.expectedProblems.get(new String(cr.getFileName()));
- int expectedProblemsCount = problems == null ? 0 : problems.length;
-
- if (actualProblemsCount > 0 || expectedProblemsCount > 0) {
- boolean areMessagesDifferent = false;
- String message = new String(cr.getFileName()) + " does not have the correct errors.\nFound :\n";
- for (int i = 0; i < actualProblemsCount; i++) {
- message += "\t" + actualProblems[i].getMessage() + "\n";
- /* START PRINT */
-/*
- System.out.print(actualProblems[i].getID()+":");
- String[] pbArgs = actualProblems[i].getArguments();
- for (int j = 0; j < pbArgs.length; j++){
- if (j > 0) System.out.print(", ");
- System.out.print(pbArgs[j]);
- }
- System.out.println();
-*/
- /* END PRINT */
- if (i < expectedProblemsCount
- && !actualProblems[i].getMessage().equals(problemFactory.getLocalizedMessage(problems[i].id, problems[i].arguments))) {
- areMessagesDifferent = true;
- System.out.print(actualProblems[i].getID()+":");
- String[] pbArgs = actualProblems[i].getArguments();
- for (int j = 0; j < pbArgs.length; j++){
- if (j > 0) System.out.print(", ");
- System.out.print(pbArgs[j]);
- }
- System.out.println();
- }
- }
- if (expectedProblemsCount == 0) {
- message += "Expecting no problems.";
- } else {
- message += "Expecting :\n";
- for (int i = 0; i < expectedProblemsCount; i++) {
- ExpectedProblem expectedProblem = problems[i];
- message += "\t" + problemFactory.getLocalizedMessage(expectedProblem.id, expectedProblem.arguments) + "\n";
- }
- }
- assertTrue(message, (actualProblemsCount == expectedProblemsCount) && !areMessagesDifferent);
- }
- }
- outputClassFiles(cr);
- }
-public void expectedProblems(ExpectedProblem[] problems) {
- for (int i = 0; i < problems.length; i++){
- ExpectedProblem problem = problems[i];
- String fileName = problem.fileName;
- if (File.separator.equals("/")) {
- if (fileName.indexOf("\\") != -1) {
- fileName = fileName.replace('\\', File.separatorChar);
- }
- } else {
- // the file separator is \
- if (fileName.indexOf('/') != -1) {
- fileName = fileName.replace('/', File.separatorChar);
- }
- }
-
- ExpectedProblem[] existingProblems = (ExpectedProblem[])this.expectedProblems.get(fileName);
- if (existingProblems == null) {
- this.expectedProblems.put(fileName, new ExpectedProblem[] {problem});
- } else {
- int length = existingProblems.length;
- ExpectedProblem[] newProblems = new ExpectedProblem[length + 1];
- System.arraycopy(existingProblems, 0, newProblems, 0, length);
- newProblems[length] = problem;
- this.expectedProblems.put(fileName, newProblems);
- }
- }
-}
-protected void outputClassFiles(CompilationResult unitResult) {
-
- if ((unitResult != null) && (!unitResult.hasErrors() || generateOutput)) {
- Enumeration classFiles = unitResult.compiledTypes.elements();
- if (outputPath != null) {
- while (classFiles.hasMoreElements()) {
- // retrieve the key and the corresponding classfile
- ClassFile classFile = (ClassFile) classFiles.nextElement();
- String relativeName =
- new String(classFile.fileName()).replace('/', File.separatorChar) + ".class";
- try {
- ClassFile.writeToDisk(true, outputPath, relativeName, classFile.getBytes());
- } catch(IOException e) {
- }
- }
- }
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
deleted file mode 100644
index 1b99473..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.ToolFactory;
-import org.eclipse.jdt.core.compiler.IScanner;
-import org.eclipse.jdt.core.compiler.ITerminalSymbols;
-import org.eclipse.jdt.core.compiler.InvalidInputException;
-public class ScannerTest extends AbstractRegressionTest {
-
- public ScannerTest(String name) {
- super(name);
- }
- public static Test suite() {
- return setupSuite(testClass());
- }
-
- public static Class testClass() {
- return ScannerTest.class;
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23181
- */
- public void test001() {
- String sourceA001 = "\\u003b";
- IScanner scanner = ToolFactory.createScanner(false, true, false, false);
- scanner.setSource(sourceA001.toCharArray());
- int token = 0;
- try {
- token = scanner.getNextToken();
- } catch (InvalidInputException e) {
- }
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameSEMICOLON, token);
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23181
- */
- public void test002() {
- String sourceA002 = "// tests\n ";
- IScanner scanner = ToolFactory.createScanner(false, true, false, false);
- scanner.setSource(sourceA002.toCharArray());
- int token = 0;
- try {
- token = scanner.getNextToken();
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameWHITESPACE, token);
- assertEquals("Wrong size", 2, scanner.getCurrentTokenSource().length);
- token = scanner.getNextToken();
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameEOF, token);
- } catch (InvalidInputException e) {
- }
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23181
- */
- public void test003() {
- String sourceA003 = "// tests\n ";
- IScanner scanner = ToolFactory.createScanner(true, true, false, false);
- scanner.setSource(sourceA003.toCharArray());
- int token = 0;
- try {
- token = scanner.getNextToken();
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameCOMMENT_LINE, token);
- token = scanner.getNextToken();
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameWHITESPACE, token);
- assertEquals("Wrong size", 2, scanner.getCurrentTokenSource().length);
- token = scanner.getNextToken();
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameEOF, token);
- } catch (InvalidInputException e) {
- }
- }
-
- /**
- * float constant can have exponent part without dot: 01e0f
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=30704
- */
- public void test004() {
- String source = "01e0f";
- IScanner scanner = ToolFactory.createScanner(false, false, false, false);
- scanner.setSource(source.toCharArray());
- int token = 0;
- try {
- token = scanner.getNextToken();
- assertEquals("Wrong token type", ITerminalSymbols.TokenNameFloatingPointLiteral, token);
- } catch (InvalidInputException e) {
- }
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
deleted file mode 100644
index f64b159..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.jdt.core.tests.junit.extension.ExcludedTestSuite;
-
-/**
- * Run all compiler regression tests
- */
-public class TestAll extends TestCase {
- public static boolean EXPERT; // an expert doesn't exclude any tests
- static String[] EXCLUDED_TESTS = new String[] {};
-public TestAll(String testName) {
- super(testName);
-}
-/**
- * Adds all the tests in the given class to the suite except
- * the ones that are excluded.
- */
-public static void addTest(TestSuite suite, Class testClass) {
- TestSuite innerSuite = new TestSuite(testClass);
- suite.addTest(innerSuite);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite(TestAll.class.getName());
-
- String specVersion = System.getProperty("java.specification.version");
- if (!"1.0".equals(specVersion) && !"1.1".equals(specVersion) && !"1.2".equals(specVersion) && !"1.3".equals(specVersion)) {
- addTest(suite, AssertionTest.class);
- }
-
- addTest(suite, BatchCompilerTest.class);
- addTest(suite, ClassFileComparatorTest.class);
- addTest(suite, ClassFileReaderTest.class);
- addTest(suite, Compliance_1_3.class);
- addTest(suite, Compliance_1_4.class);
- addTest(suite, DeprecatedTest.class);
- addTest(suite, LookupTest.class);
- addTest(suite, ProblemConstructorTest.class);
- addTest(suite, UtilTest.class);
- addTest(suite, ScannerTest.class);
-
- if (EXPERT) {
- return new RegressionTestSetup(suite);
- } else {
- return new RegressionTestSetup(new ExcludedTestSuite(suite, EXCLUDED_TESTS));
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java
deleted file mode 100644
index 114a79d..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.compiler.regression;
-
-import org.eclipse.jdt.core.compiler.CharOperation;
-import junit.framework.Test;
-
-public class UtilTest extends AbstractRegressionTest {
-public UtilTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public void test01() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("X".toCharArray(), "Xyz".toCharArray(), true));
-}
-public void test02() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("X*".toCharArray(), "Xyz".toCharArray(), true));
-}
-public void test03() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("X".toCharArray(), "X".toCharArray(), true));
-}
-public void test04() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("X*X".toCharArray(), "XYX".toCharArray(), true));
-}
-public void test05() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("XY*".toCharArray(), "XYZ".toCharArray(), true));
-}
-public void test06() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*XY*".toCharArray(), "XYZ".toCharArray(), true));
-}
-public void test07() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*".toCharArray(), "XYZ".toCharArray(), true));
-}
-public void test08() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("a*".toCharArray(), "XYZ".toCharArray(), true));
-}
-public void test09() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("abc".toCharArray(), "XYZ".toCharArray(), true));
-}
-public void test10() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("ab*c".toCharArray(), "abX".toCharArray(), true));
-}
-public void test11() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("a*b*c".toCharArray(), "aXXbYYc".toCharArray(), true));
-}
-public void test12() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("*a*bc".toCharArray(), "aXXbYYc".toCharArray(), true));
-}
-public void test13() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("*foo*bar".toCharArray(), "".toCharArray(), true));
-}
-public void test14() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*foo*bar".toCharArray(), "ffoobabar".toCharArray(), true));
-}
-public void test15() {
-
- assertTrue("Pattern matching failure",
- !CharOperation.match("*fol*bar".toCharArray(), "ffoobabar".toCharArray(), true));
-}
-public void test16() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*X*Y*".toCharArray(), "XY".toCharArray(), true));
-}
-public void test17() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*X*Y*".toCharArray(), "XYZ".toCharArray(), true));
-}
-public void test18() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("main(*)".toCharArray(), "main(java.lang.String[] argv)".toCharArray(), true));
-}
-public void test19() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*rr*".toCharArray(), "ARRAY".toCharArray(), false));
-}
-
-public void test20() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("hello*World".toCharArray(), "helloWorld".toCharArray(), true));
-}
-
-public void test21() {
- assertEquals("Trim failure", "hello", new String(CharOperation.trim("hello".toCharArray())));
-}
-public void test22() {
- assertEquals("Trim failure", "hello", new String(CharOperation.trim(" hello".toCharArray())));
-}
-public void test23() {
- assertEquals("Trim failure", "hello", new String(CharOperation.trim(" hello ".toCharArray())));
-}
-public void test24() {
- assertEquals("Trim failure", "hello", new String(CharOperation.trim("hello ".toCharArray())));
-}
-public void test25() {
- assertEquals("Trim failure", "", new String(CharOperation.trim(" ".toCharArray())));
-}
-public void test26() {
- assertEquals("Trim failure", "hello world", new String(CharOperation.trim(" hello world ".toCharArray())));
-}
-public void test27() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," hello,world".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[hello][world]", buffer.toString());
-}
-public void test28() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," hello , world".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[hello][world]", buffer.toString());
-}
-public void test29() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," hello, world ".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[hello][world]", buffer.toString());
-}
-public void test30() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," hello, world ,zork/, aaa bbb".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[hello][world][zork/][aaa bbb]", buffer.toString());
-}
-public void test31() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," , ".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[][]", buffer.toString());
-}
-public void test32() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," ".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[]", buffer.toString());
-}
-public void test33() {
- char [][] tokens = CharOperation.splitAndTrimOn(','," , hello ".toCharArray());
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++){
- buffer.append('[').append(tokens[i]).append(']');
- }
- assertEquals("SplitTrim failure", "[][hello]", buffer.toString());
-}
-
-public void test34() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("hello/*/World".toCharArray(), "hello/zzz/World".toCharArray(), true, '/'));
-}
-
-public void test35() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("hello/**/World".toCharArray(), "hello/x/y/z/World".toCharArray(), true, '/'));
-}
-
-public void test36() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("hello/**/World/**/*.java".toCharArray(), "hello/x/y/z/World/X.java".toCharArray(), true, '/'));
-}
-
-public void test37() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("**/World/**/*.java".toCharArray(), "hello/x/y/z/World/X.java".toCharArray(), true, '/'));
-}
-
-public void test38() {
-
- assertTrue("Path pattern matching failure",
- !CharOperation.pathMatch("/*.java".toCharArray(), "/hello/x/y/z/World/X.java".toCharArray(), true, '/'));
-}
-
-/*
- * From Ant pattern set examples
- */
-public void test39() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("**/CVS/*".toCharArray(), "CVS/Repository".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- CharOperation.pathMatch("**/CVS/*".toCharArray(), "org/apache/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-3",
- CharOperation.pathMatch("**/CVS/*".toCharArray(), "org/apache/jakarta/tools/ant/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-4",
- !CharOperation.pathMatch("**/CVS/*".toCharArray(), "org/apache/CVS/foo/bar/Entries".toCharArray(), true, '/'));
-}
-
-/*
- * From Ant pattern set examples
- */
-public void test40() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("org/apache/jakarta/**".toCharArray(), "org/apache/jakarta/tools/ant/docs/index.html".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- CharOperation.pathMatch("org/apache/jakarta/**".toCharArray(), "org/apache/jakarta/test.xml".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-3",
- !CharOperation.pathMatch("org/apache/jakarta/**".toCharArray(), "org/apache/xyz.java".toCharArray(), true, '/'));
-}
-
-/*
- * From Ant pattern set examples
- */
-public void test41() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("org/apache/**/CVS/*".toCharArray(), "org/apache/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- CharOperation.pathMatch("org/apache/**/CVS/*".toCharArray(), "org/apache/jakarta/tools/ant/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-3",
- !CharOperation.pathMatch("org/apache/**/CVS/*".toCharArray(), "org/apache/CVS/foo/bar/Entries".toCharArray(), true, '/'));
-}
-
-/*
- * From Ant pattern set examples
- */
-public void test42() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("**/test/**".toCharArray(), "org/apache/test/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- CharOperation.pathMatch("**/test/**".toCharArray(), "test".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-3",
- CharOperation.pathMatch("**/test/**".toCharArray(), "a/test".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-4",
- CharOperation.pathMatch("**/test/**".toCharArray(), "test/a.java".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-5",
- !CharOperation.pathMatch("**/test/**".toCharArray(), "org/apache/test.java".toCharArray(), true, '/'));
-}
-/*
- * Corner cases
- */
-public void test43() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("/test/".toCharArray(), "/test/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- CharOperation.pathMatch("/test/**".toCharArray(), "/test/CVS/Entries".toCharArray(), true, '/'));
-}
-/*
- * Corner cases
- */
-public void test44() {
-
- assertTrue("Path pattern matching failure-1",
- !CharOperation.pathMatch("test".toCharArray(), "test/CVS/Entries".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- !CharOperation.pathMatch("**/test".toCharArray(), "test/CVS/Entries".toCharArray(), true, '/'));
-}
-/*
- * Corner cases
- */
-public void test45() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("/test/test1/".toCharArray(), "/test/test1/test/test1".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- !CharOperation.pathMatch("/test/test1".toCharArray(), "/test/test1/test/test1".toCharArray(), true, '/'));
-}
-public void test46() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("hello/**/World".toCharArray(), "hello/World".toCharArray(), true, '/'));
-}
-/*
- * Regression test for 28316 Missing references to constructor
- */
-public void test47() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*x".toCharArray(), "x.X".toCharArray(), false));
-}
-public void test48() {
-
- assertTrue("Pattern matching failure",
- CharOperation.match("*a*".toCharArray(), "abcd".toCharArray(), false));
-}
-public void test49() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("**/hello".toCharArray(), "hello/hello".toCharArray(), true, '/'));
-}
-public void test50() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("**/hello/**".toCharArray(), "hello/hello".toCharArray(), true, '/'));
-}
-public void test51() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("**/hello/".toCharArray(), "hello/hello".toCharArray(), true, '/'));
-}
-public void test52() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("hello/".toCharArray(), "hello/hello".toCharArray(), true, '/'));
-}
-public void test53() {
-
- assertTrue("Path pattern matching failure",
- !CharOperation.pathMatch("/".toCharArray(), "hello/hello".toCharArray(), true, '/'));
-}
-public void test54() {
-
- assertTrue("Path pattern matching failure-1",
- CharOperation.pathMatch("x/".toCharArray(), "hello/x".toCharArray(), true, '/'));
-
- assertTrue("Path pattern matching failure-2",
- !CharOperation.pathMatch("/x/".toCharArray(), "hello/x".toCharArray(), true, '/'));
-}
-public void test56() {
-
- assertTrue("Path pattern matching failure",
- !CharOperation.pathMatch("/**".toCharArray(), "hello/hello".toCharArray(), true, '/'));
-}
-public void test57() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("/".toCharArray(), "/hello/hello".toCharArray(), true, '/'));
-}
-public void test58() {
-
- assertTrue("Path pattern matching failure",
- CharOperation.pathMatch("/**".toCharArray(), "/hello/hello".toCharArray(), true, '/'));
-}
-public void test59() {
-
- assertTrue("Path pattern matching failure",
- !CharOperation.pathMatch("**".toCharArray(), "/hello/hello".toCharArray(), true, '/'));
-}
-public void test60() {
-
- assertTrue("Path pattern matching failure-1",
- !CharOperation.pathMatch("/P/src".toCharArray(), "/P/src/X".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-2",
- !CharOperation.pathMatch("/P/**/src".toCharArray(), "/P/src/X".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-3",
- CharOperation.pathMatch("/P/src".toCharArray(), "/P/src".toCharArray(), true, '/'));
- assertTrue("Path pattern matching failure-4",
- !CharOperation.pathMatch("A.java".toCharArray(), "/P/src/A.java".toCharArray(), true, '/'));
-}
-
-public static Class testClass() {
- return UtilTest.class;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java
deleted file mode 100644
index 8c32985..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java
+++ /dev/null
@@ -1,665 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.IRequestor;
-/**
- * Test the code snippet evaluation.
- * This assumes that the EvaluationContext class and that the EvaluationResult class
- * are working correctly.
- */
-public class CodeSnippetTest extends EvaluationTest {
-/**
- * Creates a new CodeSnippetTest.
- */
-public CodeSnippetTest(String name) {
- super(name);
-}
-/**
- * Returns a requestor that expects no result.
- */
-private IRequestor getNoResultRequestor() {
- return new Requestor() {
- public void acceptResult(EvaluationResult result) {
- assertTrue("No result", false);
- }
- };
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-/**
- * Tests code snippet that throws a checked exception.
- * (Regression test for 1G0T5XK)
- */
-public void testCheckedException() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "try {",
- " throw new java.io.IOException();",
- "} finally {",
- " System.err.println(\"This is an expected exception printed by the target VM:\");",
- "}"}),
- null);
-}
-public static Class testClass() {
- return CodeSnippetTest.class;
-}
-/**
- * Tests that no errors are reported for an empty statement followed by an expression.
- * (Regression test for PR #1G1HGHE)
- */
-public void testEmptyStatement() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "class X {",
- " public int fact(int n){",
- " return fact0(n, 1);",
- " }",
- " public int fact0(int n, int acc){",
- " if (n <= 1) return acc;",
- " return fact0(n - 1, acc * n);",
- " }",
- "};",
- "new X().fact(10)"}),
- "3628800".toCharArray());
-}
-/**
- * Tests that an error is reported for an empty import.
- */
-public void testEvaluateEmptyImport() {
- try {
- char[] importName = new char[0];
- context.setImports(new char[][] {importName});
- Requestor requestor = new Requestor();
- context.evaluateImports(getEnv(), requestor, getProblemFactory());
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Problems", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
- assertEquals("Evaluation ID", importName, result.getEvaluationID());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that an error is reported for an existing package and a non existing type imports.
- */
-public void testEvaluateExistingPackageAndNonExistingTypeImports() {
- try {
- char[] importName = "non.existing.Type".toCharArray();
- context.setImports(new char[][] {"java.lang.reflect.*".toCharArray(), importName});
- Requestor requestor = new Requestor();
- context.evaluateImports(getEnv(), requestor, getProblemFactory());
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Problems", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
- assertEquals("Evaluation ID", importName, result.getEvaluationID());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that an error is reported for a non existing package and an existing type imports.
- */
-public void testEvaluateNonExistingPackageAndExistingTypeImports() {
- try {
- char[] importName = "non.existing.*".toCharArray();
- context.setImports(new char[][] {importName, "java.math.BigInteger".toCharArray()});
- Requestor requestor = new Requestor();
- context.evaluateImports(getEnv(), requestor, getProblemFactory());
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Problems", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
- assertEquals("Evaluation ID", importName, result.getEvaluationID());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that an error is reported for a non existing package import.
- */
-public void testEvaluateNonExistingPackageImport() {
- try {
- char[] importName = "non.existing.*".toCharArray();
- context.setImports(new char[][] {importName});
- Requestor requestor = new Requestor();
- context.evaluateImports(getEnv(), requestor, getProblemFactory());
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Problems", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
- assertEquals("Evaluation ID", importName, result.getEvaluationID());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that an error is reported for a non existing type import.
- */
-public void testEvaluateNonExistingTypeImport() {
- try {
- char[] importName = "non.existing.Type".toCharArray();
- context.setImports(new char[][] {importName});
- Requestor requestor = new Requestor();
- context.evaluateImports(getEnv(), requestor, getProblemFactory());
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Problems", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
- assertEquals("Evaluation ID", importName, result.getEvaluationID());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that no errors are reported for valid package and type imports.
- */
-public void testEvaluateValidPackageAndTypeImports() {
- try {
- context.setImports(new char[][] {"java.util.Enumeration".toCharArray(), "java.lang.reflect.*".toCharArray()});
- context.evaluateImports(getEnv(), getNoResultRequestor(), getProblemFactory());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that no errors are reported for a valid package import.
- */
-public void testEvaluateValidPackageImport() {
- try {
- context.setImports(new char[][] {"java.io.*".toCharArray()});
- context.evaluateImports(getEnv(), getNoResultRequestor(), getProblemFactory());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests that no errors are reported for a valid type import.
- */
-public void testEvaluateValidTypeImport() {
- try {
- context.setImports(new char[][] {"java.math.BigInteger".toCharArray()});
- context.evaluateImports(getEnv(), getNoResultRequestor(), getProblemFactory());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests code snippet that include a finally block triggered by an error.
- */
-public void testFinallyError() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "try {",
- " throw new Error();",
- "} finally {",
- " System.err.println(\"This is an expected error printed by the target VM:\");",
- "}"}),
- null);
-}
-/**
- * Tests code snippet that include one finally block.
- */
-public void testFinallyOneBlock() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "try {",
- " return 1;",
- "} finally {",
- " return 2;",
- "}"}),
- "2".toCharArray());
-}
-/**
- * Tests code snippet that include 2 finally blocks.
- */
-public void testFinallyTwoBlock() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "try {",
- " try {",
- " return 1;",
- " } finally {",
- " return 2;",
- " }",
- "} finally {",
- " return 3;",
- "}"}),
- "3".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for an anonymous inner class.
- */
-public void testFreeReturnAnonymous() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "new Object() {",
- " public String toString() {",
- " return \"an object\";",
- " }",
- "}"}),
- "an object".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for a class declaration followed by an expression.
- */
-public void testFreeReturnClassDeclaration() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "class Point {",
- " int x;",
- " int y;",
- " Point(int x, int y) {",
- " this.x = x;",
- " this.y = y;",
- " }",
- "}",
- "new Point(56, 99).x"}),
- "56".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for an expression.
- */
-public void testFreeReturnExpression() {
- evaluateWithExpectedDisplayString("(1 + 2) * 3.0 / 4".toCharArray(), "2.25".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for an integer.
- */
-public void testFreeReturnInteger() {
- evaluateWithExpectedDisplayString("1".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for a local variable declaration followed by an expression.
- */
-public void testFreeReturnLocalVar() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "int i = 99;",
- "i + 4"}),
- "103".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for a statement followed by an expression.
- */
-public void testFreeReturnStatement() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "int i = 2;",
- "for (int j=0;j<10;j++) {",
- " i++;",
- "}",
- "i"}),
- "12".toCharArray());
-}
-/**
- * Tests code snippet that include a package import.
- */
-public void testImportPackage() {
- try {
- context.setImports(new char[][] {"java.io.*".toCharArray()});
- evaluateWithExpectedDisplayString("return new File(\"!@#%\").exists();".toCharArray(), "false".toCharArray());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests code snippet that include a type import.
- */
-public void testImportType() {
- try {
- context.setImports(new char[][] {"java.math.BigInteger".toCharArray()});
- evaluateWithExpectedDisplayString("return new BigInteger(\"123456789012345678901234567890\");".toCharArray(), "123456789012345678901234567890".toCharArray());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests code snippet that include a type import and a package import.
- */
-public void testImportTypeAndPackage() {
- try {
- context.setImports(new char[][] {"java.util.Enumeration".toCharArray(), "java.lang.reflect.*".toCharArray()});
- evaluateWithExpectedDisplayString("Field[] fields = Enumeration.class.getDeclaredFields(); return fields.length;".toCharArray(), "0".toCharArray());
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests code snippet that include an anonymous inner class.
- */
-public void testInnerClassAnonymous() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "return new Object() {",
- " public String toString() {",
- " return \"an inner class\";",
- " }",
- "};"}),
- "an inner class".toCharArray());
-}
-/**
- * Tests code snippet that include a named inner class.
- */
-public void testInnerClassNamed() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "class X {",
- " int foo = 1;",
- "}",
- "return new X().foo;"}),
- "1".toCharArray());
-}
-/**
- * Tests code snippet that include a package declaration.
- */
-public void testPackage() {
- // TBD: Test access to package private member
- // TBD: Test access to package class and members in anoother package than a java.* package
- try {
- // declare that the code snippet is run in java.util.zip and access a package private class
- context.setPackageName("java.util.zip".toCharArray());
- evaluateWithExpectedDisplayString("return ZipConstants.LOCSIG;".toCharArray(), "67324752".toCharArray());
- } finally {
- // clean up
- context.setPackageName(new char[0]);
- }
-}
-/**
- * Tests the return value display strings for a boolean.
- */
-public void testReturnDisplayStringBoolean() {
- evaluateWithExpectedDisplayString("return true;".toCharArray(), "true".toCharArray());
-}
-/**
- * Tests the return value display strings for a character.
- */
-public void testReturnDisplayStringCharacter() {
- evaluateWithExpectedDisplayString("return 'c';".toCharArray(), "c".toCharArray());
-}
-/**
- * Tests the return value display strings for a double.
- */
-public void testReturnDisplayStringDouble() {
- evaluateWithExpectedDisplayString("return 1.0;".toCharArray(), "1.0".toCharArray());
-}
-/**
- * Tests the return value display strings for no explicit returned value
- * because of an empty code snippet.
- */
-public void testReturnDisplayStringEmptyCodeSnippet() {
- evaluateWithExpectedDisplayString(new char[0], null);
-}
-/**
- * Tests the return value display strings for a float.
- */
-public void testReturnDisplayStringFloat() {
- evaluateWithExpectedDisplayString("return (float)1.0;".toCharArray(), "1.0".toCharArray());
-}
-/**
- * Tests the return value display strings for an integer.
- */
-public void testReturnDisplayStringInteger() {
- evaluateWithExpectedDisplayString("return 1;".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the return value display strings for a long.
- */
-public void testReturnDisplayStringLong() {
- evaluateWithExpectedDisplayString("return (long)1;".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the return value display strings for a code snippet
- * with no explicit returned value (implicitly the last expression is
- * wrapped inside a return statement).
- */
-public void testReturnDisplayStringNoExplicitReturnedValue() {
- evaluateWithExpectedDisplayString("new String(\"hello\".toCharArray());".toCharArray(), "hello".toCharArray());
-}
-/**
- * Tests the return value display strings for an object.
- */
-public void testReturnDisplayStringObject() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "return new Object() {",
- " public String toString() {",
- " return \"an object\";",
- " }",
- "};"}),
- "an object".toCharArray());
-}
-/**
- * Tests the return value display strings for a short.
- */
-public void testReturnDisplayStringShort() {
- evaluateWithExpectedDisplayString("return (short)1;".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the return value display strings for a String.
- */
-public void testReturnDisplayStringString() {
- evaluateWithExpectedDisplayString("return \"hello\";".toCharArray(), "hello".toCharArray());
-}
-/**
- * Tests the return value display strings for a code snippet
- * with a void returned value.
- */
-public void testReturnDisplayStringVoid() {
- evaluateWithExpectedDisplayString("new Thread().start()".toCharArray(), null);
-}
-/**
- * Tests the return type for a boolean.
- */
-public void testReturnTypeBoolean() {
- evaluateWithExpectedType("return true;".toCharArray(), "boolean".toCharArray());
-}
-/**
- * Tests the return type for a boolean array.
- */
-public void testReturnTypeBooleanArray() {
- evaluateWithExpectedType("return new boolean[] {true};".toCharArray(), "[Z".toCharArray());
-}
-/**
- * Tests the return type for a Boolean object.
- */
-public void testReturnTypeBooleanObject() {
- evaluateWithExpectedType("return new Boolean(true);".toCharArray(), "java.lang.Boolean".toCharArray());
-}
-/**
- * Tests the return type for a char.
- */
-public void testReturnTypeChar() {
- evaluateWithExpectedType("return 'c';".toCharArray(), "char".toCharArray());
-}
-/**
- * Tests the return type for a Character object.
- */
-public void testReturnTypeCharacterObject() {
- evaluateWithExpectedType("return new Character('c');".toCharArray(), "java.lang.Character".toCharArray());
-}
-/**
- * Tests the return type for a char array.
- */
-public void testReturnTypeCharArray() {
- evaluateWithExpectedType("return new char[] {'c'};".toCharArray(), "[C".toCharArray());
-}
-/**
- * Tests the return type for a double.
- */
-public void testReturnTypeDouble() {
- evaluateWithExpectedType("return 1.0;".toCharArray(), "double".toCharArray());
-}
-/**
- * Tests the return type for a double array.
- */
-public void testReturnTypeDoubleArray() {
- evaluateWithExpectedType("return new double[] {1.0};".toCharArray(), "[D".toCharArray());
-}
-/**
- * Tests the return type for a Double object.
- */
-public void testReturnTypeDoubleObject() {
- evaluateWithExpectedType("return new Double(1.0);".toCharArray(), "java.lang.Double".toCharArray());
-}
-/**
- * Tests the return type for an empty code snippet.
- */
-public void testReturnTypeEmptyCodeSnippet() {
- evaluateWithExpectedType(new char[0], null);
-}
-/**
- * Tests the return type for a float.
- */
-public void testReturnTypeFloat() {
- evaluateWithExpectedType("return (float)1.0;".toCharArray(), "float".toCharArray());
-}
-/**
- * Tests the return type for a float array.
- */
-public void testReturnTypeFloatArray() {
- evaluateWithExpectedType("return new float[] {(float)1.0};".toCharArray(), "[F".toCharArray());
-}
-/**
- * Tests the return type for a Float object.
- */
-public void testReturnTypeFloatObject() {
- evaluateWithExpectedType("return new Float(1.0);".toCharArray(), "java.lang.Float".toCharArray());
-}
-/**
- * Tests the return type for an int.
- */
-public void testReturnTypeInt() {
- evaluateWithExpectedType("return 1;".toCharArray(), "int".toCharArray());
-}
-/**
- * Tests the return type for an Integer object.
- */
-public void testReturnTypeIntegerObject() {
- evaluateWithExpectedType("return new Integer(1);".toCharArray(), "java.lang.Integer".toCharArray());
-}
-/**
- * Tests the return type for a long.
- */
-public void testReturnTypeLong() {
- evaluateWithExpectedType("return (long)1;".toCharArray(), "long".toCharArray());
-}
-/**
- * Tests the return type for a long array.
- */
-public void testReturnTypeLongArray() {
- evaluateWithExpectedType("return new long[] {(long)1};".toCharArray(), "[J".toCharArray());
-}
-/**
- * Tests the return type for a Long object.
- */
-public void testReturnTypeLongObject() {
- evaluateWithExpectedType("return new Long(1);".toCharArray(), "java.lang.Long".toCharArray());
-}
-/**
- * Tests the return type for no explicit returned value.
- */
-public void testReturnTypeNoExplicitReturnedValue() {
- evaluateWithExpectedType("new Object();".toCharArray(), "java.lang.Object".toCharArray());
-}
-/**
- * Tests the return type for an Object.
- */
-public void testReturnTypeObject() {
- evaluateWithExpectedType("return new Object();".toCharArray(), "java.lang.Object".toCharArray());
-}
-/**
- * Tests the return type for an Object array.
- */
-public void testReturnTypeObjectArray() {
- evaluateWithExpectedType("return new Object[] {new Object()};".toCharArray(), "[Ljava.lang.Object;".toCharArray());
-}
-/**
- * Tests the return type for a short.
- */
-public void testReturnTypeShort() {
- evaluateWithExpectedType("return (short)1;".toCharArray(), "short".toCharArray());
-}
-/**
- * Tests the return type for a short array.
- */
-public void testReturnTypeShortArray() {
- evaluateWithExpectedType("return new short[] {(short)1};".toCharArray(), "[S".toCharArray());
-}
-/**
- * Tests the return type for a Short object.
- */
-public void testReturnTypeShortObject() {
- evaluateWithExpectedType("return new Short((short)1);".toCharArray(), "java.lang.Short".toCharArray());
-}
-/**
- * Tests the return type for an int array.
- */
-public void testReturnTypesIntArray() {
- evaluateWithExpectedType("return new int[] {1};".toCharArray(), "[I".toCharArray());
-}
-/**
- * Tests the return type for a String.
- */
-public void testReturnTypeString() {
- evaluateWithExpectedType("return \"hello\";".toCharArray(), "java.lang.String".toCharArray());
-}
-/**
- * Tests the return type for a String array.
- */
-public void testReturnTypeStringArray() {
- evaluateWithExpectedType("return new String[] {\"hello\"};".toCharArray(), "[Ljava.lang.String;".toCharArray());
-}
-/**
- * Tests the return type for a void value.
- */
-public void testReturnTypeVoid() {
- evaluateWithExpectedType("new Thread().start()".toCharArray(), null);
-}
-/**
- * Tests that the run() method defined in an anonymous class doesn't interfer with the
- * code snippet support (see PR #1G1C0HR).
- */
-public void testRunMethodInAnonymous() {
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "class X {",
- " public int i = 0;",
- " public boolean finished = false;",
- "}",
- "final X x = new X();",
- "(new Thread() {",
- " public void run() {",
- " for (int i=0;i<10;i++) {",
- " try {",
- " Thread.currentThread().sleep(10);",
- " } catch (InterruptedException e) {",
- " }",
- " x.i++;",
- " }",
- " x.finished = true;",
- " }",
- "}).start();",
- "while (!x.finished) Thread.currentThread().sleep(100);",
- "x.i"}),
- "10".toCharArray());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java
deleted file mode 100644
index 820351d..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestSuite;
-
-
-import org.eclipse.jdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.jdt.core.tests.runtime.TargetException;
-import org.eclipse.jdt.core.tests.runtime.TargetInterface;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.batch.FileSystem;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.eval.EvaluationContext;
-
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.VirtualMachineManager;
-import com.sun.jdi.connect.AttachingConnector;
-import com.sun.jdi.connect.Connector;
-import com.sun.jdi.connect.IllegalConnectorArgumentsException;
-
-public class DebugEvaluationSetup extends EvaluationSetup {
-public DebugEvaluationSetup(junit.framework.Test test) {
- super(test);
-}
-protected void initTest(Object test, VirtualMachine jdiVM) {
- if (test instanceof DebugEvaluationTest) {
- DebugEvaluationTest evalTest = (DebugEvaluationTest)test;
- evalTest.jdiVM = jdiVM;
- return;
- }
- if (test instanceof TestSuite) {
- TestSuite evaluationTestClassSuite = (TestSuite) test;
- Enumeration evaluationTestClassTests = evaluationTestClassSuite.tests();
- while (evaluationTestClassTests.hasMoreElements()) {
- initTest(evaluationTestClassTests.nextElement(), jdiVM);
- }
- return;
- }
-
-}
-protected void setUp() {
- // Launch VM in evaluation mode
- int debugPort = Util.nextAvailablePortNumber();
- int evalPort = Util.nextAvailablePortNumber();
- LocalVMLauncher launcher;
- try {
- launcher = LocalVMLauncher.getLauncher();
- launcher.setVMArguments(new String[] {"-verify"});
- launcher.setVMPath(this.jrePath);
- launcher.setEvalPort(evalPort);
- launcher.setEvalTargetPath(this.evalDirectory);
- launcher.setDebugPort(debugPort);
- this.launchedVM = launcher.launch();
- } catch (TargetException e) {
- throw new Error(e.getMessage());
- }
-
- // Thread that read the stout of the VM so that the VM doesn't block
- try {
- startReader("VM's stdout reader", this.launchedVM.getInputStream(), System.out);
- } catch (TargetException e) {
- }
-
- // Thread that read the sterr of the VM so that the VM doesn't block
- try {
- startReader("VM's sterr reader", this.launchedVM.getErrorStream(), System.err);
- } catch (TargetException e) {
- }
-
- // Start JDI connection (try 10 times)
- VirtualMachine vm = null;
- for (int i = 0; i < 10; i++) {
- try {
- VirtualMachineManager manager = org.eclipse.jdi.Bootstrap.virtualMachineManager();
- List connectors = manager.attachingConnectors();
- if (connectors.size() == 0)
- break;
- AttachingConnector connector = (AttachingConnector)connectors.get(0);
- Map args = connector.defaultArguments();
- ((Connector.Argument)args.get("port")).setValue(String.valueOf(debugPort));
- ((Connector.Argument)args.get("hostname")).setValue(launcher.getTargetAddress());
- vm = connector.attach(args);
-
- // workaround pb with some VMs
- vm.resume();
-
- break;
- } catch (IllegalConnectorArgumentsException e) {
- } catch (IOException e) {
- System.out.println("Got exception: " + e.getMessage());
- try {
- System.out.println("Could not contact the VM at " + launcher.getTargetAddress() + ":" + debugPort + ". Retrying...");
- Thread.sleep(100);
- } catch (InterruptedException e2) {
- }
- }
- }
- if (vm == null) {
- if (this.launchedVM != null) {
- // If the VM is not running, output error stream
- try {
- if (!this.launchedVM.isRunning()) {
- InputStream in = this.launchedVM.getErrorStream();
- int read;
- do {
- read= in.read();
- if (read != -1)
- System.out.print((char) read);
- } while (read != -1);
- }
- } catch (TargetException e) {
- } catch (IOException e) {
- }
-
- // Shut it down
- try {
- if (this.target != null) {
- this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed.
- }
- int retry = 0;
- while (launchedVM.isRunning() && (++retry < 20)) {
- try {
- Thread.sleep(retry * 100);
- } catch (InterruptedException e) {
- }
- }
- if (launchedVM.isRunning()) {
- launchedVM.shutDown();
- }
- } catch (TargetException e) {
- }
- }
- throw new Error("Could not contact the VM");
- }
-
- // Create context
- this.context = new EvaluationContext();
-
- // Create target
- this.target = new TargetInterface();
- this.target.connect("localhost", evalPort, 10000);
-
- // Create name environment
- INameEnvironment env = new FileSystem(new String[] {Util.getJavaClassLib()}, new String[0], null);
-
- // Init wrapped suite
- initTest(fTest, this.context, this.target, this.launchedVM, env);
- initTest(fTest, vm);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java
deleted file mode 100644
index f129678..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java
+++ /dev/null
@@ -1,3772 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.jdt.core.tests.runtime.TargetInterface;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.InstallException;
-
-import com.sun.jdi.VirtualMachine;
-
-public class DebugEvaluationTest extends EvaluationTest {
- VirtualMachine jdiVM;
- public JDIStackFrame jdiStackFrame;
- class DebugRequestor extends Requestor {
- public boolean acceptClassFiles(org.eclipse.jdt.internal.compiler.ClassFile[] classFiles, char[] codeSnippetClassName) {
- if (jdiStackFrame == null) {
- return super.acceptClassFiles(classFiles, codeSnippetClassName);
- } else {
- // Send but don't run
- super.acceptClassFiles(classFiles, null);
-
- // Run if needed
- if (codeSnippetClassName != null) {
- boolean success = jdiStackFrame.run(new String(codeSnippetClassName));
- if (success) {
- TargetInterface.Result result = target.getResult();
- if (result.displayString == null) {
- this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, null, null));
- } else {
- this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, result.displayString, result.typeName));
- }
- }
- return success;
- } else {
- return true;
- }
- }
- }
- }
-public DebugEvaluationTest(String name) {
- super(name);
-}
-public void compileAndDeploy(String source, String className) {
- resetEnv(); // needed to reinitialize the caches
- File directory = new File(SOURCE_DIRECTORY);
- if (!directory.exists()) {
- if (!directory.mkdir()) {
- System.out.println("Could not create " + SOURCE_DIRECTORY);
- return;
- }
- }
- String fileName = SOURCE_DIRECTORY + File.separator + className + ".java";
- try {
- BufferedWriter writer = new BufferedWriter(new FileWriter(fileName));
- writer.write(source);
- writer.flush();
- writer.close();
- } catch(IOException e) {
- e.printStackTrace();
- return;
- }
- StringBuffer buffer = new StringBuffer();
- buffer
- .append("\"")
- .append(fileName)
- .append("\" -d \"")
- .append(EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY)
- .append("\" -nowarn -g -classpath \"")
- .append(Util.getJavaClassLib())
- .append(";")
- .append(SOURCE_DIRECTORY)
- .append("\"");
- org.eclipse.jdt.internal.compiler.batch.Main.compile(buffer.toString());
-}
-/**
- * Generate local variable attribute for these tests.
- */
-public Map getOptions() {
- Map options = super.getOptions();
- options.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
- options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
- return options;
-}
-public void removeTempClass(String className) {
- resetEnv(); // needed to reinitialize the caches
- File sourceFile = new File(SOURCE_DIRECTORY + File.separator + className + ".java");
- sourceFile.delete();
-
- File binaryFile = new File(EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY + File.separator + className + ".class");
-
- binaryFile.delete();
-}
-public static Test setupSuite(Class clazz) {
- EvaluationSetup evalSetup = new DebugEvaluationSetup(suite(clazz));
- evalSetup.jrePath = JRE_PATH;
- evalSetup.evalDirectory = EVAL_DIRECTORY;
- return evalSetup;
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-/*public static Test suite(Class evaluationTestClass) {
- TestSuite suite = new TestSuite();
- suite.addTest(new DebugEvaluationTest("test023"));
- return suite;
-}*/
-/**
- * Sanity test of IEvaluationContext.evaluate(char[], char[][], char[][], int[], char[], boolean, boolean, IRunner, INameEnvironment, ConfigurableOption[], IRequestor , IProblemFactory)
- */
-public void test001() {
- String userCode =
- "";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return 1;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
-}
-/**
- * Return 'this'.
- */
-public void test002() {
- try {
- String sourceA002 =
- "public class A002 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA002, "A002");
- String userCode =
- "new A002().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A002",
- "foo",
- -1);
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return this;".toCharArray();
- try {
- context.evaluate(
- snippet,
- null, // local var type names
- null, // local var names
- null, // local modifiers
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "hello".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "A002".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A002");
- }
-}
-/**
- * Return 'this'.
- */
-public void test003() {
- try {
- String sourceA003 =
- "public class A003 {\n" +
- " public int foo() {\n" +
- " return 2;\n" +
- " }\n" +
- " public String toString() {\n" +
- " return \"hello\";\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA003, "A003");
- String userCode =
- "new A003().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A003",
- "foo",
- -1);
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return this;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- null, // declaring type -- NO DELEGATE THIS
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should have a problem", result.hasProblems()); // 'this' cannot be referenced since there is no declaring type
- assertTrue("Result should not have a value", !result.hasValue());
- } finally {
- removeTempClass("A003");
- }
-}
-/**
- * Return 'thread'.
- */
-public void test004() {
- String userCode =
- "java.lang.Thread thread = new Thread() {\n" +
- " public String toString() {\n" +
- " return \"my thread\";\n" +
- " }\n" +
- "};";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return thread;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "my thread".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.lang.Thread".toCharArray(), result.getValueTypeName());
-}
-/**
- * Return 'x'.
- */
-public void test005() {
- try {
- String sourceA005 =
- "public class A005 {\n" +
- " public int x = 0;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA005, "A005");
- String userCode =
- "new A005().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A005",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return x;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "0".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A005");
- }
-}
-/**
- * Return 'x' + new Object(){ int foo(){ return 17; }}.foo();
- */
-public void test006() {
- try {
- String sourceA006 =
- "public class A006 {\n" +
- " public int x = 0;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA006, "A006");
- String userCode =
- "new A006().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A006",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return x + new Object(){ int foo(){ return 17; }}.foo();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "17".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A006");
- }
-}
-/**
- * Return a static field.
- */
-public void test007() {
- try {
- String sourceA007 =
- "public class A007 {\n" +
- " public static int X = 1;\n" +
- " public int foo() {\n" +
- " X++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return X;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA007, "A007");
- String userCode =
- "new A007().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A007",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return X;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A007");
- }
-}
-/**
- * Return x + new Object(){ int foo(int x){ return x; }}.foo(14);
- */
-public void test008() {
- try {
- String sourceA008 =
- "public class A008 {\n" +
- " public int x = 0;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA008, "A008");
- String userCode =
- "new A008().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A008",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return x + new Object(){ int foo(int x){ return x; }}.foo(14);".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "14".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A008");
- }
-}
-/**
- * Free return of local variable 's'.
- */
-public void test009() {
- String userCode =
- "String s = \"test009\";\n";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "s".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "test009".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.lang.String".toCharArray(), result.getValueTypeName());
-}
-/**
- * Return 'this'.
- */
-public void test010() {
- try {
- String sourceA010 =
- "public class A010 {\n" +
- " public int foo() {\n" +
- " new Object().toString();\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return -1;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA010, "A010");
- String userCode =
- "A010 a = new A010() {\n" +
- " public String toString() {\n" +
- " return \"my object\";\n" +
- " }\n" +
- "};\n" +
- "a.foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A010",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return this;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "my object".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "A010".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A010");
- }
-}
-/**
- * Return local variable 'v'.
- */
-public void test011() {
- String userCode =
- "String s = \"s\";\n" +
- "java.util.Vector v = new java.util.Vector();\n" +
- "v.addElement(s);\n";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return v;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "[s]".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.util.Vector".toCharArray(), result.getValueTypeName());
-}
-/**
- * Set local variable 'date'.
- */
-public void test012() {
- String userCode =
- "java.util.GregorianCalendar cal = new java.util.GregorianCalendar();\n" +
- "java.util.Date date = cal.getGregorianChange();\n" +
- "date.toString();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "date = new java.util.Date();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- requestor = new DebugRequestor();
- snippet = "return date.after(cal.getGregorianChange());".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "true".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "boolean".toCharArray(), result.getValueTypeName());
-}
-/**
- * Set local variable 'i'.
- */
-/* Disabling since this test is sometimes failing for unknown reasons
- * (suspecting a problem in the JDI or JDWP implementation)
-public void test013() {
- String userCode = "int i = 0;";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "i = -1;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- requestor = new DebugRequestor();
- snippet = "return i != 0;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "true".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "boolean".toCharArray(), result.getValueTypeName());
-}
-*/
-/**
- * Set local variable 'i'.
- */
-/* Disabling since this test is sometimes failing for unknown reasons
- * (suspecting a problem in the JDI or JDWP implementation)
-public void test014() {
- String userCode = "int i = 0;";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "i++;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- requestor = new DebugRequestor();
- snippet = "return i!= 0;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "true".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "boolean".toCharArray(), result.getValueTypeName());
-}
-*/
-/**
- * Check java.lang.System.out != null
- */
-/* Disabling since this test is sometimes failing for unknown reasons
- * (suspecting a problem in the JDI or JDWP implementation)
-public void test015() {
- String userCode = "int i = 0;";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "java.lang.System.setOut(new java.io.PrintStream(new java.io.OutputStream()));".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
-
- requestor = new DebugRequestor();
- snippet = "return java.lang.System.out != null;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "true".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "boolean".toCharArray(), result.getValueTypeName());
-}
-*/
-/**
- * Check java.lang.System.out == null
- */
-public void test016() {
- String userCode = "";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "java.lang.System.setOut(null);".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- requestor = new DebugRequestor();
- snippet = "return java.lang.System.out == null;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "true".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "boolean".toCharArray(), result.getValueTypeName());
-}
-/**
- * Check the third prime number is 5
- */
-public void test017() {
- String userCode = "";
-
- JDIStackFrame stackFrame = new JDIStackFrame(this.jdiVM, this, userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("class Eratosthenes {\n"
- + " int[] primeNumbers;\n"
- + "\n"
- + " public Eratosthenes(int n) {\n"
- + " primeNumbers = new int[n + 1];\n"
- + "\n"
- + " for (int i = 2; i <= n; i++) {\n"
- + " primeNumbers[i] = i;\n"
- + " }\n"
- + " int p = 2;\n"
- + " while (p * p <= n) {\n"
- + " int j = 2 * p;\n"
- + " while (j <= n) {\n"
- + " primeNumbers[j] = 0;\n"
- + " j += p;\n"
- + " }\n"
- + " do {\n"
- + " p++;\n"
- + " } while (primeNumbers[p] == 1);\n"
- + " }\n"
- + " }\n"
- + "}\n"
- + "int[] primes = new Eratosthenes(10).primeNumbers;\n"
- + "int i = 0;\n"
- + "int max = primes.length;\n"
- + "int j = 0;\n"
- + "for (; i < max && j != 3; i++) {\n"
- + " if (primes[i] != 0) {\n"
- + " j++;\n"
- + " }\n"
- + "}\n"
- + "return primes[i-1];").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "5".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
-}
-/**
- * changing the value of a public field
- */
-public void test018() {
- try {
- String sourceA018 =
- "public class A018 {\n" +
- " public int x = 1;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA018, "A018");
- String userCode =
- "new A018().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A018",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "x = 5;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- requestor = new DebugRequestor();
- snippet = "return x;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "5".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A018");
- }
-}
-/**
- * Access to super reference
- */
-public void test019() {
-/* try {
- String sourceA019 =
- "public class A019 {\n" +
- " public int x = 1;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA019, "A019");
- String userCode =
- "new A019().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A019",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return super.clone().equals(this);".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Should get one result but got " + requestor.resultIndex+1, requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "true".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "boolean".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A019");
- }
-*/
-}
-/**
- * Implicit message expression
- */
-public void test020() {
- try {
- String sourceA =
- "public class A {\n"
- + "\tObject o = null;\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic Object bar2() {\n"
- + "\t\treturn new Object();\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA, "A");
-
- String userCode = "new A().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return foo();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A");
- }
-}
-/**
- * Implicit message expression
- */
-public void test021() {
- try {
- String sourceA21 =
- "public class A21 {\n"
- + "\tObject o = null;\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic Object bar2() {\n"
- + "\t\treturn \"toto\";\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA21, "A21");
-
- String userCode = "new A21().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A21",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "o = bar2();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- requestor = new DebugRequestor();
- snippet = "return o;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "toto".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.lang.Object".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A21");
- }
-}
-/**
- * Qualified Name Reference: b.s
- */
-public void test022() {
- try {
- String sourceB22 =
- "public class B22 {\n"
- + "\tpublic String s = null;\n"
- + "}";
- compileAndDeploy(sourceB22, "B22");
-
- String sourceA22 =
- "public class A22 {\n"
- + "\tpublic B22 b = new B22();\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic Object bar2() {\n"
- + "\t\treturn \"toto\";\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA22, "A22");
-
- String userCode = "new A22().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A22",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "b.s = \"toto\"".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
-
- requestor = new DebugRequestor();
- snippet = "return b.s;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "toto".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.lang.String".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("B22");
- removeTempClass("A22");
- }
-}
-/**
- * Qualified Name Reference: b.c.c
- */
-public void test023() {
- try {
- String sourceC23 =
- "public class C23 {\n"
- + "\tpublic String c = null;\n"
- + "}";
- compileAndDeploy(sourceC23, "C23");
-
-
- String sourceB23 =
- "public class B23 {\n"
- + "\tpublic C23 c = new C23();\n"
- + "}";
- compileAndDeploy(sourceB23, "B23");
-
- String sourceA23 =
- "public class A23 {\n"
- + "\tpublic B23 b = new B23();\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic Object bar2() {\n"
- + "\t\treturn \"toto\";\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA23, "A23");
-
- String userCode = "new A23().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A23",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "b.c.c = \"toto\"".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
-
- requestor = new DebugRequestor();
- snippet = "return b.c.c;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "toto".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.lang.String".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("C23");
- removeTempClass("B23");
- removeTempClass("A23");
- }
-}
-/**
- * Array Reference
- */
-public void test024() {
- try {
- String sourceC24 =
- "public class C24 {\n"
- + "\tpublic int[] tab = {1,2,3,4,5};\n"
- + "}";
- compileAndDeploy(sourceC24, "C24");
-
-
- String sourceB24 =
- "public class B24 {\n"
- + "\tpublic C24 c = new C24();\n"
- + "}";
- compileAndDeploy(sourceB24, "B24");
-
- String sourceA24 =
- "public class A24 {\n"
- + "\tpublic B24 b = new B24();\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic Object bar2() {\n"
- + "\t\treturn \"toto\";\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA24, "A24");
-
- String userCode = "new A24().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A24",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "b.c.tab[3] = 8".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
-
- requestor = new DebugRequestor();
- snippet = "return b.c.tab[3];".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "8".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("C24");
- removeTempClass("B24");
- removeTempClass("A24");
- }
-}
-/**
- * Array Reference
- */
-public void test025() {
- try {
- String sourceA25 =
- "public class A25 {\n"
- + "\tpublic String[] tabString = new String[2];\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic Object bar2() {\n"
- + "\t\treturn \"toto\";\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA25, "A25");
-
- String userCode = "new A25().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A25",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "tabString[1] = \"toto\"".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
-
- requestor = new DebugRequestor();
- snippet = "return tabString[1];".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "toto".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "java.lang.String".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A25");
- }
-}
-/**
- * Array Reference
- */
-public void test026() {
- try {
- String sourceA26 =
- "public class A26 {\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA26, "A26");
-
- String userCode = "new A26().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A26",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("int[] tab = new int[1];\n"
- + "tab[0] = foo();\n"
- + "tab[0]").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A26");
- }
-}
-/**
- * Array Reference
- */
-public void test027() {
- try {
- String sourceA27 =
- "public class A27 {\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic int bar2(int i) {\n"
- + "\t\tif (i == 2) {\n"
- + "\t\t\treturn 3;\n"
- + "\t\t} else {\n"
- + "\t\t\treturn 4;\n"
- + "\t\t}\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA27, "A27");
-
- String userCode = "new A27().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A27",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("int[] tab = new int[] { 1, 2, 3, 4, 5};\n"
- + "switch(foo()) {\n"
- + "case 1 : return -1;\n"
- + "case 2 : return tab[bar2(foo())];\n"
- + "default: return -5;}").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "4".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A27");
- }
-}
-/**
- * Array Reference
- */
-public void test028() {
- try {
- String sourceA28 =
- "public class A28 {\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic int bar2(int i) {\n"
- + "\t\tif (i == 2) {\n"
- + "\t\t\treturn 3;\n"
- + "\t\t} else {\n"
- + "\t\t\treturn 4;\n"
- + "\t\t}\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA28, "A28");
-
- String userCode = "new A28().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A28",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("int[] tab = new int[] { 1, 2, 3, 4, 5};\n"
- + "int i =3;\n"
- + "switch(foo()) {\n"
- + "case 0 : return -1;\n"
- + "case 1 : return tab[bar2(foo())];\n"
- + "}\n"
- + "return tab[i++];").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "4".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A28");
- }
-}
-/**
- * Array Reference
- */
-public void test029() {
- try {
- String sourceA29 =
- "public class A29 {\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic int bar2(int i) {\n"
- + "\t\tif (i == 2) {\n"
- + "\t\t\treturn 3;\n"
- + "\t\t} else {\n"
- + "\t\t\treturn 4;\n"
- + "\t\t}\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA29, "A29");
-
- String userCode = "new A29().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A29",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("int[] tab = new int[] { 1, 2, 3, 4, 5};\n"
- + "int i =3;\n"
- + "switch(foo()) {\n"
- + "case 0 : return -1;\n"
- + "case 1 : return tab[bar2(foo())];\n"
- + "}\n"
- + "return tab[++i];").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "5".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A29");
- }
-}
-/**
- * Array Reference: ArrayIndexOutOfBoundException
- */
-public void test030() {
- try {
- String sourceA30 =
- "public class A30 {\n"
- + "\tpublic int foo() {\n"
- + "\t\treturn 2;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "\tpublic int bar2(int i) {\n"
- + "\t\tif (i == 2) {\n"
- + "\t\t\treturn 3;\n"
- + "\t\t} else {\n"
- + "\t\t\treturn 4;\n"
- + "\t\t}\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA30, "A30");
-
- String userCode = "new A30().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A30",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("try {\n"
- + "int[] tab = new int[] { 1, 2, 3, 4};\n"
- + "int i =3;\n"
- + "switch(foo()) {\n"
- + "case 0 : return -1;\n"
- + "case 1 : return tab[bar2(foo())];\n"
- + "}\n"
- + "return tab[++i];"
- + "} catch(ArrayIndexOutOfBoundsException e) {\n"
- + "return -2;\n"
- + "}").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("One targetException : ArrayIndexOutOfBoundsException " + e.getMessage(), true);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "-2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A30");
- }
-}
-/**
- * Read access to an instance private member of the enclosing class
- */
-public void test031() {
- try {
- String sourceA31 =
- "public class A31 {\n"
- + "\tprivate int i = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA31, "A31");
-
- String userCode = "new A31().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A31",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return i;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A31");
- }
-}
-/**
- * Read access to a instance private member of the class different from the enclosing class
- */
-public void test032() {
- try {
- String sourceA32 =
- "public class A32 {\n"
- + "\tprivate int i = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA32, "A32");
-
- String sourceB32 =
- "public class B32 {\n"
- + "\tprivate int j = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceB32, "B32");
-
- String userCode = "new A32().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A32",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return new B32().j;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", result.hasProblems());
- IProblem[] problems = result.getProblems();
- StringBuffer buffer = null;
- for (int i = 0, max = problems.length; i < max; i++){
- if (problems[i].isError()){
- if (buffer == null) buffer = new StringBuffer(10);
- buffer.append(problems[i].getMessage());
- buffer.append('|');
- }
- }
- assertEquals("Unexpected errors",
- "The field j is not visible|",
- buffer == null ? "none" : buffer.toString());
- } finally {
- removeTempClass("B32");
- removeTempClass("A32");
- }
-}
-/**
- * Read access to an instance private member of the enclosing class
- */
-public void test033() {
- try {
- String sourceA33 =
- "public class A33 {\n"
- + "\tprivate long l = 2000000L;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA33, "A33");
-
- String userCode = "new A33().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A33",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("try {\n" +
- "Class c = Class.forName(\"A33\");\n" +
- "java.lang.reflect.Field field = c.getDeclaredField(\"l\");\n" +
- "field.setAccessible(true);\n" +
- "Object o = c.newInstance();\n" +
- "System.out.println(field.getInt(o));\n" +
- "} catch(Exception e) {}\n" +
- "return l;").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2000000".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "long".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A33");
- }
-}
-/**
- * Write access to an instance private member of the enclosing class
- */
-public void test034() {
- try {
- String sourceA34 =
- "public class A34 {\n"
- + "\tprivate long l = 2000000L;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA34, "A34");
-
- String userCode = "new A34().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A34", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("l = 100L;\n" +
- "return l;").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "100".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "long".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A34");
- }
-}
-/**
- * Read access to a static private member of the enclosing class
- */
-public void test035() {
- try {
- String sourceA35 =
- "public class A35 {\n"
- + "\tstatic private int i = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA35, "A35");
-
- String userCode = "new A35().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "A35",
- "bar",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return i;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A35");
- }
-}
-/**
- * Coumpound assignement to an instance private member of the enclosing class
- */
-public void test036() {
- try {
- String sourceA36 =
- "public class A36 {\n"
- + "\tprivate long l = 2000000L;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA36, "A36");
-
- String userCode = "new A36().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A36", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("l+=4;\n" +
- "return l;").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2000004".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "long".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A36");
- }
-}
-/**
- * Coumpound assignement to an instance private member of the enclosing class
- */
-public void test037() {
- try {
- String sourceA37 =
- "public class A37 {\n"
- + "\tprivate long l = 2000000L;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA37, "A37");
-
- String userCode = "new A37().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A37", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet =
- ("l++;\n" +
- "return l;").toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2000001".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "long".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A37");
- }
-}
-/**
- * Coumpound assignement to an instance private member of the enclosing class
- */
-public void test038() {
- try {
- String sourceA38 =
- "public class A38 {\n"
- + "\tprivate long l = 2000000L;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA38, "A38");
-
- String userCode = "new A38().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A38", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return l++;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2000000".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "long".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A38");
- }
-}
-/**
- * Coumpound assignement to an static private member of the enclosing class
- */
-public void test039() {
- try {
- String sourceA39 =
- "public class A39 {\n"
- + "\tstatic private int i = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA39, "A39");
-
- String userCode = "new A39().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A39", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return A39.i;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A39");
- }
-}
-/**
- * Coumpound assignement to an static private member of the enclosing class
- */
-public void test040() {
- try {
- String sourceA40 =
- "public class A40 {\n"
- + "\tstatic private int[] tab = new int[] {1, 2};\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA40, "A40");
-
- String userCode = "new A40().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A40", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return A40.tab.length;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A40");
- }
-}
-/**
- * Coumpound assignement to an static private final member of the enclosing class
- */
-public void test041() {
- try {
- String sourceA41 =
- "public class A41 {\n"
- + "\tstatic private final int[] tab = new int[] {1, 2};\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA41, "A41");
-
- String userCode = "new A41().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A41", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return A41.tab.length;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A41");
- }
-}
-/**
- * Coumpound assignement to an static private final member of the enclosing class
- */
-public void test042() {
- try {
- String sourceA42 =
- "public class A42 {\n"
- + "\tstatic private int Counter = 0;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA42, "A42");
-
- String userCode = "new A42().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A42", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return ++A42.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A42");
- }
-}
-/**
- * Coumpound assignement to an static private final member of the enclosing class
- */
-public void test043() {
- try {
- String sourceA43 =
- "public class A43 {\n"
- + "\tstatic private int Counter = 0;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA43, "A43");
-
- String userCode = "new A43().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A43", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "A43.Counter++; return A43.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A43");
- }
-}
-/**
- * Coumpound assignement to an static private final member of the enclosing class
- */
-public void test044() {
- try {
- String sourceA44 =
- "public class A44 {\n"
- + "\tstatic private int Counter = 0;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA44, "A44");
-
- String userCode = "new A44().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A44", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "int j = A44.Counter++; return A44.Counter + j;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A44");
- }
-}
-/**
- * Coumpound assignement to an static private final member of the enclosing class
- */
-public void test045() {
- try {
- String sourceA45 =
- "public class A45 {\n"
- + "\tstatic private int Counter = 0;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA45, "A45");
-
- String userCode = "new A45().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A45", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "int j = ++A45.Counter; return A45.Counter + j;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A45");
- }
-}
-/**
- * Coumpound assignement to an static protected final member of the enclosing class
- */
-public void test046() {
- try {
- String sourceA46 =
- "public class A46 {\n"
- + "\tstatic protected int Counter = 0;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA46, "A46");
-
- String userCode = "new A46().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A46", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "int j = ++A46.Counter; return A46.Counter + j;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A46");
- }
-}
-/**
- * Return the value of a private static field throught a private static field
- */
-public void test047() {
- try {
- String sourceA47 =
- "public class A47 {\n"
- + "\tstatic private A47 instance = new A47();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA47, "A47");
-
- String userCode = "new A47().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A47", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return A47.instance.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A47");
- }
-}
-/**
- * Return the value of a private static field throught a private static field
- * Using private field emulation on a field reference.
- */
-public void test048() {
- try {
- String sourceA48 =
- "public class A48 {\n"
- + "\tstatic private A48 instance = new A48();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA48, "A48");
-
- String userCode = "new A48().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A48", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return new A48().instance.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A48");
- }
-}
-/**
- * Compound assignment of a private field.
- * Using private field emulation on a field reference.
- */
-public void test049() {
- try {
- String sourceA49 =
- "public class A49 {\n"
- + "\tstatic private A49 instance = new A49();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA49, "A49");
-
- String userCode = "new A49().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A49", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return ++(new A49().Counter);".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A49");
- }
-}
-/**
- * Compound assignment of a private field.
- * Using private field emulation on a field reference.
- */
-public void test050() {
- try {
- String sourceA50 =
- "public class A50 {\n"
- + "\tstatic private A50 instance = new A50();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA50, "A50");
-
- String userCode = "new A50().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A50", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "A50 a = new A50(); a.Counter = 5; return a.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "5".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A50");
- }
-}
-/**
- * Assignment of a private field.
- * Using private field emulation on a field reference.
- */
-public void test051() {
- try {
- String sourceA51 =
- "public class A51 {\n"
- + "\tstatic private A51 instance = new A51();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA51, "A51");
-
- String userCode = "new A51().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A51", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "Counter = 5; return Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "5".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A51");
- }
-}
-/**
- * Assignment of a private field.
- * Using private field emulation on a field reference.
- */
-public void test052() {
- try {
- String sourceA52 =
- "public class A52 {\n"
- + "\tstatic private A52 instance = new A52();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA52, "A52");
-
- String userCode = "new A52().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A52", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "this.Counter = 5; return this.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "5".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A52");
- }
-}
-/**
- * Post assignement of a private field.
- * Using private field emulation on a field reference.
- */
-public void test053() {
- try {
- String sourceA53 =
- "public class A53 {\n"
- + "\tstatic private A53 instance = new A53();\n"
- + "\tstatic private int Counter = 2;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA53, "A53");
-
- String userCode = "new A53().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A53", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "this.Counter++; return this.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A53");
- }
-}
-/**
- * Post assignement of a private field.
- * Using private field emulation on a field reference.
- */
-public void test054() {
- try {
- String sourceA54 =
- "public class A54 {\n"
- + "\tstatic private A54 instance = new A54();\n"
- + "\tstatic private long Counter = 2L;\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA54, "A54");
-
- String userCode = "new A54().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A54", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "this.Counter++; return this.Counter;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "long".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A54");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test055() {
- try {
- String sourceA55 =
- "public class A55 {\n"
- + "\tprivate int foo() {;\n"
- + "\t\treturn 3;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA55, "A55");
-
- String userCode = "new A55().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A55", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return foo();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A55");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test056() {
- try {
- String sourceA56 =
- "public class A56 {\n"
- + "\tprivate Integer foo() {;\n"
- + "\t\treturn new Integer(3);\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA56, "A56");
-
- String userCode = "new A56().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A56", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return foo().intValue();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A56");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test057() {
- try {
- String sourceA57 =
- "public class A57 {\n"
- + "\tprivate Integer foo(int i) {;\n"
- + "\t\treturn new Integer(i);\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA57, "A57");
-
- String userCode = "new A57().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A57", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return foo(3).intValue();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A57");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test058() {
- try {
- String sourceA58 =
- "public class A58 {\n"
- + "\tprivate Integer foo(int i, int[] tab) {;\n"
- + "\t\treturn new Integer(i + tab.length);\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA58, "A58");
-
- String userCode = "new A58().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A58", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "int[] tab = new int[] {1,2,3};return foo(0, tab).intValue();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A58");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test059() {
- try {
- String sourceA59 =
- "public class A59 {\n"
- + "\tprivate Integer foo(int i, Object[][] tab) {;\n"
- + "\t\treturn new Integer(i + tab.length);\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA59, "A59");
-
- String userCode = "new A59().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A59", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "Object[][] tab = new Object[0][0];return foo(3, tab).intValue();".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A59");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test060() {
- try {
- String sourceA60 =
- "public class A60 {\n"
- + "\tprivate int i;\n"
- + "\tpublic A60() {;\n"
- + "\t}\n"
- + "\tprivate A60(int i) {;\n"
- + "\t\tthis.i = i;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA60, "A60");
-
- String userCode = "new A60().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A60", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return new A60(3).i;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A60");
- }
-}
-/**
- * Read access to a private method.
- */
-public void test061() {
- try {
- String sourceA61 =
- "public class A61 {\n"
- + "\tprivate int i;\n"
- + "\tpublic A61() {;\n"
- + "\t}\n"
- + "\tprivate A61(int[] tab) {;\n"
- + "\t\tthis.i = tab.length;\n"
- + "\t}\n"
- + "\tpublic void bar() {\n"
- + "\t}\n"
- + "}";
- compileAndDeploy(sourceA61, "A61");
-
- String userCode = "new A61().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A61", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return new A61(new int[] {1,2,3}).i;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "3".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A61");
- }
-}
-/**
- * Static context with a declaring type.
- */
-public void test062() {
- try {
- String sourceA62 =
- "public class A62 {\n" +
- " public static void bar() {\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceA62, "A62");
-
- String userCode = "new A62().bar();";
- JDIStackFrame stackFrame =
- new JDIStackFrame(this.jdiVM, this, userCode, "A62", "bar", -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "1 + 1".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue(
- "Should get one result but got " + (requestor.resultIndex + 1),
- requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Code snippet should not have problems", !result.hasProblems());
- assertTrue("Result should have a value", result.hasValue());
- assertEquals("Value", "2".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- removeTempClass("A62");
- }
-}
-public static Class testClass() {
- return DebugEvaluationTest.class;
-}
-/**
- * Return non-static field in static environment.
- */
-public void testNegative001() {
- try {
- String sourceANegative001 =
- "public class ANegative001 {\n" +
- " public int x = 1;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceANegative001, "ANegative001");
- String userCode =
- "new ANegative001().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "ANegative001",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return this.x;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- true, // force is static
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- IProblem[] problems = result.getProblems();
- StringBuffer buffer = null;
- for (int i = 0, max = problems.length; i < max; i++){
- if (problems[i].isError()){
- if (buffer == null) buffer = new StringBuffer(10);
- buffer.append(problems[i].getMessage());
- buffer.append('|');
- }
- }
- assertEquals("Unexpected errors",
- "Cannot use this in a static context |",
- buffer == null ? "none" : buffer.toString());
- } finally {
- removeTempClass("ANegative001");
- }
-}
-/**
- * Return non-static field in static environment.
- */
-public void testNegative002() {
- try {
- String sourceANegative002 =
- "public class ANegative002 {\n" +
- " public int x = 1;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceANegative002, "ANegative002");
- String userCode =
- "new ANegative002().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "ANegative002",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return x;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- true, // force is static
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- IProblem[] problems = result.getProblems();
- StringBuffer buffer = null;
- for (int i = 0, max = problems.length; i < max; i++){
- if (problems[i].isError()){
- if (buffer == null) buffer = new StringBuffer(10);
- buffer.append(problems[i].getMessage());
- buffer.append('|');
- }
- }
- assertEquals("Unexpected errors",
- "Cannot make a static reference to the non-static field x|",
- buffer == null ? "none" : buffer.toString());
- } finally {
- removeTempClass("ANegative002");
- }
-}
-/**
- * Return inexisting field in static environment.
- */
-public void testNegative003() {
- try {
- String sourceANegative003 =
- "public class ANegative003 {\n" +
- " public int x = 1;\n" +
- " public int foo() {\n" +
- " x++;\n" + // workaround pb with JDK 1.4.1 that doesn't stop if only return
- " return x;\n" +
- " }\n" +
- "}";
- compileAndDeploy(sourceANegative003, "ANegative003");
- String userCode =
- "new ANegative003().foo();";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode,
- "ANegative003",
- "foo",
- -1);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "return zork;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- true, // force is static
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- IProblem[] problems = result.getProblems();
- StringBuffer buffer = null;
- for (int i = 0, max = problems.length; i < max; i++){
- if (problems[i].isError()){
- if (buffer == null) buffer = new StringBuffer(10);
- buffer.append(problems[i].getMessage());
- buffer.append('|');
- }
- }
- assertEquals("Unexpected errors",
- "zork cannot be resolved|",
- buffer == null ? "none" : buffer.toString());
- } finally {
- removeTempClass("ANegative003");
- }
-}
-/**
- * Check java.lang.System.out = null returns an error
- */
-public void testNegative004() {
- String userCode = "";
- JDIStackFrame stackFrame = new JDIStackFrame(
- this.jdiVM,
- this,
- userCode);
-
- DebugRequestor requestor = new DebugRequestor();
- char[] snippet = "java.lang.System.out = null;".toCharArray();
- try {
- context.evaluate(
- snippet,
- stackFrame.localVariableTypeNames(),
- stackFrame.localVariableNames(),
- stackFrame.localVariableModifiers(),
- stackFrame.declaringTypeName(),
- stackFrame.isStatic(),
- stackFrame.isConstructorCall(),
- getEnv(),
- getOptions(),
- requestor,
- getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- IProblem[] problems = result.getProblems();
- StringBuffer buffer = null;
- for (int i = 0, max = problems.length; i < max; i++){
- if (problems[i].isError()){
- if (buffer == null) buffer = new StringBuffer(10);
- buffer.append(problems[i].getMessage());
- buffer.append('|');
- }
- }
- assertEquals("Unexpected errors",
- "The final field System.out cannot be assigned. It must be blank in this context, not qualified and not in compound assignment|",
- buffer == null ? "none" : buffer.toString());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java
deleted file mode 100644
index 282db2f..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.Enumeration;
-
-import junit.extensions.TestDecorator;
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.eclipse.jdt.core.tests.runtime.LocalVirtualMachine;
-
-import org.eclipse.jdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.jdt.core.tests.runtime.TargetException;
-import org.eclipse.jdt.core.tests.runtime.TargetInterface;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.batch.FileSystem;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.eval.EvaluationContext;
-
-public class EvaluationSetup extends TestDecorator {
- String jrePath;
- String evalDirectory;
- EvaluationContext context;
- TargetInterface target;
- LocalVirtualMachine launchedVM;
-public EvaluationSetup(Test test) {
- super(test);
-}
-protected void initTest(Object test, EvaluationContext evalContext, TargetInterface targetInterface, LocalVirtualMachine localVM, INameEnvironment env) {
- if (test instanceof EvaluationTest) {
- EvaluationTest evalTest = (EvaluationTest)test;
- evalTest.context = evalContext;
- evalTest.target = targetInterface;
- evalTest.launchedVM = localVM;
- evalTest.env = env;
- return;
- }
- if (test instanceof TestSuite) {
- TestSuite evaluationTestClassSuite = (TestSuite) test;
- Enumeration evaluationTestClassTests = evaluationTestClassSuite.tests();
- while (evaluationTestClassTests.hasMoreElements()) {
- initTest(evaluationTestClassTests.nextElement(), evalContext, targetInterface, localVM, env);
- }
- return;
- }
-
-}
-public void run(TestResult result) {
- try {
- setUp();
- super.run(result);
- } finally {
- tearDown();
- }
-}
-protected void setUp() {
- // Launch VM in evaluation mode
- int evalPort = Util.nextAvailablePortNumber();
- try {
- LocalVMLauncher launcher = LocalVMLauncher.getLauncher();
- launcher.setVMPath(this.jrePath);
- launcher.setEvalPort(evalPort);
- launcher.setEvalTargetPath(this.evalDirectory);
- this.launchedVM = launcher.launch();
- } catch (TargetException e) {
- throw new Error(e.getMessage());
- }
-
- // Thread that read the stout of the VM so that the VM doesn't block
- try {
- startReader("VM's stdout reader", this.launchedVM.getInputStream(), System.out);
- } catch (TargetException e) {
- }
-
- // Thread that read the sterr of the VM so that the VM doesn't block
- try {
- startReader("VM's sterr reader",this.launchedVM.getErrorStream(), System.err);
- } catch (TargetException e) {
- }
-
- // Create context
- this.context = new EvaluationContext();
-
- // Create target
- this.target = new TargetInterface();
- this.target.connect("localhost", evalPort, 10000);
-
- // Create name environment
- INameEnvironment env = new FileSystem(new String[] {Util.getJavaClassLib()}, new String[0], null);
-
- // Init wrapped suite
- initTest(fTest, this.context, this.target, this.launchedVM, env);
-}
-protected void startReader(String name, final InputStream in, final PrintStream out) {
- (new Thread(name) {
- public void run() {
- int read = 0;
- while (read != -1) {
- try {
- read = in.read();
- } catch (java.io.IOException e) {
- read = -1;
- }
- if (read != -1) {
- out.print((char) read);
- }
- }
- }
- }).start();
-}
-protected void tearDown() {
- if (context != null) {
- LocalVirtualMachine vm = this.launchedVM;
- if (vm != null) {
- try {
- if (this.target != null) {
- this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed.
- }
- int retry = 0;
- while (vm.isRunning() && (++retry < 20)) {
- try {
- Thread.sleep(retry * 100);
- } catch (InterruptedException e) {
- }
- }
- if (vm.isRunning()) {
- vm.shutDown();
- }
- this.context = null;
- } catch (TargetException e) {
- throw new Error(e.getMessage());
- }
- }
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationTest.java
deleted file mode 100644
index 2dfd593..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationTest.java
+++ /dev/null
@@ -1,522 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.io.File;
-import java.lang.reflect.Modifier;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.tests.junit.extension.StopableTestCase;
-import org.eclipse.jdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.jdt.core.tests.runtime.LocalVirtualMachine;
-import org.eclipse.jdt.core.tests.runtime.TargetException;
-import org.eclipse.jdt.core.tests.runtime.TargetInterface;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import org.eclipse.jdt.internal.compiler.IProblemFactory;
-import org.eclipse.jdt.internal.compiler.batch.FileSystem;
-import org.eclipse.jdt.internal.compiler.batch.Main;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.jdt.internal.compiler.env.IBinaryField;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.eval.EvaluationContext;
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-import org.eclipse.jdt.internal.eval.IRequestor;
-import org.eclipse.jdt.internal.eval.InstallException;
-
-public class EvaluationTest extends StopableTestCase {
- protected static final String JRE_PATH = Util.getJREDirectory();
- protected static final String EVAL_DIRECTORY = Util.getOutputDirectory() + File.separator + "evaluation";
- protected static final String SOURCE_DIRECTORY = Util.getOutputDirectory() + File.separator + "source";
- public EvaluationContext context;
- LocalVirtualMachine launchedVM;
- String[] classPath;
- INameEnvironment env;
- TargetInterface target;
-
- public class Requestor implements IRequestor {
- public int resultIndex = -1;
- public EvaluationResult[] results = new EvaluationResult[5];
- public boolean acceptClassFiles(ClassFile[] classFiles, char[] codeSnippetClassName) {
- try {
- target.sendClasses(codeSnippetClassName != null, classFiles);
- } catch (TargetException e) {
- return false;
- }
- if (codeSnippetClassName != null) {
- TargetInterface.Result result = target.getResult();
- if (result.displayString == null) {
- this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, null, null));
- } else {
- this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, result.displayString, result.typeName));
- }
- } else {
- for (int i = 0, length = classFiles.length; i < length; i++) {
- char[][] compoundName = classFiles[i].getCompoundName();
- if (new String(compoundName[compoundName.length-1]).startsWith("GlobalVariable")) {
- try {
- IBinaryField[] fields = new ClassFileReader(classFiles[i].getBytes(), null).getFields();
- if (fields != null) {
- for (int j = 0; j < fields.length; j++) {
- IBinaryField field = fields[j];
- if (Modifier.isPublic(field.getModifiers())) {
- TargetInterface.Result result = target.getResult();
- if (result.displayString == null) {
- this.acceptResult(new EvaluationResult(field.getName(), EvaluationResult.T_VARIABLE, null, null));
- } else {
- this.acceptResult(new EvaluationResult(field.getName(), EvaluationResult.T_VARIABLE, result.displayString, result.typeName));
- }
- }
- }
- }
- } catch (ClassFormatException e) {
- }
- }
- }
- }
- return true;
- }
- public void acceptProblem(IProblem problem, char[] fragmentSource, int fragmentKind) {
- this.acceptResult(new EvaluationResult(fragmentSource, fragmentKind, new IProblem[] {problem}));
- }
- public void acceptResult(EvaluationResult result) {
- try {
- this.results[++this.resultIndex] = result;
- } catch (ArrayIndexOutOfBoundsException e) {
- int oldResultLength = this.results.length;
- System.arraycopy(this.results , 0, (this.results = new EvaluationResult[oldResultLength * 2]), 0, oldResultLength);
- this.results[this.resultIndex] = result;
- }
- }
- }
-/**
- * Creates a new EvaluationTest.
- */
-public EvaluationTest(String name) {
- super(name);
-}
-/**
- * Asserts that two char arrays are equal. If they are not
- * an AssertionFailedError is thrown.
- * @param message the detail message for this assertion
- * @param expected the expected value of a char array
- * @param actual the actual value of a char array
- */
-public void assertEquals(String message, char[] expected, char[] actual) {
- if (expected == null && actual == null)
- return;
- if (expected != null) {
- if (actual == null) {
- failNotEquals(message, expected, actual);
- return;
- }
- if (expected.length == actual.length) {
- for (int i = 0; i < expected.length; i++) {
- if (expected[i] != actual[i]) {
- failNotEquals(message, expected, actual);
- return;
- }
- }
- return;
- }
- }
- failNotEquals(message, expected, actual);
-}
-/**
- * Build a char array from the given lines
- */
-protected char[] buildCharArray(String[] lines) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < lines.length; i++) {
- buffer.append(lines[i]);
- if (i < lines.length - 1) {
- buffer.append("\n");
- }
- }
- int length = buffer.length();
- char[] result = new char[length];
- buffer.getChars(0, length, result, 0);
- return result;
-}
-
-/**
- * Returns whether the 2 given problems are equals.
- */
-public boolean equals(IProblem pb1, IProblem pb2) {
- if ((pb1 == null) && (pb2 == null)) {
- return true;
- }
- if ((pb1 == null) || (pb2 == null)) {
- return false;
- }
- return
- (pb1.getID() == pb2.getID()) &&
- (pb1.isError() == pb2.isError()) &&
- (pb1.getSourceStart() == pb2.getSourceStart()) &&
- (pb1.getSourceEnd() == pb2.getSourceEnd()) &&
- (pb1.getSourceLineNumber() == pb2.getSourceLineNumber());
-}
-/**
- * Evaluates the given code snippet and makes sure it returns a result with the given display string.
- */
-public void evaluateWithExpectedDisplayString(char[] codeSnippet, char[] displayString) {
- Requestor requestor = new Requestor();
- try {
- context.evaluate(codeSnippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- if (requestor.resultIndex != 0) {
- for (int i = 0; i < requestor.resultIndex; i++){
- System.out.println("unexpected result["+i+"]: " + requestor.results[i]);
- }
- }
- assertTrue("Unexpected result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Has problem", !result.hasProblems());
- assertTrue("Empty problem list", result.getProblems().length == 0);
- if (displayString == null) {
- assertTrue("Has value", !result.hasValue());
- } else {
- assertTrue("Has value", result.hasValue());
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
- //assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
- assertEquals("Value display string", displayString, result.getValueDisplayString());
- }
-}
-/**
- * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem
- * on the given import.
- */
-protected void evaluateWithExpectedImportProblem(char[] codeSnippet, char[] importDeclaration, IProblem expected) {
- evaluateWithExpectedImportProblem(codeSnippet, importDeclaration, getOptions(), expected);
-}
-/**
- * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem
- * on the given import.
- */
-protected void evaluateWithExpectedImportProblem(char[] codeSnippet, char[] importDeclaration, Map options, IProblem expected) {
- Requestor requestor = new Requestor();
- try {
- context.evaluate(codeSnippet, getEnv(), options, requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- for (int i = 0; i <= requestor.resultIndex; i++) {
- EvaluationResult result = requestor.results[i];
- assertTrue("Has value", !result.hasValue());
- assertTrue("Has problem", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
- assertEquals("Evaluation id", importDeclaration, result.getEvaluationID());
- IProblem[] problems = result.getProblems();
- if (equals(expected, problems[0])) {
- return;
- }
- }
- assertTrue("Expected problem not found", false);
-}
-/**
- * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem.
- */
-protected void evaluateWithExpectedProblem(char[] codeSnippet, String problemsString) {
- Requestor requestor = new Requestor();
- try {
- context.evaluate(codeSnippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Has value", !result.hasValue());
- assertTrue("Has problem", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
- assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
- StringBuffer problemBuffer = new StringBuffer(20);
- IProblem[] problems = result.getProblems();
- for (int i = 0; i < problems.length; i++) {
- problemBuffer.append(problems[i].getMessage()).append('\n');
- }
- assertEquals("Unexpected problems", problemsString, problemBuffer.toString());
-}
-/**
- * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem.
- */
-protected void evaluateWithExpectedProblem(char[] codeSnippet, IProblem expected) {
- Requestor requestor = new Requestor();
- try {
- context.evaluate(codeSnippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- for (int i = 0; i <= requestor.resultIndex; i++) {
- EvaluationResult result = requestor.results[i];
- assertTrue("Has value", !result.hasValue());
- assertTrue("Has problem", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
- assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
- IProblem[] problems = result.getProblems();
- if (equals(expected, problems[0])) {
- return;
- }
- }
- assertTrue("Expected problem not found", false);
-}
-/**
- * Evaluates the given variable and makes sure the evaluation result has at least the given problem.
- */
-protected void evaluateWithExpectedProblem(GlobalVariable var, IProblem expected) {
- Requestor requestor = new Requestor();
- try {
- context.evaluateVariables(getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- for (int i = 0; i <= requestor.resultIndex; i++) {
- EvaluationResult result = requestor.results[i];
- assertTrue("Has value", !result.hasValue());
- assertTrue("Has problem", result.hasProblems());
- assertEquals("Evaluation type", EvaluationResult.T_VARIABLE, result.getEvaluationType());
- assertEquals("Evaluation id", var.getName(), result.getEvaluationID());
- IProblem[] problems = result.getProblems();
- if (equals(expected, problems[0])) {
- return;
- }
- }
- assertTrue("Expected problem not found", false);
-}
-/**
- * Evaluates the given code snippet and makes sure it returns a result with the given type name.
- */
-protected void evaluateWithExpectedType(char[] codeSnippet, char[] expectedTypeName) {
- Requestor requestor = new Requestor();
- try {
- context.evaluate(codeSnippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- if (requestor.resultIndex != 0) {
- for (int i = 0; i < requestor.resultIndex; i++){
- System.out.println("unexpected result["+i+"]: " + requestor.results[i]);
- }
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- if (expectedTypeName == null) {
- assertTrue("Has value", !result.hasValue());
- } else {
- assertTrue("Has value", result.hasValue());
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
- //assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
- assertEquals("Value type name", expectedTypeName, result.getValueTypeName());
- }
-}
-/**
- * Evaluates the given code snippet and makes sure it returns a result with the given display string and type name.
- */
-protected void evaluateWithExpectedValue(char[] codeSnippet, char[] displayString, char[] typeName) {
- Requestor requestor = new Requestor();
- try {
- context.evaluate(codeSnippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- if (displayString == null) {
- assertTrue("Missing value", !result.hasValue());
- } else {
- assertTrue("Has value", result.hasValue());
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
- //assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
- assertEquals("Value display string", displayString, result.getValueDisplayString());
- assertEquals("Value type name", typeName, result.getValueTypeName());
- }
-}
-/**
- * Evaluates the given variable and makes sure it returns a result with the given display string and type name.
- */
-protected void evaluateWithExpectedValue(GlobalVariable var, char[] displayString, char[] typeName) {
- Requestor requestor = new Requestor();
- try {
- context.evaluateVariable(var, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- if (requestor.resultIndex != 0) {
- for (int i = 0; i < requestor.resultIndex; i++){
- System.out.println("unexpected result["+i+"]: " + requestor.results[i]);
- }
- }
- assertTrue("Unexpected result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- if (displayString == null) {
- assertTrue("Has value", !result.hasValue());
- } else {
- assertTrue("Has value", result.hasValue());
- assertEquals("Value display string", displayString, result.getValueDisplayString());
- assertEquals("Value type name", typeName, result.getValueTypeName());
- }
-}
-/**
- * Evaluates the given code snippet and makes sure an evaluation result has at least the given warning,
- * and that another evaluation result has the given display string.
- */
-protected void evaluateWithExpectedWarningAndDisplayString(final char[] codeSnippet, final IProblem expected, final char[] displayString) {
- class ResultRequestor extends Requestor {
- boolean gotProblem = false;
- boolean gotDisplayString = false;
- public void acceptResult(EvaluationResult result) {
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
- //assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
- if (result.hasValue()) {
- if (CharOperation.equals(result.getValueDisplayString(), displayString)) {
- gotDisplayString = true;
- }
- } else {
- assertTrue("Has problem", result.hasProblems());
- IProblem[] problems = result.getProblems();
- for (int i = 0; i < problems.length; i++) {
- if (EvaluationTest.this.equals(expected, problems[i])) {
- gotProblem = true;
- }
- }
- }
- }
- };
- ResultRequestor requestor = new ResultRequestor();
- try {
- context.evaluate(codeSnippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception " + e.getMessage(), false);
- }
- assertTrue("Expected warning", requestor.gotProblem);
- assertTrue("Expected display string", requestor.gotDisplayString);
-}
-private void failNotEquals(String message, char[] expected, char[] actual) {
- String formatted = "";
- if (message != null)
- formatted = message + " ";
- String expectedString = expected == null ? "null" : new String(expected);
- String actualString = actual == null ? "null" : new String(actual);
- fail(formatted + "expected:<" + expectedString + "> but was:<" + actualString + ">");
-}
-public INameEnvironment getEnv() {
- return env;
-}
-public Map getOptions() {
-
- Map defaultOptions = Main.getDefaultOptions();
- defaultOptions.put(
- CompilerOptions.OPTION_LocalVariableAttribute,
- CompilerOptions.DO_NOT_GENERATE);
- defaultOptions.put(
- CompilerOptions.OPTION_LineNumberAttribute,
- CompilerOptions.DO_NOT_GENERATE);
- defaultOptions.put(
- CompilerOptions.OPTION_SourceFileAttribute,
- CompilerOptions.DO_NOT_GENERATE);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportUnusedLocal,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportUnusedImport,
- CompilerOptions.IGNORE);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportUnusedParameter,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportLocalVariableHiding,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportFieldHiding,
- CompilerOptions.WARNING);
- defaultOptions.put(
- CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment,
- CompilerOptions.WARNING);
- return defaultOptions;
-}
-
-public IProblemFactory getProblemFactory() {
- return new DefaultProblemFactory(java.util.Locale.getDefault());
-}
-/**
- * Installs all the variables and check that the number of installed variables is the given number.
- */
-protected void installVariables(final int expectedNumber) {
- class InstallRequestor extends Requestor {
- int count = 0;
- public void acceptResult(EvaluationResult result) {
- assertTrue("Has problems", !result.hasProblems());
- assertTrue("Has value", result.hasValue());
- this.count++;
- }
- }
-
- InstallRequestor installRequestor = new InstallRequestor();
- try {
- context.evaluateVariables(getEnv(), getOptions(), installRequestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("Target exception: " + e.getMessage(), false);
- }
- assertEquals("Number of installed variables", expectedNumber, installRequestor.count);
-}
-/**
- * Returns a new problem with the given id, severity, source positions and line number.
- */
-protected DefaultProblem newProblem(int id, int severity, int startPos, int endPos, int line) {
- return new DefaultProblem(null, null, id, null, severity, startPos, endPos, line);
-}
-public void resetEnv() {
- String encoding = (String) getOptions().get(CompilerOptions.OPTION_Encoding);
- if ("".equals(encoding)) encoding = null;
- env = new FileSystem(new String[] {Util.getJavaClassLib(), EvaluationTest.EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY}, new String[0], encoding);
-}
-public static Test setupSuite(Class clazz) {
- EvaluationSetup evalSetup = new EvaluationSetup(suite(clazz));
- evalSetup.jrePath = JRE_PATH;
- evalSetup.evalDirectory = EVAL_DIRECTORY;
- return evalSetup;
-}
-public void stop() {
- if (this.target != null) {
- this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed.
- }
- if (this.launchedVM != null) {
- try {
- int retry = 0;
- while (this.launchedVM.isRunning() && (++retry < 20)) {
- try {
- Thread.sleep(retry * 100);
- } catch (InterruptedException e) {
- }
- }
- if (this.launchedVM.isRunning()) {
- this.launchedVM.shutDown();
- }
- } catch (TargetException e) {
- }
- }
-}
-public static Test suite(Class evaluationTestClass) {
- TestSuite suite = new TestSuite(evaluationTestClass);
- return suite;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java
deleted file mode 100644
index f64a81c..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.tests.runtime.RuntimeConstants;
-import org.eclipse.jdt.internal.eval.EvaluationConstants;
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.InstallException;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ClassNotLoadedException;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Field;
-import com.sun.jdi.IncompatibleThreadStateException;
-import com.sun.jdi.InvalidTypeException;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.LocalVariable;
-import com.sun.jdi.Location;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.StackFrame;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.Value;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.event.BreakpointEvent;
-import com.sun.jdi.event.Event;
-import com.sun.jdi.event.EventSet;
-import com.sun.jdi.request.BreakpointRequest;
-import com.sun.jdi.request.EventRequest;
-
-public class JDIStackFrame implements EvaluationConstants, RuntimeConstants {
- VirtualMachine jdiVM;
- ThreadReference jdiThread;
- String userCode;
- String breakpointClassName;
- String breakpointMethodName;
- int breakpointLine;
-public JDIStackFrame(VirtualMachine jdiVM, DebugEvaluationTest test, String userCode) {
- this(jdiVM, test, userCode, "_JDIStackFrame_", "foo", Integer.MAX_VALUE);
-}
-public JDIStackFrame(
- VirtualMachine jdiVM,
- DebugEvaluationTest test,
- String userCode,
- String breakpointClassName,
- String breakpointMethodName,
- int breakpointLine) {
-
- this.jdiVM = jdiVM;
- this.userCode = userCode;
- this.breakpointClassName = breakpointClassName;
- this.breakpointMethodName = breakpointMethodName;
- this.breakpointLine = breakpointLine;
-
- test.jdiStackFrame = null;
- this.jdiThread = this.getDebuggedThread(test);
- test.jdiStackFrame = this;
-}
-public char[] declaringTypeName() {
- if (this.breakpointLine != Integer.MAX_VALUE) { // if not in a code snippet
- StackFrame frame = getStackFrame();
- return frame.location().declaringType().name().toCharArray();
- }
- return null;
-}
-protected ThreadReference getDebuggedThread(DebugEvaluationTest test) {
- try {
- // desintall previous breakpoints
- this.jdiVM.eventRequestManager().deleteAllBreakpoints();
-
- // install a breakpoint at the breakpointLine
- List classes = this.jdiVM.classesByName(this.breakpointClassName);
- if (classes.size() == 0) {
- if (this.breakpointClassName.equals("_JDIStackFrame_")) {
- // install special class
- String source =
- "public class _JDIStackFrame_ {\n" +
- " public int foo() {\n" +
- " return -1;\n" +
- " }\n" +
- "}";
- test.compileAndDeploy(source, "_JDIStackFrame_");
- }
-
- // force load of class
- test.evaluateWithExpectedDisplayString(
- ("return Class.forName(\"" + this.breakpointClassName + "\");").toCharArray(),
- ("class " + this.breakpointClassName).toCharArray()
- );
- classes = this.jdiVM.classesByName(this.breakpointClassName);
- if (classes.size() == 0) {
- // workaround bug in Standard VM
- Iterator iterator = this.jdiVM.allClasses().iterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType)iterator.next();
- if (type.name().equals(this.breakpointClassName)) {
- classes = new ArrayList(1);
- classes.add(type);
- break;
- }
- }
- if (classes.size() == 0) {
- throw new Error("JDI could not retrieve class for " + this.breakpointClassName);
- }
- }
- }
- ClassType clazz = (ClassType)classes.get(0);
- Method method = (Method)clazz.methodsByName(this.breakpointMethodName).get(0);
- Location location;
- if (this.breakpointLine < 0 || this.breakpointLine == Integer.MAX_VALUE) {
- location = method.location();
- } else {
- location = (Location)method.locationsOfLine(this.breakpointLine).get(0);
- }
- BreakpointRequest request = this.jdiVM.eventRequestManager().createBreakpointRequest(location);
- request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
- request.enable();
-
- // create a new thread that hit the breakpoint
- EvaluationTest.Requestor requestor = test.new Requestor();
- try {
- test.resetEnv();
- test.context.evaluate(
- ("(new Thread() {\n" +
- " public void run() {\n" +
- userCode + "\n" +
- (this.breakpointClassName.equals("_JDIStackFrame_") ? " new _JDIStackFrame_().foo();\n" : "") +
- " }\n" +
- " public String toString() {\n" +
- " return \"my thread\";\n" +
- " }\n" +
- "}).start();\n").toCharArray(),
- test.getEnv(),
- test.getOptions(),
- requestor,
- test.getProblemFactory());
- } catch (InstallException e) {
- EvaluationTest.assertTrue("Target exception " + e.getMessage(), false);
- }
- EvaluationResult[] results = requestor.results;
- for (int i = 0; i < requestor.resultIndex + 1; i++){
- if (results[i].hasErrors()) {
- EvaluationTest.assertTrue("Compilation error in user code", false);
- }
- }
-
- // Wait for the breakpoint event
- Event event = null;
- do {
- EventSet set = this.jdiVM.eventQueue().remove();
- Iterator iterator = set.eventIterator();
- while (iterator.hasNext()) {
- event = (Event)iterator.next();
- if (event instanceof BreakpointEvent)
- break;
- }
- } while (!(event instanceof BreakpointEvent));
-
- // Return the suspended thread
- return ((BreakpointEvent)event).thread();
- } catch (AbsentInformationException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return null;
-}
-protected StackFrame getStackFrame() {
- try {
- if (this.breakpointLine == Integer.MAX_VALUE) {
- return this.jdiThread.frame(1);
- } else {
- return this.jdiThread.frame(0);
- }
- } catch (IncompatibleThreadStateException e) {
- e.printStackTrace();
- return null;
- }
-}
-public boolean isConstructorCall() {
- if (this.breakpointLine != Integer.MAX_VALUE) { // if not in a code snippet
- StackFrame frame = getStackFrame();
- return frame.location().method().isConstructor();
- }
- return false;
-}
-public boolean isStatic() {
- if (this.breakpointLine != Integer.MAX_VALUE) { // if not in a code snippet
- StackFrame frame = getStackFrame();
- return frame.location().method().isStatic();
- }
- return false;
-}
-public int[] localVariableModifiers() {
- try {
- StackFrame frame = getStackFrame();
- List variables = frame.visibleVariables();
- int[] modifiers = new int[variables.size()];
-/* Iterator iterator = variables.iterator();
- int i = 0;
- while (iterator.hasNext()) {
- LocalVariable var = (LocalVariable)iterator.next();
- // TBD modifiers[i++] = var. ??? ;
- }
-*/ return modifiers;
- } catch (AbsentInformationException e) {
- return null;
- }
-}
-public char[][] localVariableNames() {
- try {
- StackFrame frame = getStackFrame();
- Iterator variables = frame.visibleVariables().iterator();
- Vector names = new Vector();
- while (variables.hasNext()) {
- LocalVariable var = (LocalVariable)variables.next();
- names.addElement(var.name().toCharArray());
- }
- char[][] result = new char[names.size()][];
- names.copyInto(result);
- return result;
- } catch (AbsentInformationException e) {
- return null;
- }
-}
-public char[][] localVariableTypeNames() {
- try {
- StackFrame frame = getStackFrame();
- Iterator variables = frame.visibleVariables().iterator();
- Vector names = new Vector();
- while (variables.hasNext()) {
- LocalVariable var = (LocalVariable)variables.next();
- names.addElement(var.typeName().toCharArray());
- }
- char[][] result = new char[names.size()][];
- names.copyInto(result);
- return result;
- } catch (AbsentInformationException e) {
- return null;
- }
-}
-public boolean run(String codeSnippetClassName) {
- ClassType codeSnippetClass;
- ObjectReference codeSnippet;
- Method method;
- List arguments;
- ObjectReference codeSnippetRunner;
- try {
- // Get the code snippet class
- List classes = jdiVM.classesByName(codeSnippetClassName);
- while (classes.size() == 0) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- classes = jdiVM.classesByName(codeSnippetClassName);
- if (classes.size() == 0) {
- // workaround bug in Standard VM
- Iterator iterator = this.jdiVM.allClasses().iterator();
- while (iterator.hasNext()) {
- ReferenceType type = (ReferenceType)iterator.next();
- if (type.name().equals(codeSnippetClassName)) {
- classes = new ArrayList(1);
- classes.add(type);
- break;
- }
- }
- }
- }
- codeSnippetClass = (ClassType)classes.get(0);
-
- // Create a new code snippet
- Method constructor = (Method)codeSnippetClass.methodsByName("<init>").get(0);
- codeSnippet = codeSnippetClass.newInstance(jdiThread, constructor, new ArrayList(), ClassType.INVOKE_SINGLE_THREADED);
-
- // Install local variables and "this" into generated fields
- StackFrame stackFrame = getStackFrame();
- try {
- Iterator variables = stackFrame.visibleVariables().iterator();
- while (variables.hasNext()) {
- LocalVariable jdiVariable = (LocalVariable)variables.next();
- Value value = stackFrame.getValue(jdiVariable);
- Field field = codeSnippetClass.fieldByName(new String(LOCAL_VAR_PREFIX) + jdiVariable.name());
- codeSnippet.setValue(field, value);
- }
- } catch (AbsentInformationException e) {
- // No variables
- }
- Field delegateThis = codeSnippetClass.fieldByName(new String(DELEGATE_THIS));
- ObjectReference thisObject;
- if (delegateThis != null && ((thisObject = stackFrame.thisObject()) != null)) {
- codeSnippet.setValue(delegateThis, thisObject);
- }
-
- // Get the code snippet runner
- ClassType codeSnippetRunnerClass = (ClassType)jdiVM.classesByName(CODE_SNIPPET_RUNNER_CLASS_NAME).get(0);
- Field theRunner = codeSnippetRunnerClass.fieldByName(THE_RUNNER_FIELD);
- codeSnippetRunner = (ObjectReference)codeSnippetRunnerClass.getValue(theRunner);
-
- // Get the method 'runCodeSnippet' and its arguments
- method = (Method)codeSnippetRunnerClass.methodsByName(RUN_CODE_SNIPPET_METHOD).get(0);
- arguments = new ArrayList();
- arguments.add(codeSnippet);
- } catch (ClassNotLoadedException e) {
- e.printStackTrace();
- return false;
- } catch (IncompatibleThreadStateException e) {
- e.printStackTrace();
- return false;
- } catch (InvalidTypeException e) {
- e.printStackTrace();
- return false;
- } catch (InvocationException e) {
- e.printStackTrace();
- return false;
- }
-
- try {
- // Invoke runCodeSnippet(CodeSnippet)
- codeSnippetRunner.invokeMethod(jdiThread, method, arguments, ClassType.INVOKE_SINGLE_THREADED);
-
- // Retrieve values of local variables and put them back in the stack frame
- StackFrame stackFrame = getStackFrame();
- try {
- Iterator variables = stackFrame.visibleVariables().iterator();
- while (variables.hasNext()) {
- LocalVariable jdiVariable = (LocalVariable)variables.next();
- Field field = codeSnippetClass.fieldByName(new String(LOCAL_VAR_PREFIX) + jdiVariable.name());
- Value value = codeSnippet.getValue(field);
- stackFrame.setValue(jdiVariable, value);
- }
- } catch (AbsentInformationException e) {
- // No variables
- }
- } catch (ClassNotLoadedException e) {
- e.printStackTrace();
- } catch (IncompatibleThreadStateException e) {
- e.printStackTrace();
- } catch (InvalidTypeException e) {
- e.printStackTrace();
- } catch (InvocationException e) {
- e.printStackTrace();
- }
- return true;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java
deleted file mode 100644
index 1808aeb..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
-import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-/**
- * Negative tests for code snippet. Only compilation problems should be reported in
- * these tests.
- */
-public class NegativeCodeSnippetTest extends EvaluationTest implements ProblemSeverities, ProblemReasons {
-/**
- * Creates a new NegativeCodeSnippetTest.
- */
-public NegativeCodeSnippetTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-/**
- * Test a scenario where the change of the package declaration causes a problem in a code snippet.
- */
-public void testChangePackage() {
- try {
- // define the package
- context.setPackageName("java.util.zip".toCharArray());
-
- // evaluate a code snippet that uses this variable
- char[] codeSnippet = "new InflaterInputStream(new java.io.ByteArrayInputStream(new byte[0])).len".toCharArray();
- evaluateWithExpectedDisplayString(
- codeSnippet,
- "0".toCharArray());
-
- // back to the default package but with correct import
- this.context.setPackageName(new char[0]);
- this.context.setImports(new char[][] {"java.util.zip.*".toCharArray()});
-
- // evaluate same code snippet
- evaluateWithExpectedProblem(
- codeSnippet,
- newProblem(IProblem.NotVisibleField, Error, 71, 73, 1)); // The field len is not visible
-
- // back to the default package and with no imports
- this.context.setImports(new char[0][]);
-
- // evaluate same code snippet
- evaluateWithExpectedProblem(
- codeSnippet,
- newProblem(IProblem.UndefinedType, Error, 4, 22, 1)); // The type InflaterInputStream is undefined
- } finally {
- // Clean up
- this.context.setPackageName(new char[0]);
- this.context.setImports(new char[0][]);
- }
-}
-public static Class testClass() {
- return NegativeCodeSnippetTest.class;
-}
-/**
- * Test a code snippet which declares a class that uses an expression as a returned statement
- * in one of its methods.
- */
-public void testExpressionInInnerClass() {
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "class X {",
- " int foo() {",
- " 1 + 1",
- " }",
- "}",
- "return new X().foo();"}),
- newProblem(IProblem.InvalidExpressionAsStatement, Error, 25, 25, 3)); // Syntax error on token "+"
-}
-/**
- * Test extra closing curly bracket.
- */
-public void testExtraClosingCurlyBracket() {
- // just an expression with an extra curly bracket
- evaluateWithExpectedProblem(
- "1 + 2}".toCharArray(),
- newProblem(IProblem.UnmatchedBracket, Error, 5, 5, 1)); // Unmatched bracket
-
- // a statement followed by an unreachable expression with an extra curly bracket
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "return 1 + 1;",
- " 2 + 2}"}),
- newProblem(IProblem.UnmatchedBracket, Error, 20, 20, 2)); // Unmatched bracket
-}
-/**
- * Test extra open round bracket.
- */
-public void testExtraOpenRoundBracket() {
- evaluateWithExpectedProblem(
- "foo((a);".toCharArray(),
- newProblem(IProblem.UnmatchedBracket, Error, 3, 3, 1)); // Unmatched bracket
-}
-/**
- * Test a code snippet that contains an expression followed by a semi-colon.
- */
-public void testExtraSemiColonInExpression() {
- evaluateWithExpectedProblem(
- "1;".toCharArray(),
- newProblem(IProblem.ParsingError, Error, 1, 1, 1)); // Syntax error on token EOF
-}
-/**
- * Test access to a non existing field.
- * (regression test for bug 25250 Scrapbook shows wrong error message)
- */
-public void testInvalidField() {
- evaluateWithExpectedProblem(
- ("String s = \"\";\n" +
- "s.length").toCharArray(),
- "s.length cannot be resolved or is not a field\n");
-}
-/**
- * Test a code snippet which is valid but the evaluation context imports have problems.
- */
-public void testInvalidImport() {
- try {
- // problem on the first import
- context.setImports(new char[][] {"bar.Y".toCharArray()});
- evaluateWithExpectedImportProblem(buildCharArray(new String[] {
- "class X {",
- " Y foo = new Y();",
- "}",
- "return new X().foo;"}),
- "bar.Y".toCharArray(),
- newProblem(IProblem.ImportNotFound, Error, 0, 4, 1)); // The import bar.Y could not be resolved
-
- // problem on the second import
- context.setImports(new char[][] {"java.io.*".toCharArray(), "{".toCharArray()});
- evaluateWithExpectedImportProblem(buildCharArray(new String[] {
- "new File(\"c:\\temp\")"}),
- "{".toCharArray(),
- newProblem(IProblem.ParsingError, Error, 0, 0, 1)); // Syntax error on token "{", "Identifier" expected
- } finally {
- // Clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Test use of this.
- */
-public void testInvalidUseOfThisInSnippet() {
- evaluateWithExpectedProblem(
- "this".toCharArray(),
- "Cannot use this in a static context \n");
-}
-/**
- * Test use of this.
- */
-public void testInvalidUseOfThisInSnippet2() {
- // just an expression with an extra curly bracket
- evaluateWithExpectedProblem(
- "return this;".toCharArray(),
- "Cannot use this in a static context \n");
-}
-/**
- * Test a code snippet that misses a closing round bracket.
- */
-public void testMissingClosingRoundBracket() {
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "System.out.println(\"3 + 3\";"}),
- newProblem(IProblem.UnmatchedBracket, Error, 18, 18, 1)); // Unmatched bracket
-}
-/**
- * Test a code snippet that contains a string that misses the closing double quote .
- */
-public void testMissingDoubleQuote() {
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "System.out.println(\"3 + 3 = );",
- "3 + 3"}),
- newProblem(IProblem.UnterminatedString , Error, 19, 30, 1)); // String literal is not properly closed by a double-quote
-}
-/**
- * Test an expression which is not the last statement.
- */
-public void testNonLastExpressionStatement() {
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "1 == '1';",
- "true"}),
- newProblem(IProblem.ParsingError, Error, 8, 8, 1)); // Syntax error on token ";"
-}
-/**
- * Test a problem in the returned expression.
- */
-public void testProblemInExpression() {
- evaluateWithExpectedProblem(
- "new Object(); 3 + ".toCharArray(),
- newProblem(IProblem.ParsingError, Error, 17, 17, 1)); // Syntax error on token EOF
-}
-/**
- * Test a problem in the returned expression.
- */
-public void testProblemInExpression2() {
- evaluateWithExpectedProblem(
- "new UnknownClass()".toCharArray(),
- newProblem(IProblem.UndefinedType, Error, 4, 15, 1)); // UnknownClass cannot be resolved or is not a type
-}
-/**
- * Test a code snippet which declares a class that has a problem.
- */
-public void testProblemInInnerClass() {
- // class declared before the last expression
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "class X {",
- " Y foo = new Y();",
- "}",
- "return new X().foo;"}),
- newProblem(IProblem.FieldTypeNotFound, Error, 11, 11, 2)); // The type Y is undefined for the field X.foo
-
- // class declared as part of the last expression
- evaluateWithExpectedWarningAndDisplayString(buildCharArray(new String[] {
- "return new Object() {",
- " public String toString() {",
- " int i = 0;",
- " return \"an inner class\";",
- " }",
- "};"}),
- newProblem(IProblem.LocalVariableIsNeverUsed, Warning, 56, 56, 3), // The local variable i is never used
- "an inner class".toCharArray());
-}
-/**
- * Test a problem in the statement before the returned expression.
- */
-public void testProblemInPreviousStatement() {
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "return foo(a a);",
- "1 + 3"}),
- newProblem(IProblem.ParsingError, Error, 13, 13, 1)); // Syntax error on token "a"
-}
-/**
- * Test a code snippet that has a problem in a return statement.
- */
-public void testProblemInReturnStatement() {
- evaluateWithExpectedProblem(
- "return 1 ++ 1;".toCharArray(),
- newProblem(IProblem.InvalidUnaryExpression, Error, 7, 7, 1)); // Invalid argument to operation ++/--
-}
-/**
- * Test a scenario where the removal of an import causes a problem in a code snippet.
- */
-public void testRemoveImport() {
- try {
- // define the import
- this.context.setImports(new char[][] {"java.io.*".toCharArray()});
-
- // evaluate a code snippet that uses this variable
- char[] codeSnippet = "new File(\"c:\\\\temp\")".toCharArray();
- evaluateWithExpectedDisplayString(
- codeSnippet,
- "c:\\temp".toCharArray());
-
- // remove the import
- this.context.setImports(new char[0][]);
-
- // evaluate same code snippet
- evaluateWithExpectedProblem(
- codeSnippet,
- newProblem(IProblem.UndefinedType, Error, 4, 7, 1)); // The type File is undefined
- } finally {
- // Clean up
- this.context.setImports(new char[0][]);
- }
-}
-/**
- * Test a scenario where the removal of a variable causes a problem in a code snippet.
- */
-public void testRemoveVariable() {
- GlobalVariable var = null;
- try {
- // define the variable
- var = this.context.newVariable("int".toCharArray(), "i".toCharArray(), "1".toCharArray());
- installVariables(1);
-
- // evaluate a code snippet that uses this variable
- char[] codeSnippet = "i".toCharArray();
- evaluateWithExpectedDisplayString(
- codeSnippet,
- "1".toCharArray());
-
- // remove the variable
- this.context.deleteVariable(var);
- installVariables(0);
-
- // evaluate same code snippet
- evaluateWithExpectedProblem(
- codeSnippet,
- newProblem(IProblem.UndefinedName, Error, 0, 0, 1)); // i cannot be resolved
- } finally {
- // Clean up
- if (var != null) {
- this.context.deleteVariable(var);
- }
- }
-}
-/**
- * Test a code snippet that contains an expression which is not reachable.
- */
-public void testUnreachableExpression() {
- evaluateWithExpectedProblem(buildCharArray(new String[] {
- "return 1 + 1;",
- "2 + 2"}),
- newProblem(IProblem.CodeCannotBeReached, Error, 14, 18, 2)); // Unreachable code
-}
-/**
- * Test a code snippet which is valid but never uses the evaluation context imports.
- * (regression test for bug 18922 Scrapbook does not come back when errors in snippet)
- */
-public void testUnusedImport() {
- try {
- context.setImports(new char[][] {"java.util.*".toCharArray()});
-
- // evaluate with import as error
- Map options = this.getOptions();
- options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
-
- // force evaluation so that the following evaluation will use a CodeSnippetEvaluator instead
- // of a VariableEvualator
- evaluateWithExpectedValue("1".toCharArray(), "1".toCharArray(), "int".toCharArray());
-
- evaluateWithExpectedImportProblem(
- "new String(\"NOPE\")".toCharArray(),
- "java.util.*".toCharArray(),
- options,
- newProblem(IProblem.UnusedImport, Error, 0, 10, 1)); // The import java.util.* is unused
- } finally {
- // Clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Test a code snippet that has warnings but no errors.
- */
-public void testWarning() {
- evaluateWithExpectedWarningAndDisplayString(buildCharArray(new String[] {
- "int i;",
- "1 + 1"}),
- newProblem(IProblem.LocalVariableIsNeverUsed, Warning, 4, 4, 1), // The local variable i is never used
- "2".toCharArray());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeVariableTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeVariableTest.java
deleted file mode 100644
index e812912..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeVariableTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
-import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-/**
- * Negative tests for variables. Only compilation problems should be reported in
- * these tests.
- */
-public class NegativeVariableTest extends EvaluationTest implements ProblemSeverities, ProblemReasons {
-/**
- * Creates a new NegativeVariableTest.
- */
-public NegativeVariableTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public static Class testClass() {
- return NegativeVariableTest.class;
-}
-/**
- * Test a variable that has a problem in its initializer.
- */
-public void testInitializerProblem() {
- // Problem in first variable
- GlobalVariable var = null;
- try {
- var = context.newVariable("int".toCharArray(), "i".toCharArray(), buildCharArray(new String[] {
- "(1 + 1) *",
- "(j + 2)"}));
- evaluateWithExpectedProblem(
- var,
- newProblem(IProblem.UndefinedName, Error, 11, 11, 2)); // j cannot be resolved
- } finally {
- if (var != null) {
- context.deleteVariable(var);
- }
- }
-
- // Problem in second variable
- GlobalVariable var1 = null;
- GlobalVariable var2 = null;
- try {
- var1 = context.newVariable("Object".toCharArray(), "o".toCharArray(), "new Object()".toCharArray());
- var2 = context.newVariable("int".toCharArray(), "i".toCharArray(), buildCharArray(new String[] {
- "(1 + 1) *",
- "(1 ++ 2)"}));
- evaluateWithExpectedProblem(
- var2,
- newProblem(IProblem.InvalidUnaryExpression, Error, 11, 11, 2)); // Invalid argument to operation ++/--
- } finally {
- if (var1 != null) {
- context.deleteVariable(var1);
- }
- if (var2 != null) {
- context.deleteVariable(var2);
- }
- }
-
-}
-/**
- * Test a variable that has a problem in its name.
- */
-public void testInvalidName() {
- // Problem in first variable
- GlobalVariable var = null;
- try {
- var = context.newVariable("int".toCharArray(), "!@#$%^&*()_".toCharArray(), "1".toCharArray());
- evaluateWithExpectedProblem(
- var,
- newProblem(IProblem.ParsingError, Error, 0, 0, 0)); // Syntax error on token "!", "Identifier" expected
- } finally {
- if (var != null) {
- context.deleteVariable(var);
- }
- }
-
- // Problem in second variable
- GlobalVariable var1 = null;
- GlobalVariable var2 = null;
- try {
- var1 = context.newVariable("String".toCharArray(), "foo".toCharArray(), "\"bar\"".toCharArray());
- var2 = context.newVariable("int".toCharArray(), "!@#$%^&*()_".toCharArray(), "1".toCharArray());
- evaluateWithExpectedProblem(
- var2,
- newProblem(IProblem.ParsingError, Error, 0, 0, 0)); // Syntax error on token "!", "Identifier" expected
- } finally {
- if (var1 != null) {
- context.deleteVariable(var1);
- }
- if (var2 != null) {
- context.deleteVariable(var2);
- }
- }
-}
-/**
- * Test a variable that has a problem in its type declaration.
- */
-public void testUnknownType() {
- // Problem in first variable
- GlobalVariable var = null;
- try {
- var = context.newVariable("foo.Bar".toCharArray(), "var".toCharArray(), null);
- evaluateWithExpectedProblem(
- var,
- newProblem(IProblem.FieldTypeNotFound, Error, 0, 6, -1)); // The type foo is undefined for the field GlobalVariables_1.var
- } finally {
- if (var != null) {
- context.deleteVariable(var);
- }
- }
-
- // Problem in second variable
- GlobalVariable var1 = null;
- GlobalVariable var2 = null;
- try {
- var1 = context.newVariable("int".toCharArray(), "x".toCharArray(), null);
- var2 = context.newVariable("foo.Bar".toCharArray(), "var".toCharArray(), null);
- evaluateWithExpectedProblem(
- var2,
- newProblem(IProblem.FieldTypeNotFound, Error, 0, 6, -1)); // The type foo is undefined for the field GlobalVariables_1.var
- } finally {
- if (var1 != null) {
- context.deleteVariable(var1);
- }
- if (var2 != null) {
- context.deleteVariable(var2);
- }
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationContext.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationContext.java
deleted file mode 100644
index a050e00..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationContext.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-import org.eclipse.jdt.internal.eval.IRequestor;
-import org.eclipse.jdt.internal.eval.InstallException;
-/**
- * Sanity test the IEvaluationContext interface.
- * For in depth tests, see VariableTest or CodeSnippetTest.
- */
-public class SanityTestEvaluationContext extends EvaluationTest {
-/**
- * Creates a new SanityEvaluationContextTest.
- */
-public SanityTestEvaluationContext(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-/**
- * Sanity test of IEvaluationContext.allVariables()
- */
-public void testAllVariables() {
- // No variables defined yet
- GlobalVariable[] vars = context.allVariables();
- assertEquals("No variables should be defined", 0, vars.length);
-
- // Define 3 variables
- context.newVariable("int".toCharArray(), "foo".toCharArray(), "1".toCharArray());
- context.newVariable("Object".toCharArray(), "bar".toCharArray(), null);
- context.newVariable("String".toCharArray(), "zip".toCharArray(), "\"abcdefg\"".toCharArray());
- vars = context.allVariables();
- assertEquals("3 variables should be defined", 3, vars.length);
- assertEquals("1st variable", "foo".toCharArray(), vars[0].getName());
- assertEquals("2nd variable", "bar".toCharArray(), vars[1].getName());
- assertEquals("3rd variable", "zip".toCharArray(), vars[2].getName());
-
- // Remove 2nd variable
- context.deleteVariable(vars[1]);
- vars = context.allVariables();
- assertEquals("2 variables should be defined", 2, vars.length);
- assertEquals("1st variable", "foo".toCharArray(), vars[0].getName());
- assertEquals("2nd variable", "zip".toCharArray(), vars[1].getName());
-
- // Remove last variable
- context.deleteVariable(vars[1]);
- vars = context.allVariables();
- assertEquals("1 variable should be defined", 1, vars.length);
- assertEquals("1st variable", "foo".toCharArray(), vars[0].getName());
-
- // Remove 1st variable
- context.deleteVariable(vars[0]);
- vars = context.allVariables();
- assertEquals("No variables should be defined", 0, vars.length);
-}
-public static Class testClass() {
- return SanityTestEvaluationContext.class;
-}
-/**
- * Sanity test of IEvaluationContext.evaluate(char[], INameEnvironment, ConfigurableOption[], IRequestor , IProblemFactory)
- */
-public void testEvaluate() {
- Requestor requestor = new Requestor();
- char[] snippet = "return 1;".toCharArray();
- try {
- context.evaluate(snippet, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("No problems with the code snippet", !result.hasProblems());
- assertTrue("Result has a value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
-}
-/**
- * Sanity test of IEvaluationContext.evaluateImports(INameEnvironment, IRequestor , IProblemFactory)
- */
-public void testEvaluateImports() {
- try {
- // Define imports
- context.setImports(new char[][] {"java.util.*".toCharArray(), "java.lang.reflect.Method".toCharArray()});
-
- // Evaluate them
- IRequestor requestor = new Requestor() {
- public void acceptResult(EvaluationResult result) {
- assertTrue("No problems with the imports", !result.hasProblems());
- }
- };
- context.evaluateImports(getEnv(), requestor, getProblemFactory());
- } finally {
- // Clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Sanity test of IEvaluationContext.evaluateVariable(IGlobalVariable, IRequestor)
- */
-public void testEvaluateVariable() {
- GlobalVariable var = null;
- try {
- // Create the variable
- var = context.newVariable("int".toCharArray(), "foo".toCharArray(), "1".toCharArray());
-
- // Install it
- class NoPbRequestor extends Requestor {
- public void acceptResult(EvaluationResult result) {
- assertTrue("No problems with the variable", !result.hasProblems());
- }
- };
- try {
- context.evaluateVariables(getEnv(), getOptions(), new NoPbRequestor(), getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
-
- // Get its value
- Requestor requestor = new Requestor();
- try {
- context.evaluateVariable(var, getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("Result has value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- // Clean up
- if (var != null) {
- context.deleteVariable(var);
- }
- }
-}
-/**
- * Sanity test of IEvaluationContext.evaluateVariables(INameEnvironment, ConfigurableOption[], IRequestor, IProblemFactory)
- */
-public void testEvaluateVariables() {
- GlobalVariable var = null;
- try {
- // Create 1 variable
- var = context.newVariable("int".toCharArray(), "foo".toCharArray(), "1".toCharArray());
-
- // Install it and get its value
- Requestor requestor = new Requestor();
- try {
- context.evaluateVariables(getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- assertTrue("No targetException " + e.getMessage(), false);
- }
- assertTrue("Got one result", requestor.resultIndex == 0);
- EvaluationResult result = requestor.results[0];
- assertTrue("No problems with the variable", !result.hasProblems());
- assertTrue("Result has value", result.hasValue());
- assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
- assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
- } finally {
- // Clean up
- if (var != null) {
- context.deleteVariable(var);
- }
- }
-}
-/**
- * Sanity test of IEvaluationContext.getImports() and IEvaluationContext.setImports(char[][])
- */
-public void testGetSetImports() {
- try {
- // No imports
- assertTrue("No imports defined", context.getImports().length == 0);
-
- // Define some imports
- char[][] imports = new char[][] {"java.util".toCharArray(), "java.lang.reflect.Method".toCharArray()};
- context.setImports(imports);
- char[][] storedImports = context.getImports();
- assertEquals("Same length", imports.length, storedImports.length);
- for (int i = 0; i < imports.length; i++){
- assertEquals("Import #" + i, imports[i], storedImports[i]);
- }
- } finally {
- // Clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Sanity test of IEvaluationContext.getPackageName() and IEvaluationContext.setPackageName(char[])
- */
-public void testGetSetPackageName() {
- try {
- // Default package
- assertTrue("Default package", context.getPackageName().length == 0);
-
- // Define a package
- char[] packageName = "x.y.z".toCharArray();
- context.setPackageName(packageName);
- char[] storedPackageName = context.getPackageName();
- assertEquals("Same package name", packageName, storedPackageName);
- } finally {
- // Clean up
- context.setPackageName(new char[0]);
- }
-}
-/**
- * Sanity test of IEvaluationContext.newVariable(char[], char[], char[]) and
- * IEvaluationContext.deleteVariable(IGlobalVariable)
- */
-public void testNewDeleteVariable() {
- // Define 1 variable
- GlobalVariable var = context.newVariable("int".toCharArray(), "deleted".toCharArray(), null);
-
- // Delete it
- context.deleteVariable(var);
- GlobalVariable[] vars = context.allVariables();
- for (int i = 0; i < vars.length; i++) {
- assertTrue("Variable should not exist", !var.getName().equals(vars[i].getName()));
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationResult.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationResult.java
deleted file mode 100644
index 7077b1a..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationResult.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.IRequestor;
-import org.eclipse.jdt.internal.eval.InstallException;
-/**
- * Sanity test the IEvaluationResult interface.
- * For in depth tests, see VariableTest or CodeSnippetTest.
- */
-public class SanityTestEvaluationResult extends EvaluationTest {
- EvaluationResult result;
-/**
- * Creates a new SanityEvaluationResultTest.
- */
-public SanityTestEvaluationResult(String name) {
- super(name);
-}
-/**
- * Initializes this test with an evaluation result coming from the
- * evaluation of the following code snippet: "return 1;".
- */
-protected void setUp() {
- IRequestor requestor = new Requestor() {
- public void acceptResult(EvaluationResult evalResult) {
- SanityTestEvaluationResult.this.result = evalResult;
- }
- };
- try {
- this.context.evaluate("return 1;".toCharArray(), getEnv(), getOptions(), requestor, getProblemFactory());
- } catch (InstallException e) {
- throw new Error(e.getMessage());
- }
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-public static Class testClass() {
- return SanityTestEvaluationResult.class;
-}
-/**
- * Sanity test of IEvaluationResult.getEvaluationType()
- */
-public void testGetEvaluationType() {
- int evaluationType = result.getEvaluationType();
- assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, evaluationType);
-}
-/**
- * Sanity test of IEvaluationResult.getProblems()
- */
-public void testGetProblems() {
- IProblem[] problems = result.getProblems();
- assertTrue("Problems", problems == null || problems.length == 0);
-}
-/**
- * Sanity test of IEvaluationResult.getValue()
- */
-public void testGetValue() {
- // TBD: Not implemented yet
-}
-/**
- * Sanity test of IEvaluationResult.getValueDisplayString()
- */
-public void testGetValueDisplayString() {
- char[] displayString = this.result.getValueDisplayString();
- assertEquals("Value display string", "1".toCharArray(), displayString);
-}
-/**
- * Sanity test of IEvaluationResult.getValueTypeName()
- */
-public void testGetValueTypeName() {
- char[] typeName = this.result.getValueTypeName();
- assertEquals("Value type name", "int".toCharArray(), typeName);
-}
-/**
- * Sanity test of IEvaluationResult.hasErrors()
- */
-public void testHasErrors() {
- assertTrue("Result has no errors", !result.hasErrors());
-}
-/**
- * Sanity test of IEvaluationResult.hasProblems()
- */
-public void testHasProblems() {
- assertTrue("Result has no problems", !result.hasProblems());
-}
-/**
- * Sanity test of IEvaluationResult.hasValue()
- */
-public void testHasValue() {
- assertTrue("Result has a value", result.hasValue());
-}
-/**
- * Sanity test of IEvaluationResult.hasWarnings()
- */
-public void testHasWarnings() {
- assertTrue("Result has no warnings", !result.hasWarnings());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleCodeSnippetTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleCodeSnippetTest.java
deleted file mode 100644
index 08eea6c..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleCodeSnippetTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import org.eclipse.jdt.core.tests.runtime.TargetException;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.eval.InstallException;
-
-
-public class SimpleCodeSnippetTest
- extends SimpleTest {
- public char[] getCodeSnippetSource() {
-
- return buildCharArray(new String[] { "1 + 1" });
- }
-
- public static void main(String[] args)
- throws TargetException, InstallException {
-
- SimpleCodeSnippetTest test = new SimpleCodeSnippetTest();
- test.runCodeSnippet();
- }
-
- void runCodeSnippet()
- throws TargetException, InstallException {
- this.startEvaluationContext();
-
- char[] snippet = getCodeSnippetSource();
- INameEnvironment env = getEnv();
- this.context.evaluate(snippet, env, null, this.requestor,
- getProblemFactory());
- this.stopEvaluationContext();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleTest.java
deleted file mode 100644
index f016ca4..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleTest.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import java.io.File;
-
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.jdt.core.tests.runtime.LocalVirtualMachine;
-
-import org.eclipse.jdt.core.tests.runtime.TargetException;
-import org.eclipse.jdt.core.tests.runtime.TargetInterface;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import org.eclipse.jdt.internal.compiler.IProblemFactory;
-import org.eclipse.jdt.internal.compiler.batch.FileSystem;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.jdt.internal.compiler.env.IBinaryField;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.eval.EvaluationContext;
-import org.eclipse.jdt.internal.eval.EvaluationResult;
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-import org.eclipse.jdt.internal.eval.IRequestor;
-
-public class SimpleTest {
- static final String JRE_PATH = Util.getJREDirectory();
- static final String[] COMPILATION_CLASSPATH = new String[] {Util.getJavaClassLib(), Util.getOutputDirectory()};
- static final String[] RUNTIME_CLASSPATH = new String[] {Util.getOutputDirectory()};
- static final String TARGET_PATH = Util.getOutputDirectory() + File.separator + "evaluation";
- protected EvaluationContext context;
- protected LocalVirtualMachine launchedVM;
- protected TargetInterface target;
- protected Requestor requestor;
-
- class Requestor implements IRequestor {
- int globalProblemCount = 0;
- public boolean acceptClassFiles(ClassFile[] classFiles, char[] codeSnippetClassName) {
- try {
- target.sendClasses(codeSnippetClassName != null, classFiles);
- } catch (TargetException e) {
- return false;
- }
- if (codeSnippetClassName != null) {
- TargetInterface.Result result = target.getResult();
- if (result.displayString == null) {
- System.out.println("(No explicit return value)");
- } else {
- System.out.print("(");
- System.out.print(result.typeName);
- System.out.print(") ");
- System.out.println(result.displayString);
- }
- } else {
- for (int i = 0, length = classFiles.length; i < length; i++) {
- char[][] compoundName = classFiles[i].getCompoundName();
- if (new String(compoundName[compoundName.length-1]).startsWith("GlobalVariable")) {
- try {
- IBinaryField[] fields = new ClassFileReader(classFiles[i].getBytes(), null).getFields();
- if (fields != null) {
- for (int j = 0; j < fields.length; j++) {
- TargetInterface.Result result = target.getResult();
- if (result.displayString == null) {
- System.out.println("(No explicit return value)");
- } else {
- System.out.print("(");
- System.out.print(result.typeName);
- System.out.print(") ");
- System.out.println(result.displayString);
- }
- }
- }
- } catch (ClassFormatException e) {
- }
- }
- }
- }
- return true;
- }
- public void acceptProblem(IProblem problem, char[] fragmentSource, int fragmentKind) {
- int localErrorCount = 0;
- globalProblemCount++;
- char[] source = fragmentSource;
- if (localErrorCount == 0)
- System.out.println("----------");
- if (fragmentKind == EvaluationResult.T_INTERNAL) {
- System.out.print(globalProblemCount + (problem.isError() ? ". INTERNAL ERROR" : ". INTERNAL WARNING"));
- System.out.print(" in generated compilation unit");
- } else {
- System.out.print(globalProblemCount + (problem.isError() ? ". ERROR" : ". WARNING"));
- System.out.print(" in ");
- switch (fragmentKind) {
- case EvaluationResult.T_PACKAGE:
- System.out.print("package");
- break;
- case EvaluationResult.T_IMPORT:
- System.out.print("import");
- break;
- case EvaluationResult.T_CODE_SNIPPET:
- System.out.print("code snippet");
- break;
- case EvaluationResult.T_VARIABLE:
- int line = problem.getSourceLineNumber();
- if (line == -1) {
- System.out.print("variable type");
- source = findVar(fragmentSource).getTypeName();
- } else if (line == 0) {
- System.out.print("variable name");
- source = findVar(fragmentSource).getName();
- } else {
- System.out.print("variable initializer");
- source = findVar(fragmentSource).getInitializer();
- }
- break;
- }
- }
- System.out.println(errorReportSource((DefaultProblem)problem, source));
- System.out.println(problem.getMessage());
- System.out.println("----------");
- if (problem.isError())
- localErrorCount++;
- }
- }
-/**
- * Build a char array from the given lines
- */
-protected char[] buildCharArray(String[] lines) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < lines.length; i++) {
- buffer.append(lines[i]);
- if (i < lines.length -1) {
- buffer.append("\n");
- }
- }
- int length = buffer.length();
- char[] result = new char[length];
- buffer.getChars(0, length, result, 0);
- return result;
-}
-protected String errorReportSource(DefaultProblem problem, char[] source) {
- //extra from the source the innacurate token
- //and "highlight" it using some underneath ^^^^^
- //put some context around too.
-
- //this code assumes that the font used in the console is fixed size
-
- //sanity .....
- if ((problem.getSourceStart() > problem.getSourceEnd()) || ((problem.getSourceStart() < 0) && (problem.getSourceEnd() < 0)))
- return "\n!! no source information available !!";
-
- //regular behavior....(slow code)
-
- final char SPACE = '\u0020';
- final char MARK = '^';
- final char TAB = '\t';
- //the next code tries to underline the token.....
- //it assumes (for a good display) that token source does not
- //contain any \r \n. This is false on statements !
- //(the code still works but the display is not optimal !)
-
- //compute the how-much-char we are displaying around the inaccurate token
- int begin = problem.getSourceStart() >= source.length ? source.length - 1 : problem.getSourceStart();
- int relativeStart = 0;
- int end = problem.getSourceEnd() >= source.length ? source.length - 1 : problem.getSourceEnd();
- int relativeEnd = 0;
- label : for (relativeStart = 0;; relativeStart++) {
- if (begin == 0)
- break label;
- if ((source[begin - 1] == '\n') || (source[begin - 1] == '\r'))
- break label;
- begin--;
- }
- label : for (relativeEnd = 0;; relativeEnd++) {
- if ((end + 1) >= source.length)
- break label;
- if ((source[end + 1] == '\r') || (source[end + 1] == '\n')) {
- break label;
- }
- end++;
- }
- //extract the message form the source
- char[] extract = new char[end - begin + 1];
- System.arraycopy(source, begin, extract, 0, extract.length);
- char c;
- //remove all SPACE and TAB that begin the error message...
- int trimLeftIndex = 0;
- while (((c = extract[trimLeftIndex++]) == TAB) || (c == SPACE)) {
- };
- System.arraycopy(extract, trimLeftIndex - 1, extract = new char[extract.length - trimLeftIndex + 1], 0, extract.length);
- relativeStart -= trimLeftIndex;
- //buffer spaces and tabs in order to reach the error position
- int pos = 0;
- char[] underneath = new char[extract.length]; // can't be bigger
- for (int i = 0; i <= relativeStart; i++) {
- if (extract[i] == TAB) {
- underneath[pos++] = TAB;
- } else {
- underneath[pos++] = SPACE;
- }
- }
- //mark the error position
- for (int i = problem.getSourceStart(); i <= (problem.getSourceEnd() >= source.length ? source.length - 1 : problem.getSourceEnd()); i++)
- underneath[pos++] = MARK;
- //resize underneathto remove 'null' chars
- System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos);
- return
- ((problem.getSourceLineNumber() > 0) ?
- (" (at line " + String.valueOf(problem.getSourceLineNumber()) + ")") :
- ""
- ) +
- "\n\t" + new String(extract) + "\n\t" + new String(underneath);
-}
-protected GlobalVariable findVar(char[] varName) {
- GlobalVariable[] vars = this.context.allVariables();
- for (int i = 0; i < vars.length; i++) {
- GlobalVariable var = vars[i];
- if (CharOperation.equals(var.getName(), varName)) {
- return var;
- }
- }
- return null;
-}
-protected INameEnvironment getEnv() {
-
- return new FileSystem(COMPILATION_CLASSPATH, new String[0], null);
-}
-protected IProblemFactory getProblemFactory() {
- return new DefaultProblemFactory(java.util.Locale.getDefault());
-}
-protected void startEvaluationContext() throws TargetException {
- LocalVMLauncher launcher = LocalVMLauncher.getLauncher();
- launcher.setVMPath(JRE_PATH);
- launcher.setClassPath(RUNTIME_CLASSPATH);
- int evalPort = Util.nextAvailablePortNumber();
- launcher.setEvalPort(evalPort);
- launcher.setEvalTargetPath(TARGET_PATH);
- this.launchedVM = launcher.launch();
-
- (new Thread() {
- public void run() {
- try {
- java.io.InputStream in = SimpleTest.this.launchedVM.getInputStream();
- int read = 0;
- while (read != -1) {
- try {
- read = in.read();
- } catch (java.io.IOException e) {
- read = -1;
- }
- if (read != -1) {
- System.out.print((char)read);
- }
- }
- } catch (TargetException e) {
- }
- }
- }).start();
-
- (new Thread() {
- public void run() {
- try {
- java.io.InputStream in = SimpleTest.this.launchedVM.getErrorStream();
- int read = 0;
- while (read != -1) {
- try {
- read = in.read();
- } catch (java.io.IOException e) {
- read = -1;
- }
- if (read != -1) {
- System.out.print((char)read);
- }
- }
- } catch (TargetException e) {
- }
- }
- }).start();
-
- this.requestor = new Requestor();
- this.target = new TargetInterface();
- this.target.connect("localhost", evalPort, 10000);
- this.context = new EvaluationContext();
-}
-protected void stopEvaluationContext() throws TargetException {
- try {
- this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed.
- int retry = 0;
- while (this.launchedVM.isRunning() && (++retry < 20)) {
- try {
- Thread.sleep(retry * 100);
- } catch (InterruptedException e) {
- }
- }
- if (this.launchedVM.isRunning()) {
- this.launchedVM.shutDown();
- }
- this.context = null;
- } catch (TargetException e) {
- throw new Error(e.getMessage());
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleVariableTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleVariableTest.java
deleted file mode 100644
index 84ba2d5..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleVariableTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import org.eclipse.jdt.core.tests.runtime.TargetException;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-import org.eclipse.jdt.internal.eval.InstallException;
-
-public class SimpleVariableTest extends SimpleTest {
-void evaluateVariable() throws TargetException, InstallException {
- startEvaluationContext();
- GlobalVariable var = getVariable();
- INameEnvironment env = getEnv();
- this.context.evaluateVariables(env, null, this.requestor, getProblemFactory());
- this.context.deleteVariable(var);
- stopEvaluationContext();
-}
-public GlobalVariable getVariable() {
- return this.context.newVariable(
- "int".toCharArray(),
- "var".toCharArray(),
- "1".toCharArray());
-}
-public static void main(String[] args) throws TargetException, InstallException {
- SimpleVariableTest test = new SimpleVariableTest();
- test.evaluateVariable();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java
deleted file mode 100644
index 8f27194..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-/**
- * Run all tests defined in this package.
- */
-public class TestAll extends EvaluationTest {
-public TestAll(String name) {
- super(name);
-}
-public static Test suite() {
- return suite(JRE_PATH, EVAL_DIRECTORY);
-}
-public static Test suite(String jrePath, String evalDirectory) {
- TestSuite suite = new TestSuite(TestAll.class.getName());
- suite.addTest(suite(SanityTestEvaluationContext.class));
- suite.addTest(suite(SanityTestEvaluationResult.class));
- suite.addTest(suite(VariableTest.class));
- suite.addTest(suite(CodeSnippetTest.class));
- suite.addTest(suite(NegativeCodeSnippetTest.class));
- suite.addTest(suite(NegativeVariableTest.class));
- suite.addTest(suite(DebugEvaluationTest.class));
- EvaluationSetup evalSetup = new DebugEvaluationSetup(suite);
- evalSetup.jrePath = jrePath;
- evalSetup.evalDirectory = evalDirectory;
- return evalSetup;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/VariableTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/VariableTest.java
deleted file mode 100644
index 3628f2c..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/VariableTest.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.internal.eval.GlobalVariable;
-/**
- * Test the global variable evaluation.
- * This assumes that the EvaluationContext class and that the GlobalVariable class
- * are working correctly.
- */
-public class VariableTest extends EvaluationTest {
-/**
- * Creates a new EvaluationContextTest.
- */
-public VariableTest(String name) {
- super(name);
-}
-public static Test suite() {
- return setupSuite(testClass());
-}
-/**
- * Tests the individual evaluation of variables with expected values of all kind of types.
- */
-public void testAllKindOfValues() {
- try {
- // Creates the variables
- GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), "1".toCharArray());
- GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), "true".toCharArray());
- GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), "'c'".toCharArray());
- GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), "(float)1.0".toCharArray());
- GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), "1.0".toCharArray());
- GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), "(short)1".toCharArray());
- GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), "(long)1".toCharArray());
- GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), "\"hello\"".toCharArray());
- GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), buildCharArray(new String[] {
- "new Object() {",
- " public String toString() {",
- " return \"an object\";",
- " }",
- "}"}));
- GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
- // Install them
- installVariables(10);
-
- // Get values one by one
- evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
- evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
- evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
- evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
- evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
- evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
- evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
- evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
- evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
- evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
- } finally {
- // Clean up
- GlobalVariable[] vars = context.allVariables();
- for (int i = 0; i < vars.length; i++) {
- context.deleteVariable(vars[i]);
- }
- }
-}
-public static Class testClass() {
- return VariableTest.class;
-}
-/**
- * Tests the assignment of a global variable in a code snippet.
- */
-public void testCodeSnippetVarAssign() {
- try {
- // Creates the variables
- GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), null);
- GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), null);
- GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), null);
- GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), null);
- GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), null);
- GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), null);
- GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), null);
- GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), null);
- GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), null);
- GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
- // Install them
- installVariables(10);
-
- // Assign each of the variable and get its value
- evaluateWithExpectedDisplayString("var1 = 1;".toCharArray(), "1".toCharArray());
- evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-
- evaluateWithExpectedDisplayString("var2 = true;".toCharArray(), "true".toCharArray());
- evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
-
- evaluateWithExpectedDisplayString("var3 = 'c';".toCharArray(), "c".toCharArray());
- evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-
- evaluateWithExpectedDisplayString("var4 = (float)1.0;".toCharArray(), "1.0".toCharArray());
- evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-
- evaluateWithExpectedDisplayString("var5 = 1.0;".toCharArray(), "1.0".toCharArray());
- evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
-
- evaluateWithExpectedDisplayString("var6 = (short)1;".toCharArray(), "1".toCharArray());
- evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
-
- evaluateWithExpectedDisplayString("var7 = (long)1;".toCharArray(), "1".toCharArray());
- evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
-
- evaluateWithExpectedDisplayString("var8 = \"hello\";".toCharArray(), "hello".toCharArray());
- evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
-
- evaluateWithExpectedDisplayString(buildCharArray(new String[] {
- "var9 = new Object() {",
- " public String toString() {",
- " return \"an object\";",
- " }",
- "};"}), "an object".toCharArray());
- evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
-
- evaluateWithExpectedDisplayString("var10 = null;".toCharArray(), "null".toCharArray());
- evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
- } finally {
- // Clean up
- GlobalVariable[] vars = context.allVariables();
- for (int i = 0; i < vars.length; i++) {
- context.deleteVariable(vars[i]);
- }
- }
-}
-/**
- * Tests the retrieval of a global variable from a code snippet.
- */
-public void testCodeSnippetVarRetrieval() {
- try {
- // Creates the variables
- GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), "1".toCharArray());
- GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), "true".toCharArray());
- GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), "'c'".toCharArray());
- GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), "(float)1.0".toCharArray());
- GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), "1.0".toCharArray());
- GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), "(short)1".toCharArray());
- GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), "(long)1".toCharArray());
- GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), "\"hello\"".toCharArray());
- GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), buildCharArray(new String[] {
- "new Object() {",
- " public String toString() {",
- " return \"an object\";",
- " }",
- "}"}));
- GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
- // Install them
- installVariables(10);
-
- // Get values one by one
- evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
- evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
- evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
- evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
- evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
- evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
- evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
- evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
- evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
- evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
- } finally {
- // Clean up
- GlobalVariable[] vars = context.allVariables();
- for (int i = 0; i < vars.length; i++) {
- context.deleteVariable(vars[i]);
- }
- }
-}
-/**
- * Tests variables that include one or more imports.
- */
-public void testImports() {
- try {
- // import a package
- context.setImports(new char[][] {"java.io.*".toCharArray()});
- GlobalVariable file = context.newVariable("boolean".toCharArray(), "file".toCharArray(), "new File(\"!@#%\").exists()".toCharArray());
- installVariables(1);
- evaluateWithExpectedValue(file, "false".toCharArray(), "boolean".toCharArray());
- context.deleteVariable(file);
-
- // import a type
- context.setImports(new char[][] {"java.math.BigInteger".toCharArray()});
- GlobalVariable big = context.newVariable("BigInteger".toCharArray(), "big".toCharArray(), "new BigInteger(\"123456789012345678901234567890\")".toCharArray());
- installVariables(1);
- evaluateWithExpectedValue(big, "123456789012345678901234567890".toCharArray(), "java.math.BigInteger".toCharArray());
- context.deleteVariable(big);
-
- // import a type and a package
- context.setImports(new char[][] {"java.util.Enumeration".toCharArray(), "java.lang.reflect.*".toCharArray()});
- GlobalVariable fields = context.newVariable("Field[]".toCharArray(), "fields".toCharArray(), "Enumeration.class.getDeclaredFields()".toCharArray());
- installVariables(1);
- evaluateWithExpectedType("return fields;".toCharArray(), "[Ljava.lang.reflect.Field;".toCharArray());
- context.deleteVariable(fields);
- } finally {
- // clean up
- context.setImports(new char[0][]);
- }
-}
-/**
- * Tests the additions and deletion of variables, installing them each time.
- */
-public void testSeveralVariableInstallations() {
- try {
- // Creates 6 variables
- GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), "1".toCharArray());
- GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), "true".toCharArray());
- GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), "'c'".toCharArray());
- GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), "(float)1.0".toCharArray());
- GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), "1.0".toCharArray());
- GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), "(short)1".toCharArray());
-
- // Install the variables
- installVariables(6);
-
- // Get their values
- evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
- evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
- evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
- evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
- evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
- evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
-
- // Delete 3 variables
- context.deleteVariable(var2);
- context.deleteVariable(var5);
- context.deleteVariable(var6);
-
- // Install the variables
- installVariables(3);
-
- // Get their values
- evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
- evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
- evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-
- // Add 4 more variables
- GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), "(long)1".toCharArray());
- GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), "\"hello\"".toCharArray());
- GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), buildCharArray(new String[] {
- "new Object() {",
- " public String toString() {",
- " return \"an object\";",
- " }",
- "}"}));
- GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
- // Install the variables
- installVariables(7);
-
- // Change value of a variable using a code snippet and move it
- evaluateWithExpectedValue("var3 = 'z'; return var3;".toCharArray(), "z".toCharArray(), "char".toCharArray());
- context.deleteVariable(var3);
- var3 = context.newVariable(var3.getTypeName(), var3.getName(), var3.getInitializer());
-
- // Change the type of another variable to an incompatible type
- context.deleteVariable(var4);
- var4 = context.newVariable("java.net.URL".toCharArray(), "var4".toCharArray(), "new java.net.URL(\"http://www.ibm.com/index.html\")".toCharArray());
-
- // Upadte the variables
- installVariables(7);
-
- // Get their values
- evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
- evaluateWithExpectedValue(var3, "z".toCharArray(), "char".toCharArray());
- evaluateWithExpectedValue(var4, "http://www.ibm.com/index.html".toCharArray(), "java.net.URL".toCharArray());
- evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
- evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
- evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
- evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
- } finally {
- // Clean up
- GlobalVariable[] vars = context.allVariables();
- for (int i = 0; i < vars.length; i++) {
- context.deleteVariable(vars[i]);
- }
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java
deleted file mode 100644
index df0a5a0..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval.target;
-
-import java.util.*;
-
-/**
- * A code snippet class loader is a class loader that loads code snippet classes and global
- * variable classes.
- */
-public class CodeSnippetClassLoader extends ClassLoader {
- /**
- * Whether the code snippet support classes should be given by the IDE
- * or should be found on disk.
- */
- static boolean DEVELOPMENT_MODE = false;
-
- Hashtable loadedClasses = new Hashtable();
-/**
- * Asks the class loader that loaded this class to load the given class.
- * @throws a ClassNotFoundException if it could not be loaded.
- */
-private Class delegateLoadClass(String name) throws ClassNotFoundException {
- ClassLoader myLoader = getClass().getClassLoader();
- if (myLoader == null) {
- return Class.forName(name);
- } else {
- return myLoader.loadClass(name);
- }
-}
-/**
- * Loads the given class. If the class is known to this runner, returns it.
- * If only the class definition is known to this runner, makes it a class and returns it.
- * Otherwise delegates to the real class loader.
- */
-protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (DEVELOPMENT_MODE) {
- try {
- return delegateLoadClass(name);
- } catch (ClassNotFoundException e) {
- Class clazz = makeClass(name, resolve);
- if (clazz == null) {
- throw e;
- } else {
- return clazz;
- }
- }
- } else {
- Class clazz = makeClass(name, resolve);
- if (clazz == null) {
- return delegateLoadClass(name);
- } else {
- return clazz;
- }
- }
-}
-/**
- * Loads the given class either from the stored class definition or from the system.
- * Returns the existing class if it has already been loaded.
- * Returns null if no class definition can be found.
- */
-Class loadIfNeeded(String className) {
- Class clazz = null;
- if (!supportsHotCodeReplacement()) {
- clazz = findLoadedClass(className);
- }
- if (clazz == null) {
- try {
- clazz = loadClass(className, true);
- } catch (NoClassDefFoundError e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
- return clazz;
-}
-/**
- * Makes the class definition known by this code snippet runner a real class and
- * returns it.
- * Returns null if there is no class definition.
- */
-private Class makeClass(String name, boolean resolve) {
- Object o = this.loadedClasses.get(name);
- if (o == null) {
- return null;
- } else {
- if (o instanceof Class) {
- return (Class) o;
- } else {
- byte[] classDefinition = (byte[]) o;
- Class clazz = defineClass(null, classDefinition, 0, classDefinition.length);
- if (resolve) {
- resolveClass(clazz);
- }
- this.loadedClasses.put(name, clazz);
- return clazz;
- }
- }
-}
-/**
- * Stores the given class definition for the given class.
- */
-void storeClassDefinition(String className, byte[] classDefinition) {
- Object clazz = this.loadedClasses.get(className);
- if (clazz == null || supportsHotCodeReplacement()) {
- this.loadedClasses.put(className, classDefinition);
- }
-}
-/**
- * Returns whether this class loader supports Hot Code Replacement.
- */
-protected boolean supportsHotCodeReplacement() {
- return false;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
deleted file mode 100644
index aff68fc..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval.target;
-
-import java.lang.reflect.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * A code snippet runner loads code snippet classes and global
- * variable classes, and that run the code snippet classes.
- * <p>
- * When started, this runner first connects using TCP/IP to the provided port number.
- * If a regular classpath directory is provided, it writes the class definitions it gets from the IDE
- * to this directory (or to the bootclasspath directory if the class name starts with "java") and it
- * lets the system class loader (or the bootstrap class loader if it is a "java" class) load
- * the class.
- * If the regular classpath directory is null, it uses a code snippet class loader to load the classes
- * it gets from the IDE.
- * <p>
- * IMPORTANT NOTE:
- * Using a code snippet class loader has the following limitation when the code snippet is ran:
- * <ul>
- * <li>The code snippet class can access only public classes, and public members or these classes.
- * This is because the "runtime package" of the code snippet class is always different from
- * the "runtime package" of the class it is trying to access since the class loaders are
- * different.
- * <li>The code snippet class cannot be defined in a "java.*" package. Only the bootstrap class
- * loader can load such a class.
- * </ul>
- */
-public class CodeSnippetRunner {
- public static CodeSnippetRunner theRunner;
- static final String CODE_SNIPPET_CLASS_NAME = "org.eclipse.jdt.internal.eval.target.CodeSnippet";
- static final String RUN_METHOD_NAME = "run";
- static final String GET_RESULT_TYPE_METHOD_NAME = "getResultType";
- static final String GET_RESULT_VALUE_METHOD_NAME = "getResultValue";
-
- IDEInterface ide;
- String classPathDirectory;
- String bootclassPathDirectory;
- CodeSnippetClassLoader loader;
- Class codeSnippetClass = null;
-/**
- * Creates a new code snippet runner.
- */
-public CodeSnippetRunner(int portNumber, String classPathDirectory, String bootclassPathDirectory) {
- this.ide = new IDEInterface(portNumber);
- if (classPathDirectory != null) {
- this.classPathDirectory = classPathDirectory;
- if (bootclassPathDirectory != null) {
- this.bootclassPathDirectory = bootclassPathDirectory;
- }
- } else {
- this.loader = new CodeSnippetClassLoader();
- }
-}
-/**
- * Returns the forward slash separated class name from the given class definition.
- */
-private String className(byte[] classDefinition) {
- // NB: The following code was copied from org.eclipse.jdt.internal.compiler.cfmt,
- // thus it is highly dependent on the class file format.
- int readOffset = 10;
- try {
- int constantPoolCount = u2At(8, classDefinition);
- int[] constantPoolOffsets = new int[constantPoolCount];
- for (int i = 1; i < constantPoolCount; i++) {
- int tag = u1At(readOffset, classDefinition);
- switch (tag) {
- case 1 : // Utf8Tag
- constantPoolOffsets[i] = readOffset;
- readOffset += u2At(readOffset + 1, classDefinition);
- readOffset += 3; // ConstantUtf8.fixedSize
- break;
- case 3 : // IntegerTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 5; // ConstantInteger.fixedSize
- break;
- case 4 : // FloatTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 5; // ConstantFloat.fixedSize
- break;
- case 5 : // LongTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 9; // ConstantLong.fixedSize
- i++;
- break;
- case 6 : // DoubleTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 9; // ConstantDouble.fixedSize
- i++;
- break;
- case 7 : // ClassTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 3; // ConstantClass.fixedSize
- break;
- case 8 : // StringTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 3; // ConstantString.fixedSize
- break;
- case 9 : // FieldRefTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 5; // ConstantFieldRef.fixedSize
- break;
- case 10 : // MethodRefTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 5; // ConstantMethodRef.fixedSize
- break;
- case 11 : // InterfaceMethodRefTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 5; // ConstantInterfaceMethodRef.fixedSize
- break;
- case 12 : // NameAndTypeTag
- constantPoolOffsets[i] = readOffset;
- readOffset += 5; // ConstantNameAndType.fixedSize
- }
- }
- // Skip access flags
- readOffset += 2;
-
- // Read the classname, use exception handlers to catch bad format
- int constantPoolIndex = u2At(readOffset, classDefinition);
- int utf8Offset = constantPoolOffsets[u2At(constantPoolOffsets[constantPoolIndex] + 1, classDefinition)];
- char[] className = utf8At(utf8Offset + 3, u2At(utf8Offset + 1, classDefinition), classDefinition);
- return new String(className);
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- return null;
- }
-}
-/**
- * Creates a new instance of the given class. It is
- * assumed that it is a subclass of CodeSnippet.
- */
-Object createCodeSnippet(Class snippetClass) {
- Object object = null;
- try {
- object = snippetClass.newInstance();
- } catch (InstantiationException e) {
- e.printStackTrace();
- this.ide.sendResult(void.class, null);
- return null;
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- this.ide.sendResult(void.class, null);
- return null;
- }
- return object;
-}
-/**
- * Whether this code snippet runner is currently running.
- */
-public boolean isRunning() {
- return this.ide.isConnected();
-}
-/**
- * Starts a new CodeSnippetRunner that will serve code snippets from the IDE.
- * It waits for a connection on the given evaluation port number.
- * <p>
- * Usage: java org.eclipse.jdt.tests.eval.target.CodeSnippetRunner -evalport <portNumber> [-options] [<mainClassName>] [<arguments>]
- * where options include:
- * -cscp <codeSnippetClasspath> the the classpath directory for the code snippet classes.
- * that are not defined in a "java.*" package.
- * -csbp <codeSnippetBootClasspath> the bootclasspath directory for the code snippet classes
- * that are defined in a "java.*" package.
- * <p>
- * The mainClassName and its arguments are optional: when not present only the server will start
- * and run until the VM is shut down, when present the server will start, the main class will run
- * but the server will exit when the main class has finished running.
- */
-public static void main(String[] args) {
- int length = args.length;
- if (length < 2 || !args[0].toLowerCase().equals("-evalport")) {
- printUsage();
- return;
- } else {
- int evalPort = Integer.parseInt(args[1]);
- String classPath = null;
- String bootPath = null;
- int mainClass = -1;
- for (int i = 2; i < length; i++) {
- String arg = args[i];
- if (arg.startsWith("-")) {
- if (arg.toLowerCase().equals("-cscp")) {
- if (++i < length) {
- classPath = args[i];
- } else {
- printUsage();
- return;
- }
- } else if (arg.toLowerCase().equals("-csbp")) {
- if (++i < length) {
- bootPath = args[i];
- } else {
- printUsage();
- return;
- }
- }
- } else {
- mainClass = i;
- break;
- }
- }
- theRunner = new CodeSnippetRunner(evalPort, classPath, bootPath);
- if (mainClass == -1) {
- theRunner.start();
- } else {
- Thread server = new Thread() {
- public void run() {
- theRunner.start();
- }
- };
- server.setDaemon(true);
- server.start();
- int mainArgsLength = length-mainClass-1;
- String[] mainArgs = new String[mainArgsLength];
- System.arraycopy(args, mainClass+1, mainArgs, 0, mainArgsLength);
- try {
- Class clazz = Class.forName(args[mainClass]);
- Method mainMethod = clazz.getMethod("main", new Class[] {String[].class});
- mainMethod.invoke(null, new String[][] {mainArgs});
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- }
- }
- }
-}
-private static void printUsage() {
- System.out.println("Usage: java org.eclipse.jdt.tests.eval.target.CodeSnippetRunner -evalport <portNumber> [-options] [<mainClassName>] [<arguments>]");
- System.out.println("where options include:");
- System.out.println("-cscp <codeSnippetClasspath> the the classpath directory for the code snippet classes.");
- System.out.println("that are not defined in a \"java.*\" package.");
- System.out.println("-csbp <codeSnippetBootClasspath> the bootclasspath directory for the code snippet classes");
- System.out.println("that are defined in a \"java.*\" package.");
-}
-/**
- * Loads the given class definitions. The way these class definitions are loaded is described
- * in the CodeSnippetRunner constructor.
- * The class definitions are code snippet classes and/or global variable classes.
- * Code snippet classes are assumed be direct or indirect subclasses of CodeSnippet and implement
- * only the run()V method.
- * They are instanciated and run.
- * Global variable classes are assumed to be direct subclasses of CodeSnippet. Their fields are assumed
- * to be static. The value of each field is sent back to the IDE.
- */
-void processClasses(boolean mustRun, byte[][] classDefinitions) {
- // store the class definitions (either in the code snippet class loader or on disk)
- String[] newClasses = new String[classDefinitions.length];
- for (int i = 0; i < classDefinitions.length; i++) {
- byte[] classDefinition = classDefinitions[i];
- String classFileName = className(classDefinition);
- String className = classFileName.replace('/', '.');
- if (this.loader != null) {
- this.loader.storeClassDefinition(className, classDefinition);
- } else {
- writeClassOnDisk(classFileName, classDefinition);
- }
- newClasses[i] = className;
- }
-
- // load the classes and collect code snippet classes
- Vector codeSnippetClasses = new Vector();
- for (int i = 0; i < newClasses.length; i++) {
- String className = newClasses[i];
- Class clazz = null;
- if (this.loader != null) {
- clazz = this.loader.loadIfNeeded(className);
- if (clazz == null) {
- System.err.println("Could not find class definition for " + className);
- break;
- }
- } else {
- // use the system class loader
- try {
- clazz = Class.forName(className);
- } catch (ClassNotFoundException e) {
- e.printStackTrace(); // should never happen since we just wrote it on disk
- this.ide.sendResult(void.class, null);
- break;
- }
- }
-
- Class superclass = clazz.getSuperclass();
- Method[] methods = clazz.getDeclaredMethods();
- if (this.codeSnippetClass == null) {
- if (superclass.equals(Object.class) && clazz.getName().equals(CODE_SNIPPET_CLASS_NAME)) {
- // The CodeSnippet class is being deployed
- this.codeSnippetClass = clazz;
- } else {
- System.out.println("Expecting CodeSnippet class to be deployed first");
- }
- } else if (superclass.equals(this.codeSnippetClass)) {
- // It may be a code snippet class with no global variable
- if (methods.length == 1 && methods[0].getName().equals(RUN_METHOD_NAME)) {
- codeSnippetClasses.addElement(clazz);
- }
- // Evaluate global variables and send result back
- Field[] fields = clazz.getDeclaredFields();
- for (int j = 0; j < fields.length; j++) {
- Field field = fields[j];
- if (Modifier.isPublic(field.getModifiers())) {
- try {
- this.ide.sendResult(field.getType(), field.get(null));
- } catch (IllegalAccessException e) {
- e.printStackTrace(); // Cannot happen because the field is public
- this.ide.sendResult(void.class, null);
- break;
- }
- }
- }
- } else if (this.codeSnippetClass.equals(superclass.getSuperclass()) && methods.length == 1 && methods[0].getName().equals("run")) {
- // It is a code snippet class with a global variable superclass
- codeSnippetClasses.addElement(clazz);
- }
- }
-
- // run the code snippet classes
- if (codeSnippetClasses.size() != 0 && mustRun) {
- for (Enumeration e = codeSnippetClasses.elements(); e.hasMoreElements();) {
- Object codeSnippet = this.createCodeSnippet((Class) e.nextElement());
- if (codeSnippet != null) {
- this.runCodeSnippet(codeSnippet);
- }
- }
- }
-}
-/**
- * Runs the given code snippet in a new thread and send the result back to the IDE.
- */
-void runCodeSnippet(final Object snippet) {
- Thread thread = new Thread() {
- public void run() {
- try {
- try {
- Method runMethod = codeSnippetClass.getMethod(RUN_METHOD_NAME, new Class[] {});
- runMethod.invoke(snippet, new Object[] {});
- } finally {
- Method getResultTypeMethod = codeSnippetClass.getMethod(GET_RESULT_TYPE_METHOD_NAME, new Class[] {});
- Class resultType = (Class)getResultTypeMethod.invoke(snippet, new Object[] {});
- Method getResultValueMethod = codeSnippetClass.getMethod(GET_RESULT_VALUE_METHOD_NAME, new Class[] {});
- Object resultValue = getResultValueMethod.invoke(snippet, new Object[] {});
- CodeSnippetRunner.this.ide.sendResult(resultType, resultValue);
- }
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- System.out.println("codeSnippetClass = " + codeSnippetClass.getName());
- System.out.println("snippet.class = " + snippet.getClass().getName());
- Class superclass = snippet.getClass().getSuperclass();
- System.out.println("snippet.superclass = " + (superclass == null ? "null" : superclass.getName()));
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
-}
-/**
- * Starts this code snippet runner in a different thread.
- */
-public void start() {
- Thread thread = new Thread("Code snippet runner") {
- public void run() {
- try {
- ide.connect();
- } catch (IOException e) {
- e.printStackTrace();
- }
- while (ide.isConnected()) {
- try {
- processClasses(ide.getRunFlag(), ide.getNextClasses());
- } catch (Error e) {
- ide.sendResult(void.class, null);
- e.printStackTrace();
- } catch (RuntimeException e) {
- ide.sendResult(void.class, null);
- e.printStackTrace();
- }
- }
- };
- };
- thread.start();
-}
-/**
- * Stops this code snippet runner.
- */
-public void stop() {
- this.ide.disconnect();
-}
-private int u1At(int position, byte[] bytes) {
- return bytes[position] & 0xFF;
-}
-private int u2At(int position, byte[] bytes) {
- return ((bytes[position++] & 0xFF) << 8) + (bytes[position] & 0xFF);
-}
-private char[] utf8At(int readOffset, int bytesAvailable, byte[] bytes) {
- int x, y, z;
- int length = bytesAvailable;
- char outputBuf[] = new char[bytesAvailable];
- int outputPos = 0;
- while (length != 0) {
- x = bytes[readOffset++] & 0xFF;
- length--;
- if ((0x80 & x) != 0) {
- y = bytes[readOffset++] & 0xFF;
- length--;
- if ((x & 0x20) != 0) {
- z = bytes[readOffset++] & 0xFF;
- length--;
- x = ((x & 0x1F) << 12) + ((y & 0x3F) << 6) + (z & 0x3F);
- } else {
- x = ((x & 0x1F) << 6) + (y & 0x3F);
- }
- }
- outputBuf[outputPos++] = (char) x;
- }
-
- if (outputPos != bytesAvailable) {
- System.arraycopy(outputBuf, 0, (outputBuf = new char[outputPos]), 0, outputPos);
- }
- return outputBuf;
-}
-/**
- * Writes the given class definition on disk. The give name is the forward slash separated
- * fully qualified name of the class.
- */
-private void writeClassOnDisk(String className, byte[] classDefinition) {
- try {
- String fileName = className.replace('/', File.separatorChar) + ".class";
- File classFile = new File(
- (this.bootclassPathDirectory != null &&
- (className.startsWith("java") || className.replace('/', '.').equals(CODE_SNIPPET_CLASS_NAME))) ?
- this.bootclassPathDirectory :
- this.classPathDirectory, fileName);
- File parent = new File(classFile.getParent());
- parent.mkdirs();
- if (!parent.exists()) {
- throw new IOException("Could not create directory " + parent.getPath());
- }
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(classFile);
- out.write(classDefinition);
- } finally {
- if (out != null) {
- out.close();
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/IDEInterface.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/IDEInterface.java
deleted file mode 100644
index cadc9fa..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/IDEInterface.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.eval.target;
-
-import java.io.*;
-import java.net.*;
-/**
- * The interface to the IDE. When connected, it uses TCP/IP sockets
- * to get code snippet classes and global variable classes from the IDE.
- * It sends the result of the evaluation back using the same socket.
- * <p>
- * The format from the socket input stream is the following:
- * <pre>
- * [run flag: boolean coded on 1 byte]
- * [number of class files: int coded on 4 bytes]
- * *[
- * [length of class file: int coded on 4 bytes]
- * [class file: Java Class file format]
- * ]
- * </pre>
- * This sequence is infinitely repeated until the input socket stream is closed.
- * <p>
- * The format from the socket output stream is the following:
- * <pre>
- * [has result flag: 1 if there is a result, 0 otherwise]
- * if there is a result:
- * [fully qualified type name of result: utf8 encoded string]
- * [toString representation of result: utf8 encoded string]
- * </pre>
- * This sequence is infinitely repeated until the output socket stream is closed.
- */
-public class IDEInterface {
- /**
- * Whether timing info should be printed to stdout
- */
- static final boolean TIMING = false;
- long startTime;
-
- int portNumber = 0;
- Socket socket;
-/**
- * Creates a new IDEInterface.
- */
-IDEInterface(int portNumber) {
- this.portNumber = portNumber;
-}
-/**
- * Waits for a connection from the ide on the given port.
- * @throws IOException if the connection could not be established.
- */
-void connect() throws IOException {
- ServerSocket server = new ServerSocket(this.portNumber);
- this.socket = server.accept();
- this.socket.setTcpNoDelay(true);
- server.close();
-}
-/**
- * Disconnects this interface from the IDE.
- */
-void disconnect() {
- if (this.socket != null) {
- try {
- this.socket.close();
- } catch (IOException e2) {
- // Ignore
- }
- this.socket = null;
- }
-}
-/**
- * Returns the class definitions of the classes that compose the next code snippet to evaluate.
- */
-protected byte[][] getNextClasses() {
- if (this.socket == null) {
- return new byte[0][];
- }
- if (TIMING) {
- this.startTime = System.currentTimeMillis();
- }
- try {
- DataInputStream in = new DataInputStream(this.socket.getInputStream());
- int numberOfClasses = in.readInt();
- byte[][] result = new byte[numberOfClasses][];
- for (int i = 0; i < numberOfClasses; i++) {
- int lengthOfClassFile = in.readInt();
- byte[] classFile = new byte[lengthOfClassFile];
- int read = 0;
- while (read < lengthOfClassFile && read != -1) {
- read += in.read(classFile, read, lengthOfClassFile - read);
- }
- result[i] = classFile;
- }
- return result;
- } catch (IOException e) {
- // The socket has likely been closed on the other end, close this end too.
- disconnect();
- return new byte[0][];
- }
-}
-/**
- * Returns whether the code snippet classes that follow should be run or just loaded.
- */
-protected boolean getRunFlag() {
- if (this.socket == null) {
- return false;
- }
- if (TIMING) {
- this.startTime = System.currentTimeMillis();
- }
- try {
- DataInputStream in = new DataInputStream(this.socket.getInputStream());
- return in.readBoolean();
- } catch (IOException e) {
- // The socket has likely been closed on the other end, close this end too.
- disconnect();
- return false;
- }
-}
-/**
- * Returns whether this interface is connected to the IDE.
- */
-boolean isConnected() {
- return this.socket != null;
-}
-/**
- * Sends the result of the evaluation to the IDE.
- */
-protected void sendResult(Class resultType, Object resultValue) {
- if (this.socket == null) {
- return;
- }
- try {
- DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
- if (resultType == void.class) {
- out.writeBoolean(false);
- } else {
- out.writeBoolean(true);
- out.writeUTF(resultType.isPrimitive() ? resultType.toString() : resultType.getName());
- out.writeUTF(resultValue == null ? "null" : resultValue.toString());
- }
- } catch (IOException e) {
- // The socket has likely been closed on the other end, disconnect this end too
- disconnect();
- }
- if (TIMING) {
- System.out.println("Time to run on target is " + (System.currentTimeMillis() - this.startTime) + "ms");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/ExcludedTestSuite.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/ExcludedTestSuite.java
deleted file mode 100644
index a5abe0a..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/ExcludedTestSuite.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.junit.extension;
-
-import junit.framework.*;
-public class ExcludedTestSuite extends TestSuite {
- String[] excludedTests = null;
-/**
- * Creates a new test suite by excluding the given tests
- * from the given test suite.
- */
-public ExcludedTestSuite(Test suite, String[] excludedTests) {
- this.excludedTests = excludedTests;
- this.addTest(suite);
-}
-/**
- * Adds a test to the suite.
- */
-public void addTest(Test test) {
- if (test instanceof TestCase) {
- if (!isExcluded((TestCase)test)) {
- super.addTest(test);
- }
- } else if (test instanceof TestSuite) {
- java.util.Enumeration enum = ((TestSuite)test).tests();
- while (enum.hasMoreElements()) {
- this.addTest((Test)enum.nextElement());
- }
- }
-}
-/**
- * Returns whether the test is excluded.
- */
-public boolean isExcluded(TestCase test) {
- if (this.excludedTests == null) {
- return false;
- }
- for (int i = 0; i < this.excludedTests.length; i += 2) {
- String className = this.excludedTests[i];
- String methodName = this.excludedTests[i+1];
- if (test.getName().equals(methodName) &&
- test.getClass().getName().endsWith(className)) {
- return true;
- }
- }
- return false;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/StopableTestCase.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/StopableTestCase.java
deleted file mode 100644
index 7cb5a2b..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/StopableTestCase.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.junit.extension;
-
-/**
- * A test case that is being sent stop() when the user presses 'Stop' or 'Exit'.
- */
-public class StopableTestCase extends TestCase {
-public StopableTestCase(String name) {
- super(name);
-}
-/**
- * Default is to do nothing.
- */
-public void stop() {
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java
deleted file mode 100644
index 9563dc8..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.junit.extension;
-
-import junit.framework.ComparisonFailure;
-
-public class TestCase extends junit.framework.TestCase {
- public TestCase(String name) {
- super(name);
- }
-public static void assertEquals(String expected, String actual) {
- assertEquals(null, expected, actual);
-}
-public static void assertEquals(String message, String expected, String actual) {
- if (expected == null && actual == null)
- return;
- if (expected != null && expected.equals(actual))
- return;
- String formatted;
- if (message != null) {
- formatted = message+"."; //$NON-NLS-1$
- } else {
- formatted = ""; //$NON-NLS-1$
- }
- expected = expected == null ? null : showLineSeparators(expected);
- actual = actual == null ? null : showLineSeparators(actual);
- formatted =
- formatted
- + "\n----------- Expected ------------\n" //$NON-NLS-1$
- + expected
- + "\n------------ but was ------------\n" //$NON-NLS-1$
- + actual
- + "\n--------- Difference is ----------\n" //$NON-NLS-1$
- + new ComparisonFailure(null, expected, actual).getMessage();
- fail(formatted);
-}
-/*
- * Shows the line separators in the given String.
- */
-protected static String showLineSeparators(String string) {
- StringBuffer buffer = new StringBuffer();
- int length = string.length();
- for (int i = 0; i < length; i++) {
- char car = string.charAt(i);
- switch (car) {
- case '\n':
- buffer.append("\\n\n"); //$NON-NLS-1$
- break;
- case '\r':
- if (i < length-1 && string.charAt(i+1) == '\n') {
- buffer.append("\\r\\n\n"); //$NON-NLS-1$
- i++;
- } else {
- buffer.append("\\r\n"); //$NON-NLS-1$
- }
- break;
- default:
- buffer.append(car);
- break;
- }
- }
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestListener.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestListener.java
deleted file mode 100644
index e4802c5..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.junit.extension;
-
-import junit.framework.Test;
-import junit.framework.TestFailure;
-/**
- * A Listener for test progress
- */
-public interface TestListener extends junit.framework.TestListener {
- /**
- * An error occurred.
- */
- public void addError(Test test, TestFailure testFailure);
- /**
- * A failure occurred.
- */
- public void addFailure(Test test, TestFailure testFailure);
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestResult.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestResult.java
deleted file mode 100644
index 0a1091a..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestResult.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.junit.extension;
-
-import java.util.*;
-import junit.framework.*;
-
-public class TestResult extends junit.framework.TestResult {
- TestCase currentTest;
-/**
- * TestResult constructor comment.
- */
-public TestResult() {
- super();
-}
- /**
- * Adds an error to the list of errors. The passed in exception
- * caused the error.
- */
- public synchronized void addError(Test test, Throwable t) {
- TestFailure testFailure= new TestFailure(test, t);
- fErrors.addElement(testFailure);
- for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
- ((TestListener)e.nextElement()).addError(test, testFailure);
- }
- }
- /**
- * Adds a failure to the list of failures. The passed in exception
- * caused the failure.
- */
- public synchronized void addFailure(Test test, AssertionFailedError t) {
- TestFailure testFailure= new TestFailure(test, t);
- fFailures.addElement(testFailure);
- for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
- ((TestListener)e.nextElement()).addFailure(test, testFailure);
- }
- }
- /**
- * Returns a copy of the listeners.
- */
- private synchronized Vector cloneListeners() {
- return (Vector)fListeners.clone();
- }
- protected void run(final TestCase test) {
- this.currentTest = test;
- super.run(test);
- this.currentTest = null;
- }
-public synchronized void stop() {
- super.stop();
- if (this.currentTest != null && this.currentTest instanceof StopableTestCase) {
- ((StopableTestCase)this.currentTest).stop();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java
deleted file mode 100644
index a21c441..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-/**
- * An abstract reader that continuously reads.
- */
-
-abstract public class AbstractReader {
- protected String name;
- protected Thread readerThread;
- protected boolean isStopping= false;
-/*
- * Creates a new reader with the given name.
- */
-public AbstractReader(String name) {
- this.name = name;
-}
-/**
- * Continuously reads. Note that if the read involves waiting
- * it can be interrupted and a InterruptedException will be thrown.
- */
-abstract protected void readerLoop();
-/**
- * Start the thread that reads events.
- *
- */
-public void start() {
- this.readerThread = new Thread(
- new Runnable() {
- public void run () {
- readerLoop();
- }
- },
- AbstractReader.this.name);
- this.readerThread.start();
-}
-/**
- * Tells the reader loop that it should stop.
- */
-public void stop() {
- this.isStopping= true;
- if (this.readerThread != null)
- this.readerThread.interrupt();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VMLauncher.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VMLauncher.java
deleted file mode 100644
index e5fed9b..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VMLauncher.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import java.io.*;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.tests.util.Util;
-
-/**
- * A J9 VM launcher launches an external J9 VM (and J9 Proxy if needed) with
- * the given arguments on the same machine.
- * <p>
- * Unlike with the <code>StandardVMLauncher</code>, a debugger would have to
- * connect to the J9 Proxy instead of connecting to the VM directly. In this case,
- * the Proxy port is the specified debug port. Note that an internal debug port
- * must also be specified. This port is used for the communication between the
- * Proxy and the VM.
- */
-public class J9VMLauncher extends LocalVMLauncher implements RuntimeConstants {
- int internalDebugPort = -1;
- String proxyOutFile;
- String symbolPath;
-/**
- * Creates a new J9VMLauncher that launches a J9 VM
- * (and J9 Proxy if needed) on the same machine.
- */
-public J9VMLauncher() {
- super();
-}
-/**
- * Builds the actual boot class path that is going to be passed to the VM.
- */
-protected String buildBootClassPath() {
- StringBuffer bootPathString = new StringBuffer();
- char pathSeparator = File.pathSeparatorChar;
-
- if (this.bootPath != null) {
- // Add boot class path given by client
- int length = this.bootPath.length;
- for (int i = 0; i < length; i++){
- bootPathString.append(this.bootPath[i]);
- bootPathString.append(pathSeparator);
- }
- } else {
- // Add regular classes.zip
- bootPathString.append(this.vmPath);
- bootPathString.append(File.separator);
- bootPathString.append("lib");
- bootPathString.append(File.separator);
- bootPathString.append("jclMax");
- bootPathString.append(File.separator);
- bootPathString.append("classes.zip");
- bootPathString.append(pathSeparator);
- }
-
- // Add boot class path directory if needed
- if (this.evalTargetPath != null && TARGET_HAS_FILE_SYSTEM) {
- bootPathString.append(this.evalTargetPath);
- bootPathString.append(File.separatorChar);
- bootPathString.append(BOOT_CLASSPATH_DIRECTORY);
- }
-
- return bootPathString.toString();
-}
-/**
- * @see LocalVMLauncher#execCommandLine
- */
-protected Process execCommandLine() throws TargetException {
- // Check that the internal debug port has been specified if in debug mode
- if (this.debugPort != -1 && this.internalDebugPort == -1) {
- throw new TargetException("Internal debug port has not been specified");
- }
-
- return super.execCommandLine();
-}
-/**
- * @see LocalVMLauncher#getCommandLine
- */
-public String[] getCommandLine() {
- Vector commandLine = new Vector();
-
- // VM binary
- commandLine.addElement(
- this.vmPath +
- (this.vmPath.endsWith(File.separator) ? "" : File.separator) +
- "bin" +
- File.separator +
- "j9");
-
- // VM arguments
- if (this.vmArguments != null) {
- for (int i = 0; i < this.vmArguments.length; i++) {
- commandLine.addElement(this.vmArguments[i]);
- }
- }
-
- // debug mode
- if (this.debugPort != -1 && this.internalDebugPort != -1) {
- commandLine.addElement("-debug:" + this.internalDebugPort);
- }
-
- // boot class path
- commandLine.addElement("-Xbootclasspath:" + buildBootClassPath());
-
- // regular class path
- commandLine.addElement("-classpath");
- commandLine.addElement(buildClassPath());
-
- // code snippet runner class
- if (this.evalPort != -1) {
- commandLine.addElement(CODE_SNIPPET_RUNNER_CLASS_NAME);
- }
-
- // code snippet runner arguments
- if (this.evalPort != -1) {
- commandLine.addElement(EVALPORT_ARG);
- commandLine.addElement(Integer.toString(this.evalPort));
- if (TARGET_HAS_FILE_SYSTEM) {
- commandLine.addElement(CODESNIPPET_CLASSPATH_ARG);
- commandLine.addElement(this.evalTargetPath + File.separator + REGULAR_CLASSPATH_DIRECTORY);
- commandLine.addElement(CODESNIPPET_BOOTPATH_ARG);
- commandLine.addElement(this.evalTargetPath + File.separator + BOOT_CLASSPATH_DIRECTORY);
- }
- }
-
- // program class
- if (this.programClass != null) {
- commandLine.addElement(this.programClass);
- }
-
- // program arguments
- if (this.programArguments != null) {
- for (int i=0;i<this.programArguments.length;i++) {
- commandLine.addElement(this.programArguments[i]);
- }
- }
-
- String[] result= new String[commandLine.size()];
- commandLine.copyInto(result);
-
- // check for spaces in result
- for (int i = 0; i < result.length; i++) {
- String argument = result[i];
- if (argument.indexOf(' ') != -1) {
- result[i] = "\"" + argument + "\"";
- }
- }
-
- return result;
-}
-/**
- * Returns the debug port the J9 Proxy uses to connect to the J9 VM.
- * The value is unspecified if debug mode is disabled.
- * Note that the regular debug port is the port used to connect the J9 Proxy and
- * the IDE in the case of the J9 VM Launcher.
- */
-public int getInternalDebugPort() {
- return this.internalDebugPort;
-}
-/**
- * Returns the command line which will be used to launch the Proxy.
- */
-public String[] getProxyCommandLine() {
- Vector commandLine = new Vector();
-
- // Proxy binary
- commandLine.addElement(
- this.vmPath +
- (this.vmPath.endsWith(File.separator) ? "" : File.separator) +
- "bin" +
- File.separator +
- "j9proxy");
-
- // Arguments
- commandLine.addElement(getTargetAddress() + ":" + this.internalDebugPort);
- commandLine.addElement(Integer.toString(this.debugPort));
- if (this.symbolPath != null && this.symbolPath != "") {
- commandLine.addElement(this.symbolPath);
- }
-
- String[] result= new String[commandLine.size()];
- commandLine.copyInto(result);
- return result;
-}
-/**
- * Returns the full path name to the file where the proxy output is redirected.
- * Returns "con" if the proxy output is redirected to the stdout.
- * Returns null if the proxy output is not redirected.
- */
-public String getProxyOutFile() {
- return this.proxyOutFile;
-}
-/**
- * Returns the full path name to the symbol file used by the J9 Proxy.
- * Returns null if the no symbol file is passed to the J9 Proxy.
- */
-public String getSymbolPath() {
- return this.symbolPath;
-}
-/**
- * @see LocalVMLauncher#launch
- */
-public LocalVirtualMachine launch() throws TargetException {
- // Launch VM
- LocalVirtualMachine localVM = (LocalVirtualMachine)super.launch();
-
- // Launch Proxy if needed
- Process proxyProcess= null;
- if (this.debugPort != -1) {
- try {
- // Use Runtime.exec(String[]) with tokens because Runtime.exec(String) with commandLineString
- // does not properly handle spaces in arguments on Unix/Linux platforms.
- String[] commandLine = getProxyCommandLine();
-
- // DEBUG
- /*
- for (int i = 0; i < commandLine.length; i++) {
- System.out.print(commandLine[i] + " ");
- }
- System.out.println();
- */
-
- proxyProcess= Runtime.getRuntime().exec(commandLine);
- } catch (IOException e) {
- localVM.shutDown();
- throw new TargetException("Error launching J9 Proxy at " + this.vmPath);
- }
- }
-
- // Transform launched VM into J9 VM
- Process vmProcess = localVM.process;
- this.runningVMs.removeElement(localVM);
- J9VirtualMachine vm= new J9VirtualMachine(vmProcess, this.debugPort, this.evalTargetPath, proxyProcess, this.proxyOutFile);
- this.runningVMs.addElement(vm);
- return vm;
-}
-/* (non-Javadoc)
- * @see org.eclipse.jdt.core.tests.runtime.LocalVMLauncher#setDebugPort(int)
- */
-public void setDebugPort(int debugPort) {
- super.setDebugPort(debugPort);
-
- // specify default internal debug port as well
- this.setInternalDebugPort(Util.nextAvailablePortNumber());
-}
-
-/**
- * Sets the debug port the J9 Proxy uses to connect to the J9 VM.
- * This is mandatory if debug mode is enabled.
- * This is ignored if debug mode is disabled.
- * Note that the regular debug port is the port used to connect the J9 Proxy and
- * the IDE in the case of the J9 VM Launcher.
- */
-public void setInternalDebugPort(int internalDebugPort) {
- this.internalDebugPort = internalDebugPort;
-}
-/**
- * Sets the full path name to the file where the proxy output must be redirected.
- * Specify "con" if the proxy output must be redirected to the stdout.
- * Specify null if the proxy output must not be redirected (default value).
- * This is ignored if debug mode is disabled.
- */
-public void setProxyOutFile(String proxyOutFile) {
- this.proxyOutFile = proxyOutFile;
-}
-/**
- * Sets the full path name to the symbol file used by the J9 Proxy.
- * Specify null if the no symbol file must be passed to the J9 Proxy (default value).
- * This is ignored if debug mode is disabled.
- */
-public void setSymbolPath(String symbolPath) {
- this.symbolPath = symbolPath;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
deleted file mode 100644
index 1d631dd..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-/**
- * Wrapper around the external processes that are running a J9 VM
- * and a J9 Proxy.
- * This allows to kill these processes when we exit this vm.
- */
-class J9VirtualMachine extends LocalVirtualMachine {
- private Process proxyProcess;
- private AbstractReader proxyConsoleReader;
- private String proxyOutputFile;
-/**
- * Creates a new J9VirtualMachine from the Processes that runs this VM
- * and its J9 Proxy and with the given info.
- */
-public J9VirtualMachine(Process vmProcess, int debugPort, String evalTargetPath, Process proxyProcess, String proxyOutputFile) {
- super(vmProcess, debugPort, evalTargetPath);
- this.proxyProcess = proxyProcess;
- this.proxyOutputFile = proxyOutputFile;
-
- // Start the Proxy console reader so that the proxy is not blocked on its stdout.
- if (this.proxyProcess != null) {
- if (this.proxyOutputFile == null) {
- this.proxyConsoleReader=
- new NullConsoleReader(
- "J9 Proxy Console Reader",
- this.proxyProcess.getInputStream());
- } else {
- this.proxyConsoleReader=
- new ProxyConsoleReader(
- "J9 Proxy Console Reader",
- this.proxyProcess.getInputStream(),
- this.proxyOutputFile);
- }
- this.proxyConsoleReader.start();
- }
-
-}
-private boolean isProxyRunning() {
- if (this.proxyProcess == null)
- return false;
- else {
- boolean hasExited;
- try {
- this.proxyProcess.exitValue();
- hasExited = true;
- } catch (IllegalThreadStateException e) {
- hasExited = false;
- }
- return !hasExited;
- }
-}
-/**
- * @see LocalVirtualMachine#shutDown
- */
-public void shutDown() throws TargetException {
- super.shutDown();
- if (this.proxyConsoleReader != null)
- this.proxyConsoleReader.stop();
- if ((this.proxyProcess != null) && isProxyRunning())
- this.proxyProcess.destroy();
-}
-/**
- * @see LocalVirtualMachine#shutDown
- */
-public void waitForTermination() throws InterruptedException {
- super.waitForTermination();
- if (this.proxyProcess != null)
- this.proxyProcess.waitFor();
- if (this.proxyConsoleReader != null)
- this.proxyConsoleReader.stop();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java
deleted file mode 100644
index 91228e1..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * The root of the VM launchers that launch VMs on the same machine.
- * <p>
- * A local VM launcher has the following limitations:
- * <ul>
- * <li>It can only retrieve the running virtual machines that it has launched. So if
- * a client is using 2 instances of <code>LocalVMLauncher</code>, each of these
- * instances will be able to retrieve only a part of the running VMs.
- * </ul>
- */
-public abstract class LocalVMLauncher implements RuntimeConstants {
-
- /**
- * Whether the target has a file system and thus whether it supports writing
- * class files to disk. See org.eclipse.jdt.core.tests.eval.target.CodeSnippetRunner for more
- * information.
- */
- public static final boolean TARGET_HAS_FILE_SYSTEM = true;
- public static final String REGULAR_CLASSPATH_DIRECTORY = "regularPath";
- public static final String BOOT_CLASSPATH_DIRECTORY = "bootPath";
-
- protected String[] bootPath;
- protected String[] classPath;
- protected int debugPort = -1;
- protected int evalPort = -1;
- protected String evalTargetPath;
- protected String[] programArguments;
- protected String programClass;
- protected Vector runningVMs = new Vector(); // a Vector of LocalVirtualMachine
- protected String[] vmArguments;
- protected String vmPath;
-
-/**
- * Returns a launcher that will launch the same kind of VM that is currently running
- */
-public static LocalVMLauncher getLauncher() {
- if ("J9".equals(System.getProperty("java.vm.name"))) {
- return new J9VMLauncher();
- } else {
- return new StandardVMLauncher();
- }
-}
-/**
- * Builds the actual class path that is going to be passed to the VM.
- */
-protected String buildClassPath() {
- StringBuffer classPathString = new StringBuffer();
- char pathSeparator = File.pathSeparatorChar;
-
- // Add jar support if in evaluation mode
- if (this.evalPort != -1) {
- classPathString.append(new File(this.evalTargetPath, SUPPORT_ZIP_FILE_NAME).getPath());
- classPathString.append(pathSeparator);
- }
-
- // Add class path given by client
- if (this.classPath != null) {
- int length = this.classPath.length;
- for (int i = 0; i < length; i++){
- classPathString.append(this.classPath[i]);
- classPathString.append(pathSeparator);
- }
- }
-
- // Add regular classpath directory if needed
- if (this.evalPort != -1 && TARGET_HAS_FILE_SYSTEM) {
- classPathString.append(this.evalTargetPath);
- classPathString.append(File.separatorChar);
- classPathString.append(REGULAR_CLASSPATH_DIRECTORY);
- }
-
- return classPathString.toString();
-}
-/**
- * Launches the VM by exec'ing the command line and returns the resulting Process.
- */
-protected Process execCommandLine() throws TargetException {
- // Check that the VM path has been specified
- if (this.vmPath == null) {
- throw new TargetException("Path to the VM has not been specified");
- }
-
- // Check that the program class has been specified if not in evaluation mode
- if ((this.programClass == null) && (this.evalPort == -1)) {
- throw new TargetException("Program class has not been specified");
- }
-
- // Launch VM
- Process vmProcess= null;
- try {
- // Use Runtime.exec(String[]) with tokens because Runtime.exec(String) with commandLineString
- // does not properly handle spaces in arguments on Unix/Linux platforms.
- String[] commandLine = getCommandLine();
-
- // DEBUG
- /*for (int i = 0; i < commandLine.length; i++) {
- System.out.print(commandLine[i] + " ");
- }
- System.out.println();
- */
-
- vmProcess= Runtime.getRuntime().exec(commandLine);
- } catch (IOException e) {
- throw new TargetException("Error launching VM at " + this.vmPath);
- }
- return vmProcess;
-}
-/**
- * Returns the boot class path used when a VM is launched.
- */
-public String[] getBootClassPath() {
- return this.bootPath;
-}
-/**
- * Returns the class path used when a VM is launched.
- */
-public String[] getClassPath() {
- return this.classPath;
-}
-/**
- * Returns the command line which will be used to launch the VM.
- * The segments are in the following order:
- * <p><ul>
- * <li> VM path,
- * <li> VM arguments,
- * <li> the class path,
- * <li> the program class
- * <li> the program arguments
- * </ul>
- */
-public abstract String[] getCommandLine();
-/**
- * Returns the debug port, or -1 if debug mode is disabled.
- * The default is -1.
- */
-public int getDebugPort() {
- return this.debugPort;
-}
-/**
- * Returns the evaluation port for evaluation support.
- * The default is -1, indicating no evaluation support.
- *
- * @see setEvalPort
- */
-public int getEvalPort() {
- return this.evalPort;
-}
-/**
- * Returns the evaluation target path for evaluation support.
- *
- * @see setEvalTargetPath
- */
-public String getEvalTargetPath() {
- return this.evalTargetPath;
-}
-/**
- * Returns the arguments passed to the program class.
- * Returns null if the VM is being launched for evaluation support only.
- */
-public String[] getProgramArguments() {
- if (this.evalPort != -1) {
- return null;
- } else {
- return this.programArguments;
- }
-}
-/**
- * Returns the dot-separated, fully qualified name of the class to run.
- * It must implement main(String[] args).
- * Returns null if the VM is being launched for evaluation support only.
- */
-public String getProgramClass() {
- if (this.evalPort != -1) {
- return null;
- } else {
- return this.programClass;
- }
-}
-/**
- * Returns all the target VMs that are running at this launcher's target
- * address.
- * Note that these target VMs may or may not have been launched by this
- * launcher.
- * Note also that if the list of running VMs doesn't change on the target,
- * two calls to this method return VMs that are equal.
- *
- * @return the list of running target VMs
- * @exception TargetException if the target VMs could not be retrieved.
- */
-public LocalVirtualMachine[] getRunningVirtualMachines() throws TargetException {
- // Select the VMs that are actually running
- Vector actuallyRunning = new Vector();
- Enumeration enum = this.runningVMs.elements();
- while (enum.hasMoreElements()) {
- LocalVirtualMachine vm = (LocalVirtualMachine)enum.nextElement();
- if (vm.isRunning())
- actuallyRunning.addElement(vm);
- }
- this.runningVMs = actuallyRunning;
-
- // Return the running VMs
- int size = actuallyRunning.size();
- LocalVirtualMachine[] result = new LocalVirtualMachine[size];
- for (int i=0; i<size; i++)
- result[i] = (LocalVirtualMachine)actuallyRunning.elementAt(i);
- return result;
-}
-/**
- * Returns the address of the target where this launcher runs the target VMs. The format
- * of this address is transport specific.
- * For example, a VM launcher using a TCP/IP transport returns target addresses looking like:
- * <code>"localhost:2010"</code>, or <code>"joe.ibm.com"</code>.
- *
- * @return transport specific address of the target
- */
-public String getTargetAddress() {
- return "localhost";
-}
-/**
- * Returns the VM-specific arguments. This does not include:
- * <p><ul>
- * <li>the VM path
- * <li>the class path or the boot class path
- * <li>the program class or program arguments
- * </ul>
- */
-public String[] getVMArguments() {
- return this.vmArguments;
-}
-/**
- * Returns the path on disk of the VM to launch.
- */
-public String getVMPath() {
- return this.vmPath;
-}
-/**
- * Initializes this context's target path by copying the jar file for the code snippet support
- * and by creating the 2 directories that will contain the code snippet classes (see TARGET_HAS_FILE_SYSTEM).
- * Add the code snipport root class to the boot path directory so that code snippets can be run in
- * java.* packages
- *
- * @throws TargetException if the path could not be initialized with the code snippet support
- */
-protected void initTargetPath() throws TargetException {
- // create directories
- File directory = new File(this.evalTargetPath);
- directory.mkdirs();
- if (!directory.exists()) {
- throw new TargetException("Could not create directory " + this.evalTargetPath);
- }
- if (TARGET_HAS_FILE_SYSTEM) {
- File classesDirectory = new File(directory, REGULAR_CLASSPATH_DIRECTORY);
- classesDirectory.mkdir();
- if (!classesDirectory.exists()) {
- throw new TargetException("Could not create directory " + classesDirectory.getPath());
- }
- File bootDirectory = new File(directory, BOOT_CLASSPATH_DIRECTORY);
- bootDirectory.mkdir();
- if (!bootDirectory.exists()) {
- throw new TargetException("Could not create directory " + bootDirectory.getPath());
- }
- /*
- // add the code snippet root class to the boot path directory
- InputStream in = null;
- try {
- in = EvaluationContext.class.getResourceAsStream("/" + SUPPORT_ZIP_FILE_NAME);
- ZipInputStream zip = new ZipInputStream(in);
- String rootClassFileName = ROOT_FULL_CLASS_NAME.replace('.', '/') + ".class";
- while (true) {
- ZipEntry entry = zip.getNextEntry();
- if (entry.getName().equals(rootClassFileName)) {
- // read root class file contents
- int size = (int)entry.getSize();
- byte[] buffer = new byte[size];
- int totalRead = 0;
- int read = 0;
- while (totalRead < size) {
- read = zip.read(buffer, totalRead, size - totalRead);
- if (read != -1) {
- totalRead += read;
- }
- }
- // write root class file contents
- FileOutputStream out = null;
- try {
- File rootFile = new File(bootDirectory, rootClassFileName.replace('/', File.separatorChar));
- File parent = new File(rootFile.getParent());
- parent.mkdirs();
- out = new FileOutputStream(rootFile);
- out.write(buffer);
- out.close();
- } catch (IOException e) {
- e.printStackTrace();
- if (out != null) {
- try {
- out.close();
- } catch (IOException e2) {
- }
- }
- }
- break;
- }
- }
- in.close();
- } catch (IOException e) {
- e.printStackTrace();
- if (in != null) {
- try {
- in.close();
- } catch (IOException e2) {
- }
- }
- }*/
- }
-
- // copy jar file
- InputStream in = null;
- FileOutputStream out = null;
- try {
- in = this.getClass().getResourceAsStream("/" + SUPPORT_ZIP_FILE_NAME);
- if (in == null) {
- throw new TargetException("Could not find resource /" + SUPPORT_ZIP_FILE_NAME);
- }
- int bufferLength = 1024;
- byte[] buffer = new byte[bufferLength];
- File file = new File(directory, SUPPORT_ZIP_FILE_NAME);
- out = new FileOutputStream(file);
- int read = 0;
- while (read != -1) {
- read = in.read(buffer, 0, bufferLength);
- if (read != -1) {
- out.write(buffer, 0, read);
- }
- }
- } catch (IOException e) {
- throw new TargetException("IOException while copying " + SUPPORT_ZIP_FILE_NAME + ": " + e.getMessage());
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- }
- }
- }
-}
-/**
- * Launches a new target VM with the registered arguments.
- * This operation returns once a new target VM has been launched.
- *
- * @exception TargetException if the target VM could not be launched.
- */
-public LocalVirtualMachine launch() throws TargetException {
- // evaluation mode
- if (this.evalTargetPath != null) {
- // init target path
- this.initTargetPath();
- }
-
- // launch VM
- LocalVirtualMachine vm;
- Process p = execCommandLine();
- vm = new LocalVirtualMachine(p, this.debugPort, this.evalTargetPath);
-
- // TBD: Start reading VM stdout and stderr right away otherwise this may prevent the connection
- // from happening.
-
- // add VM to list of known running VMs
- this.runningVMs.addElement(vm);
- return vm;
-}
-/**
- * Sets the boot class path used when a VM is launched.
- */
-public void setBootClassPath(java.lang.String[] bootClassPath) {
- this.bootPath = bootClassPath;
-}
-/**
- * Sets the class path used when a VM is launched.
- */
-public void setClassPath(String[] classPath) {
- this.classPath = classPath;
-}
-/**
- * Sets the debug port to use for debug support.
- * Specify -1 to disable debug mode.
- */
-public void setDebugPort(int debugPort) {
- this.debugPort = debugPort;
-}
-/**
- * Sets the evaluation port to use for evaluation support.
- * Setting the port enables evaluation support.
- * Specify null to disable evaluation support.
- */
-public void setEvalPort(int evalPort) {
- this.evalPort = evalPort;
-}
-/**
- * Sets the evaluation target path to use for evaluation support.
- */
-public void setEvalTargetPath(String evalTargetPath) {
- this.evalTargetPath = evalTargetPath;
-}
-/**
- * Sets the arguments passed to the program class.
- * This is ignored if the VM is being launched for evaluation support only.
- */
-public void setProgramArguments(String[] args) {
- this.programArguments = args;
-}
-/**
- * Sets the dot-separated, fully qualified name of the class to run.
- * It must implement main(String[] args).
- * This is ignored if the VM is being launched for evaluation support only.
- */
-public void setProgramClass(String programClass) {
- this.programClass = programClass;
-}
-/**
- * Sets the VM-specific arguments. This does not include:
- * <p><ul>
- * <li>the VM path
- * <li>the class path or the boot class path
- * <li>the program class or program arguments
- * </ul>
- */
-public void setVMArguments(String[] args) {
- this.vmArguments = args;
-}
-/**
- * Sets the path on disk of the VM to launch.
- */
-public void setVMPath(String vmPath) {
- this.vmPath = vmPath;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java
deleted file mode 100644
index c9d14d8..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import java.io.*;
-
-/**
- * Wrapper around the external process that is running a local VM.
- * This allows to kill this process when we exit this vm.
- */
-public class LocalVirtualMachine {
- protected Process process;
- protected int debugPort;
- protected String evalTargetPath;
-/**
- * Creates a new LocalVirtualMachine that doesn't run and that cannot be debugged nor used to
- * evaluate.
- */
-public LocalVirtualMachine() {
- this.process = null;
- this.debugPort = -1;
- this.evalTargetPath = null;
-}
-/**
- * Creates a new LocalVirtualMachine from the Process that runs this VM
- * and with the given debug port number.
- */
-public LocalVirtualMachine(Process p, int debugPort, String evalTargetPath) {
- this.process = p;
- this.debugPort = debugPort;
- this.evalTargetPath = evalTargetPath;
-}
-/**
- * Destroys the process running this VM.
- */
-protected void basicShutDown() {
- if ((this.process != null) && this.isRunning()) {
- this.process.destroy();
- }
-}
-/**
- * Cleans up the given directory by removing all the files it contains as well
- * but leaving the directory.
- * @throws TargetException if the target path could not be cleaned up
- */
-private void cleanupDirectory(File directory) throws TargetException {
- if (!directory.exists()) {
- return;
- }
- String[] fileNames = directory.list();
- for (int i = 0; i < fileNames.length; i++) {
- File file = new File(directory, fileNames[i]);
- if (file.isDirectory()) {
- cleanupDirectory(file);
- if (!file.delete()) {
- throw new TargetException("Could not delete directory " + directory.getPath());
- }
- } else {
- if (!file.delete()) {
- throw new TargetException("Could not delete file " + file.getPath());
- }
- }
- }
-}
-/**
- * Cleans up this context's target path by removing all the files it contains
- * but leaving the directory.
- * @throws TargetException if the target path could not be cleaned up
- */
-protected void cleanupTargetPath() throws TargetException {
- if (this.evalTargetPath == null) return;
- String targetPath = this.evalTargetPath;
- if (LocalVMLauncher.TARGET_HAS_FILE_SYSTEM) {
- cleanupDirectory(new File(targetPath, LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY));
- cleanupDirectory(new File(targetPath, LocalVMLauncher.BOOT_CLASSPATH_DIRECTORY));
- File file = new File(targetPath, LocalVMLauncher.SUPPORT_ZIP_FILE_NAME);
-
- // workaround pb with Process.exitValue() that returns the process has exited, but it has not free the file yet
- int count = 10;
- for (int i = 0; i < count; i++) {
- if (file.delete()) {
- break;
- } else {
- try {
- Thread.sleep(count * 100);
- } catch (InterruptedException e) {
- }
- }
- }
- if (file.exists()) {
- throw new TargetException("Could not delete " + file.getPath());
- }
- } else {
- cleanupDirectory(new File(targetPath));
- }
-}
-/**
- * Returns the debug port number for this VM. This is the port number that was
- * passed as the "-debug" option if this VM was launched using a <code>LocalVMLauncher</code>.
- * Returns -1 if this information is not available or if this VM is not running in
- * debug mode.
- */
-public int getDebugPortNumber() {
- return this.debugPort;
-}
-/**
- * Returns an input stream that is connected to the standard error
- * (<code>System.err</code>) of this target VM.
- * Bytes that are written to <code>System.err</code> by the target
- * program become available in the input stream.
- * <p>
- * Note 1: This stream is usually unbuffered.
- * <p>
- * Note 2: Two calls to this method return the same identical input stream.
- * <p>
- * See also <code>java.lang.Process.getErrorStream()</code>.
- *
- * @return an input stream connected to the target VM's <code>System.err</code>.
- * @exception org.eclipse.jdt.tests.eval.runtime.TargetException if the target VM is not reachable.
- */
-public InputStream getErrorStream() throws TargetException {
- if (this.process == null)
- throw new TargetException("The VM is not running");
- else
- return this.process.getErrorStream();
-}
-/**
- * Returns an input stream that is connected to the standard output
- * (<code>System.out</code>) of this target VM.
- * Bytes that are written to <code>System.out</code> by the target
- * program become available in the input stream.
- * <p>
- * Note 1: This stream is usually buffered.
- * <p>
- * Note 2: Two calls to this method return the same identical input stream.
- * <p>
- * See also <code>java.lang.Process.getInputStream()</code>.
- *
- * @return an input stream connected to the target VM's <code>System.out</code>.
- * @exception org.eclipse.jdt.tests.eval.runtime.TargetException if the target VM is not reachable.
- */
-public InputStream getInputStream() throws TargetException {
- if (this.process == null)
- throw new TargetException("The VM is not running");
- else
- // Workaround problem with input stream of a Process
- return new VMInputStream(this.process, this.process.getInputStream());
-}
-/**
- * Returns an output stream that is connected to the standard input
- * (<code>System.in</code>) of this target VM.
- * Bytes that are written to the output stream by a client become available to the target
- * program in <code>System.in</code>.
- * <p>
- * Note 1: This stream is usually buffered.
- * <p>
- * Note 2: Two calls to this method return the same identical output stream.
- * <p>
- * See also <code>java.lang.Process.getOutputStream()</code>.
- *
- * @return an output stream connected to the target VM's <code>System.in</code>.
- * @exception org.eclipse.jdt.tests.eval.runtime.TargetException if the target VM is not reachable.
- */
-public OutputStream getOutputStream() throws TargetException {
- if (this.process == null)
- throw new TargetException("The VM is not running");
- else
- return this.process.getOutputStream();
-}
-/**
- * Returns whether this target VM is still running.
- * <p>
- * Note: This operation may require contacting the target VM to find out
- * if it is still running.
- */
-public boolean isRunning() {
- if (this.process == null)
- return false;
- else {
- boolean hasExited;
- try {
- this.process.exitValue();
- hasExited = true;
- } catch (IllegalThreadStateException e) {
- hasExited = false;
- }
- return !hasExited;
- }
-}
-/**
- * Shuts down this target VM.
- * This causes the VM to exit. This operation is ignored
- * if the VM has already shut down.
- *
- * @exception org.eclipse.jdt.tests.eval.runtime.TargetException if the target VM could not be shut down.
- */
-public void shutDown() throws TargetException {
- this.basicShutDown();
- int retry = 0;
- while (this.isRunning() && (++retry < 20)) {
- try {
- Thread.sleep(retry * 100);
- } catch (InterruptedException e) {
- }
- }
- if (this.isRunning()) { // give up cleaning the target path if VM is still running
- throw new TargetException("Could not shut the VM down");
- } else {
- this.cleanupTargetPath();
- }
-}
-/**
- * Waits for the VM to shut down. This method returns
- * immediately if the VM has already shut down. If the
- * VM has not yet shut down, the calling thread will be
- * blocked until the VM shuts down.
- *
- * @exception InterruptedException if the <code>waitForTermination</code> was
- * interrupted.
- */
-public void waitForTermination() throws InterruptedException {
- if (this.process == null)
- return;
- else
- this.process.waitFor();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java
deleted file mode 100644
index a378263..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import java.io.InputStream;
-
-/**
- * A null console reader that continuously reads from the VM input stream
- * so that the VM doesn't block when the program writes to the stout.
- */
-
-public class NullConsoleReader extends AbstractReader {
- private InputStream input;
-/*
- * Creates a new console reader that will read from the given input stream.
- */
-public NullConsoleReader(String name, InputStream input) {
- super(name);
- this.input = input;
-}
-/**
- * Continuously reads events that are coming from the event queue.
- */
-protected void readerLoop() {
- java.io.BufferedReader bufferedInput = new java.io.BufferedReader(new java.io.InputStreamReader(this.input));
- try {
- int read= 0;
- while (!this.isStopping && read != -1) {
- read= bufferedInput.read();
- }
- } catch (java.io.IOException e) {
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java
deleted file mode 100644
index 76577ff..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import java.io.*;
-
-/**
- * A <code>ProxyConsoleReader</code> reads the ouput from the proxy and
- * redirects it to a file or to the stdout if "con" is the name of the file.
- */
-class ProxyConsoleReader extends AbstractReader {
- private InputStream input;
- private OutputStream output;
-/*
- * Creates a new proxy console reader that will read from the given input stream
- * and rewrite what's read to the given file (or the stdout is the file name is
- * "con")
- */
-public ProxyConsoleReader(String name, InputStream input, String fileName) {
- super(name);
- this.input = input;
- if (fileName.equals("con")) {
- this.output= System.out;
- } else {
- try {
- this.output= new FileOutputStream(fileName);
- } catch (IOException e) {
- System.out.println("Could not create file " + fileName + ". Redirecting to stdout");
- this.output= System.out;
- }
- }
-}
-/**
- * Continuously reads from the proxy output and redirect what's read to
- * this reader's file.
- */
-protected void readerLoop() {
- try {
- byte[] buffer= new byte[1024];
- int read= 0;
- while (!this.isStopping && read != -1) {
- read= this.input.read(buffer);
- if (read != -1)
- this.output.write(buffer, 0, read);
- }
- } catch (java.io.IOException e) {
- }
-}
-/**
- * Stop this reader
- */
-public void stop() {
- super.stop();
- try {
- if (this.output != System.out)
- this.output.close();
- } catch (IOException e) {
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/RuntimeConstants.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/RuntimeConstants.java
deleted file mode 100644
index 7eea95d..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/RuntimeConstants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-public interface RuntimeConstants {
- public static final String SUPPORT_ZIP_FILE_NAME = "EvalTestsTarget.zip";
- public static final String CODE_SNIPPET_RUNNER_CLASS_NAME = "org.eclipse.jdt.core.tests.eval.target.CodeSnippetRunner";
- public static final String RUN_CODE_SNIPPET_METHOD = "runCodeSnippet";
- public static final String THE_RUNNER_FIELD = "theRunner";
- public static final String EVALPORT_ARG = "-evalport";
- public static final String CODESNIPPET_CLASSPATH_ARG = "-cscp";
- public static final String CODESNIPPET_BOOTPATH_ARG = "-csbp";
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java
deleted file mode 100644
index 2161bf8..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import org.eclipse.jdt.core.tests.runtime.RuntimeConstants;
-
-import java.io.*;
-
-import java.util.Vector;
-import java.util.Enumeration;
-
-/**
- * A standard VM launcher launches an external standard VM with
- * the given arguments on the same machine.
- */
-public class StandardVMLauncher extends LocalVMLauncher implements RuntimeConstants {
- String batchFileName;
-/**
- * Creates a new StandardVMLauncher that launches a standard VM
- * on the same machine.
- */
-public StandardVMLauncher() {
- super();
-}
-/**
- * Builds the actual boot class path that is going to be passed to the VM.
- */
-protected String buildBootClassPath() {
- StringBuffer bootPathString = new StringBuffer();
- char pathSeparator = File.pathSeparatorChar;
-
- if (this.bootPath != null) {
- // Add boot class path given by client
- int length = this.bootPath.length;
- for (int i = 0; i < length; i++){
- bootPathString.append(this.bootPath[i]);
- bootPathString.append(pathSeparator);
- }
- } else {
- // Add regular rt.jar
- bootPathString.append(this.vmPath);
- bootPathString.append(File.separator);
- if (!(this.vmPath.toLowerCase().endsWith("jre") || this.vmPath.toLowerCase().endsWith("jre" + File.separator))) {
- bootPathString.append("jre");
- bootPathString.append(File.separator);
- }
- bootPathString.append("lib");
- bootPathString.append(File.separator);
- bootPathString.append("rt.jar");
- bootPathString.append(pathSeparator);
- }
-
- // Add boot class path directory if needed
- if (this.evalTargetPath != null && TARGET_HAS_FILE_SYSTEM) {
- bootPathString.append(this.evalTargetPath);
- bootPathString.append(File.separatorChar);
- bootPathString.append(BOOT_CLASSPATH_DIRECTORY);
- }
-
- return bootPathString.toString();
-}
-/**
- * Returns the name of the batch file used to launch the VM.
- */
-public String getBatchFileName() {
- return this.batchFileName;
-}
-/**
- * @see LocalVMLauncher#getCommandLine
- */
-public String[] getCommandLine() {
- Vector commandLine= new Vector();
-
- // VM binary
- commandLine.addElement(
- this.vmPath +
- (this.vmPath.endsWith(File.separator) ? "" : File.separator) +
- "bin" +
- File.separator +
- "javaw");
-
- // VM arguments
- if (this.vmArguments != null) {
- for (int i = 0; i < this.vmArguments.length; i++) {
- commandLine.addElement(this.vmArguments[i]);
- }
- }
-
- // debug mode
- if (this.debugPort != -1) {
- commandLine.addElement("-Xdebug");
- commandLine.addElement("-Xnoagent");
- //commandLine.addElement("-Djava.compiler=NONE");
- commandLine.addElement(
- "-Xrunjdwp:transport=dt_socket,address=" +
- this.debugPort +
- ",server=y,suspend=n");
- }
-
- // boot classpath
- commandLine.addElement("-Xbootclasspath:" + buildBootClassPath());
-
- // regular classpath
- commandLine.addElement("-classpath");
- commandLine.addElement(buildClassPath());
-
- // code snippet runner class
- if (this.evalPort != -1) {
- commandLine.addElement(CODE_SNIPPET_RUNNER_CLASS_NAME);
- }
-
- // code snippet runner arguments
- if (this.evalPort != -1) {
- commandLine.addElement(EVALPORT_ARG);
- commandLine.addElement(Integer.toString(this.evalPort));
- if (TARGET_HAS_FILE_SYSTEM) {
- commandLine.addElement(CODESNIPPET_CLASSPATH_ARG);
- commandLine.addElement(this.evalTargetPath + File.separator + REGULAR_CLASSPATH_DIRECTORY);
- commandLine.addElement(CODESNIPPET_BOOTPATH_ARG);
- commandLine.addElement(this.evalTargetPath + File.separator + BOOT_CLASSPATH_DIRECTORY);
- }
- }
-
- // program class
- if (this.programClass != null) {
- commandLine.addElement(this.programClass);
- }
-
- // program arguments
- if (this.programArguments != null) {
- for (int i=0;i<this.programArguments.length;i++) {
- commandLine.addElement(this.programArguments[i]);
- }
- }
-
- String[] result;
- if (this.batchFileName!= null) {
- // Write to batch file if specified
- writeBatchFile(this.batchFileName, commandLine);
- result = new String[] {this.batchFileName};
- } else {
- result = new String[commandLine.size()];
- commandLine.copyInto(result);
- }
-
- // check for spaces in result
- for (int i = 0; i < result.length; i++) {
- String argument = result[i];
- if (argument.indexOf(' ') != -1) {
- result[i] = "\"" + argument + "\"";
- }
- }
-
- return result;
-}
-/**
- * Sets the name of the batch file used to launch the VM.
- * When this option is set, the launcher writes the command line to the given batch file,
- * and it launches the batch file. This causes a DOS console to be opened. Note it
- * doesn't delete the batch file when done.
- */
-public void setBatchFileName(String batchFileName) {
- this.batchFileName = batchFileName;
-}
-private void writeBatchFile(String fileName, Vector commandLine) {
- FileOutputStream output = null;
- try {
- output = new FileOutputStream(fileName);
- PrintWriter out= new PrintWriter(output);
- for (Enumeration e = commandLine.elements(); e.hasMoreElements();) {
- out.print((String)e.nextElement());
- out.print(" ");
- }
- out.println("pause");
- out.close();
- } catch (IOException e) {
- e.printStackTrace();
- if (output != null) {
- try {
- output.close();
- } catch (IOException e2) {
- }
- }
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetException.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetException.java
deleted file mode 100644
index 6160557..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-/**
- * A TargetException is thrown when an operation on a target has failed
- * for any reason.
- */
-public class TargetException extends Exception {
-/**
- * Constructs a <code>TargetException</code> with no detail message.
- */
-public TargetException() {
- super();
-}
-/**
- * Constructs a <code>TargetException</code> with the specified
- * detail message.
- *
- * @param s the detail message.
- */
-public TargetException(String s) {
- super(s);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java
deleted file mode 100644
index ac1c2dc..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import java.io.*;
-import java.net.*;
-/**
- * This is the interface to the target VM. It connects to an IDEInterface on the target side
- * using TCP/IO to send request for code snippet evaluation and to get the result back.
- *
- * @see org.eclipse.jdt.core.tests.eval.target.IDEInterface for details about the protocol.
- */
-public class TargetInterface {
- /**
- * Whether class files should be written in d:\eval\ instead of sending them to the target
- * NB: d:\eval should contain a batch file TestCodeSnippet.bat with the following contents:
- * SET JDK=c:\jdk1.2.2
- * SET EVAL=d:\eval
- * %JDK%\bin\java -Xbootclasspath:%JDK%\jre\lib\rt.jar;%EVAL%\javaClasses; -classpath c:\temp;%EVAL%\snippets;%EVAL%\classes;"d:\ide\project_resources\Eclipse Java Evaluation\CodeSnippetSupport.jar" CodeSnippetTester %1
- */
- static final boolean DEBUG = false;
- String codeSnippetClassName;
-
- /**
- * Whether timing info should be printed to stdout
- */
- static final boolean TIMING = false;
- long sentTime;
-
- /**
- * The connection to the target's ide interface.
- */
- Socket socket;
-
- public class Result {
- public char[] displayString;
- public char[] typeName;
- }
-
-/**
- * (PRIVATE API)
- * Connects this interface to the target.
- * Try as long as the given time (in ms) has not expired.
- * Use isConnected() to find out if the connection was successful.
- */
-public void connect(String targetAddress, int portNumber, int timeout) {
- if (isConnected()) {
- return;
- }
- if (portNumber > 0) {
- long startTime = System.currentTimeMillis();
- do {
- try {
- this.socket = new Socket(targetAddress, portNumber);
- this.socket.setTcpNoDelay(true);
- break;
- } catch (UnknownHostException e) {
- } catch (IOException e) {
- }
- if (this.socket == null) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- }
- } while (!isConnected() && (System.currentTimeMillis() - startTime) < timeout);
- }
-}
-/**
- * (PRIVATE API)
- * Disconnects this interface from the target.
- */
-public void disconnect() {
- if (this.socket != null) {
- try {
- this.socket.close();
- } catch (IOException e) {
- // Already closed. Nothing more to do
- }
- this.socket = null;
- }
-}
-/**
- * Returns the result of the evaluation sent previously to the target.
- */
-public Result getResult() {
- boolean hasValue = false;
- String typeName = null;
- String toString = null;
- if (DEBUG) {
- hasValue = true;
- typeName = "TargetInterface in debug mode. Run d:\\eval\\TestCodeSnippet.bat d:\\eval\\snippets\\" + codeSnippetClassName;
- toString = "";
- } else {
- if (this.isConnected()) {
- // TBD: Read type name and toString as a character array
- try {
- DataInputStream in = new DataInputStream(this.socket.getInputStream());
- hasValue = in.readBoolean();
- if (hasValue) {
- typeName = in.readUTF();
- toString = in.readUTF();
- } else {
- typeName = null;
- toString = null;
- }
- } catch (IOException e) {
- // The socket has likely been closed on the other end. So the code snippet runner has stopped.
- hasValue = true;
- typeName = e.getMessage();
- toString = "";
- this.disconnect();
- }
- } else {
- hasValue = true;
- typeName = "Connection has been lost";
- toString = "";
- }
- }
- if (TIMING) {
- System.out.println("Time to send compiled classes, run on target and get result is " + (System.currentTimeMillis() - this.sentTime) + "ms");
- }
- Result result = new Result();
- result.displayString = toString == null ? null : toString.toCharArray();
- result.typeName = typeName == null ? null : typeName.toCharArray();
- return result;
-}
-/**
- * Returns whether this interface is connected to the target.
- */
-boolean isConnected() {
- return this.socket != null;
-}
-/**
- * Sends the given class definitions to the target for loading and (if specified) for running.
- */
-public void sendClasses(boolean mustRun, ClassFile[] classes) throws TargetException {
- if (DEBUG) {
- for (int i = 0; i < classes.length; i++) {
- String className = new String(classes[i].fileName()).replace('/', '\\') + ".class";
- if ((i == 0) && (className.indexOf("CodeSnippet") != -1)) {
- codeSnippetClassName = className;
- try {
- ClassFile.writeToDisk(true, "d:\\eval\\snippets", className, classes[0].getBytes());
- } catch(IOException e) {
- }
- } else {
- String dirName;
- if (className.startsWith("java")) {
- dirName = "d:\\eval\\" + LocalVMLauncher.BOOT_CLASSPATH_DIRECTORY;
- } else {
- dirName = "d:\\eval\\" + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY;
- }
- try {
- ClassFile.writeToDisk(true, dirName, className, classes[i].getBytes());
- } catch(IOException e) {
- }
- }
- }
- } else {
- if (TIMING) {
- this.sentTime = System.currentTimeMillis();
- }
- if (!isConnected()) {
- throw new TargetException("Connection to the target VM has been lost");
- }
- try {
- DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
- out.writeBoolean(mustRun);
- out.writeInt(classes.length);
- for (int i = 0; i < classes.length; i++) {
- byte[] classDefinition = classes[i].getBytes();
- out.writeInt(classDefinition.length);
- out.write(classDefinition);
- }
- } catch (IOException e) {
- // The socket has likely been closed on the other end. So the code snippet runner has stopped.
- this.disconnect();
- }
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java
deleted file mode 100644
index bc00607..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.runtime;
-
-import java.io.*;
-
-/**
- * Workaround problem with input stream from a <code>java.lang.Process</code>
- * that throws an <code>IOException</code> even if there is something to read.
- */
-public class VMInputStream extends InputStream {
- InputStream input;
- Process process;
-public VMInputStream(Process process, InputStream input) {
- this.process= process;
- this.input= input;
-}
-public int available() throws IOException {
- return this.input.available();
-}
-public void close() throws IOException {
- this.input.close();
-}
-private boolean isRunning() {
- if (this.process == null)
- return false;
- else {
- boolean hasExited;
- try {
- this.process.exitValue();
- hasExited = true;
- } catch (IllegalThreadStateException e) {
- hasExited = false;
- }
- return !hasExited;
- }
-}
-public synchronized void mark(int readlimit) {
- this.input.mark(readlimit);
-}
-public boolean markSupported() {
- return this.input.markSupported();
-}
-public int read() throws IOException {
- try {
- return this.input.read();
- } catch (IOException e) {
- if (isRunning()) {
- return read();
- } else {
- throw e;
- }
- }
-}
-public int read(byte b[]) throws IOException {
- // Make sure the byte array is initialized (value of 0 is used in the workaround below)
- for (int i=0;i<b.length;i++)
- b[i]=0;
-
- int read;
- try {
- read = this.input.read(b);
- } catch (IOException e) {
- if (isRunning()) {
- // Workaround problem with implementation of Process.getInputStream()
- // (see PR 1PRW670: LFRE:WINNT - Program hangs running in LeapFrog)
- read= 0;
- while (read < b.length && b[read] != 0) {
- read++;
- }
- } else
- throw e;
- }
-
- return read;
-}
-public int read(byte b[], int off, int len) throws IOException {
- // Make sure the byte array is initialized (value of 0 is used in the workaround below)
- for (int i = off; i < len; i++)
- b[i] = 0;
-
- int read;
- try {
- read = this.input.read(b, off, len);
- } catch (IOException e) {
- if (isRunning()) {
- // Workaround problem with implementation of Process.getInputStream()
- // (see PR 1PRW670: LFRE:WINNT - Program hangs running in LeapFrog)
- read = 0;
- while (off + read < len && b[off + read] != 0) {
- read++;
- }
- } else
- throw e;
- }
- return read;
-}
-public synchronized void reset() throws IOException {
- this.input.reset();
-}
-public long skip(long n) throws IOException {
- return this.input.skip(n);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/SocketHelper.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/SocketHelper.java
deleted file mode 100644
index f866f04..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/SocketHelper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.util;
-
-import java.io.*;
-import java.net.*;
-public class SocketHelper {
- int localPort = -1;
-/**
- * Using the given port number to create a server, creates a connection to this server
- * and returns the local port of the client (after closing the connection so that
- * the local port is now available).
- * Returns -1 if the server could not be created.
- */
-public int getAvailablePort(final int portNumber) {
- this.localPort = -1;
- Thread server = new Thread() {
- public void run() {
- try {
- new ServerSocket(portNumber).accept().close();
- } catch (IOException e) {
- // address in use
- }
- }
- };
- server.start();
-
- try {
- Socket socket = new Socket("127.0.0.1", portNumber);
- server.join(2000);
- this.localPort = socket.getLocalPort();
- socket.close();
- } catch (InterruptedException e) {
- } catch (IOException e) {
- // connection refused
- }
-
- return this.localPort;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java
deleted file mode 100644
index 65599e4..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.util;
-
-import org.eclipse.jdt.core.tests.runtime.*;
-import java.io.*;
-import java.net.*;
-/**
- * Verifies that the .class files resulting from a compilation can be loaded
- * in a VM and that they can be run.
- */
-public class TestVerifier {
- public String failureReason;
-
- boolean reuseVM = true;
- String[] classpathCache;
- LocalVirtualMachine vm;
- StringBuffer outputBuffer;
- StringBuffer errorBuffer;
- Socket socket;
-public TestVerifier(boolean reuseVM) {
- this.reuseVM = reuseVM;
-}
-private boolean checkBuffers(String errorString, String outputString, String sourceFileName, String expectedSuccessOutputString) {
-
- if (errorString.length() > 0) {
- this.failureReason =
- "Unexpected target error running resulting class file for "
- + sourceFileName
- + ":\n"
- + errorString;
- return false;
- }
- String platformIndependantOutputString = Util.convertToIndependantLineDelimiter(outputString);
- if (expectedSuccessOutputString != null && (platformIndependantOutputString.indexOf(expectedSuccessOutputString) == -1
- || expectedSuccessOutputString.length() == 0 && platformIndependantOutputString.length() != 0)) {
- System.out.println(Util.displayString(platformIndependantOutputString, 2));
- this.failureReason =
- "Unexpected output running resulting class file for "
- + sourceFileName
- + ":\n"
- + "--[START]--\n"
- + outputString
- + "---[END]---\n";
- return false;
- }
-
- return true;
-}
-
-private boolean checkBuffersThrowingError(String errorString, String sourceFileName, String expectedSuccessOutputString) {
-
- if (errorString.length() > 0 && errorString.indexOf(expectedSuccessOutputString) != -1) {
- return true;
- }
-
- this.failureReason =
- "Expected error not thrown for "
- + sourceFileName
- + ":\n"
- + expectedSuccessOutputString;
- return false;
-}
-
-private void compileVerifyTests(String verifierDir) {
- String fullyQualifiedName = VerifyTests.class.getName();
-
- int lastDot = fullyQualifiedName.lastIndexOf('.');
- String packageName = fullyQualifiedName.substring(0, lastDot);
- String simpleName = fullyQualifiedName.substring(lastDot + 1);
-
- String dirName = verifierDir.replace('\\', '/') + "/" + packageName.replace('.', '/');
- File dir = new File(dirName.replace('/', File.separatorChar));
- if (!dir.exists() && !dir.mkdirs()) {
- System.out.println("Could not create " + dir);
- return;
- }
- String fileName = dir + File.separator + simpleName + ".java";
- Util.writeToFile(this.getVerifyTestsCode(), fileName);
- org.eclipse.jdt.internal.compiler.batch.Main.compile("\"" + fileName + "\" -d \"" + verifierDir + "\" -classpath \"" + Util.getJavaClassLib() + "\"");
-}
-public void execute(String className, String[] classpaths) {
- this.outputBuffer = new StringBuffer();
- this.errorBuffer = new StringBuffer();
-
- launchAndRun(className, classpaths, null, null);
-}
-protected void finalize() throws Throwable {
- this.shutDown();
-}
-public String getExecutionOutput(){
- return outputBuffer.toString();
-}
-
-public String getExecutionError(){
- return errorBuffer.toString();
-}
-/**
- * Returns the code of the VerifyTests class.
- *
- * To generate:
- * - export VerifyTests to c:/temp/test
- * - inspect org.eclipse.jdt.core.tests.util.Util.fileContentToDisplayString("c:/temp/test/org/eclipse/jdt/core/tests/util/VerifyTests.java", 2)
- */
-private String getVerifyTestsCode() {
- return
- "package org.eclipse.jdt.core.tests.util;\n" +
- "import java.lang.reflect.*;\n" +
- "import java.io.*;\n" +
- "import java.net.*;\n" +
- "import java.util.*;\n" +
- "public class VerifyTests {\n" +
- " int portNumber;\n" +
- " Socket socket;\n" +
- "/**\n" +
- " * NOTE: Code copied from junit.util.TestCaseClassLoader.\n" +
- " *\n" +
- " * A custom class loader which enables the reloading\n" +
- " * of classes for each test run. The class loader\n" +
- " * can be configured with a list of package paths that\n" +
- " * should be excluded from loading. The loading\n" +
- " * of these packages is delegated to the system class\n" +
- " * loader. They will be shared across test runs.\n" +
- " * <p>\n" +
- " * The list of excluded package paths is specified in\n" +
- " * a properties file \"excluded.properties\" that is located in \n" +
- " * the same place as the TestCaseClassLoader class.\n" +
- " * <p>\n" +
- " * <b>Known limitation:</b> the VerifyClassLoader cannot load classes\n" +
- " * from jar files.\n" +
- " */\n" +
- "public class VerifyClassLoader extends ClassLoader {\n" +
- " /** scanned class path */\n" +
- " private String[] fPathItems;\n" +
- " \n" +
- " /** excluded paths */\n" +
- " private String[] fExcluded= {};\n" +
- " /**\n" +
- " * Constructs a VerifyClassLoader. It scans the class path\n" +
- " * and the excluded package paths\n" +
- " */\n" +
- " public VerifyClassLoader() {\n" +
- " super();\n" +
- " String classPath= System.getProperty(\"java.class.path\");\n" +
- " String separator= System.getProperty(\"path.separator\");\n" +
- " \n" +
- " // first pass: count elements\n" +
- " StringTokenizer st= new StringTokenizer(classPath, separator);\n" +
- " int i= 0;\n" +
- " while (st.hasMoreTokens()) {\n" +
- " st.nextToken();\n" +
- " i++;\n" +
- " }\n" +
- " // second pass: split\n" +
- " fPathItems= new String[i];\n" +
- " st= new StringTokenizer(classPath, separator);\n" +
- " i= 0;\n" +
- " while (st.hasMoreTokens()) {\n" +
- " fPathItems[i++]= st.nextToken();\n" +
- " }\n" +
- " }\n" +
- " public java.net.URL getResource(String name) {\n" +
- " return ClassLoader.getSystemResource(name);\n" +
- " }\n" +
- " public InputStream getResourceAsStream(String name) {\n" +
- " return ClassLoader.getSystemResourceAsStream(name);\n" +
- " }\n" +
- " protected boolean isExcluded(String name) {\n" +
- " // exclude the \"java\" packages.\n" +
- " // They always need to be excluded so that they are loaded by the system class loader\n" +
- " if (name.startsWith(\"java\"))\n" +
- " return true;\n" +
- " \n" +
- " // exclude the user defined package paths\n" +
- " for (int i= 0; i < fExcluded.length; i++) {\n" +
- " if (name.startsWith(fExcluded[i])) {\n" +
- " return true;\n" +
- " }\n" +
- " }\n" +
- " return false; \n" +
- " }\n" +
- " public synchronized Class loadClass(String name, boolean resolve)\n" +
- " throws ClassNotFoundException {\n" +
- " \n" +
- " Class c= findLoadedClass(name);\n" +
- " if (c != null)\n" +
- " return c;\n" +
- " //\n" +
- " // Delegate the loading of excluded classes to the\n" +
- " // standard class loader.\n" +
- " //\n" +
- " if (isExcluded(name)) {\n" +
- " try {\n" +
- " c= findSystemClass(name);\n" +
- " return c;\n" +
- " } catch (ClassNotFoundException e) {\n" +
- " // keep searching\n" +
- " }\n" +
- " }\n" +
- " if (c == null) {\n" +
- " File file= locate(name);\n" +
- " if (file == null)\n" +
- " throw new ClassNotFoundException();\n" +
- " byte data[]= loadClassData(file);\n" +
- " c= defineClass(name, data, 0, data.length);\n" +
- " }\n" +
- " if (resolve) \n" +
- " resolveClass(c);\n" +
- " return c;\n" +
- " }\n" +
- " private byte[] loadClassData(File f) throws ClassNotFoundException {\n" +
- " try {\n" +
- " //System.out.println(\"loading: \"+f.getPath());\n" +
- " FileInputStream stream= new FileInputStream(f);\n" +
- " \n" +
- " try {\n" +
- " byte[] b= new byte[stream.available()];\n" +
- " stream.read(b);\n" +
- " stream.close();\n" +
- " return b;\n" +
- " }\n" +
- " catch (IOException e) {\n" +
- " throw new ClassNotFoundException();\n" +
- " }\n" +
- " }\n" +
- " catch (FileNotFoundException e) {\n" +
- " throw new ClassNotFoundException();\n" +
- " }\n" +
- " }\n" +
- " /**\n" +
- " * Locate the given file.\n" +
- " * @return Returns null if file couldn\'t be found.\n" +
- " */\n" +
- " private File locate(String fileName) { \n" +
- " fileName= fileName.replace(\'.\', \'/\')+\".class\";\n" +
- " File path= null;\n" +
- " \n" +
- " if (fileName != null) {\n" +
- " for (int i= 0; i < fPathItems.length; i++) {\n" +
- " path= new File(fPathItems[i], fileName);\n" +
- " if (path.exists())\n" +
- " return path;\n" +
- " }\n" +
- " }\n" +
- " return null;\n" +
- " }\n" +
- "}\n" +
- " \n" +
- "public void loadAndRun(String className) throws Throwable {\n" +
- " //System.out.println(\"Loading \" + className + \"...\");\n" +
- " Class testClass = new VerifyClassLoader().loadClass(className);\n" +
- " //System.out.println(\"Loaded \" + className);\n" +
- " try {\n" +
- " Method main = testClass.getMethod(\"main\", new Class[] {String[].class});\n" +
- " //System.out.println(\"Running \" + className);\n" +
- " main.invoke(null, new Object[] {new String[] {}});\n" +
- " //System.out.println(\"Finished running \" + className);\n" +
- " } catch (NoSuchMethodException e) {\n" +
- " return;\n" +
- " } catch (InvocationTargetException e) {\n" +
- " throw e.getTargetException();\n" +
- " }\n" +
- "}\n" +
- "public static void main(String[] args) throws IOException {\n" +
- " VerifyTests verify = new VerifyTests();\n" +
- " verify.portNumber = Integer.parseInt(args[0]);\n" +
- " verify.run();\n" +
- "}\n" +
- "public void run() throws IOException {\n" +
- " ServerSocket server = new ServerSocket(this.portNumber);\n" +
- " this.socket = server.accept();\n" +
- " this.socket.setTcpNoDelay(true);\n" +
- " server.close();\n" +
- " DataInputStream in = new DataInputStream(this.socket.getInputStream());\n" +
- " final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());\n" +
- " while (true) {\n" +
- " final String className = in.readUTF();\n" +
- " Thread thread = new Thread() {\n" +
- " public void run() {\n" +
- " try {\n" +
- " loadAndRun(className);\n" +
- " out.writeBoolean(true);\n" +
- " System.err.println(VerifyTests.class.getName());\n" +
- " System.out.println(VerifyTests.class.getName());\n" +
- " } catch (Throwable e) {\n" +
- " e.printStackTrace();\n" +
- " try {\n" +
- " System.err.println(VerifyTests.class.getName());\n" +
- " System.out.println(VerifyTests.class.getName());\n" +
- " out.writeBoolean(false);\n" +
- " } catch (IOException e1) {\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " thread.start();\n" +
- " }\n" +
- "}\n" +
- "}\n";
-}
-private void launchAndRun(String className, String[] classpaths, String[] programArguments, String[] vmArguments) {
- // we won't reuse the vm, shut the existing one if running
- if (this.vm != null) {
- try {
- vm.shutDown();
- } catch (TargetException e) {
- }
- }
- this.classpathCache = null;
-
- // launch a new one
- LocalVMLauncher launcher = LocalVMLauncher.getLauncher();
- launcher.setClassPath(classpaths);
- launcher.setVMPath(Util.getJREDirectory());
- if (vmArguments != null) {
- String[] completeVmArguments = new String[vmArguments.length + 1];
- System.arraycopy(vmArguments, 0, completeVmArguments, 1, vmArguments.length);
- completeVmArguments[0] = "-verify";
- launcher.setVMArguments(completeVmArguments);
- } else {
- launcher.setVMArguments(new String[] {"-verify"});
- }
- launcher.setProgramClass(className);
- launcher.setProgramArguments(programArguments);
- Thread outputThread;
- Thread errorThread;
- try {
- this.vm = launcher.launch();
- final InputStream input = this.vm.getInputStream();
- outputThread = new Thread(new Runnable() {
- public void run() {
- try {
- int c = input.read();
- while (c != -1) {
- outputBuffer.append((char) c);
- c = input.read();
- }
- } catch(IOException ioEx) {
- }
- }
- });
- final InputStream errorStream = this.vm.getErrorStream();
- errorThread = new Thread(new Runnable() {
- public void run() {
- try {
- int c = errorStream.read();
- while (c != -1) {
- errorBuffer.append((char) c);
- c = errorStream.read();
- }
- } catch(IOException ioEx) {
- }
- }
- });
- outputThread.start();
- errorThread.start();
- } catch(TargetException e) {
- throw new Error(e.getMessage());
- }
-
- // wait for vm to shut down by itself
- try {
- outputThread.join(5000);
- errorThread.join(5000);
- } catch (InterruptedException e) {
- }
-}
-private void launchVerifyTestsIfNeeded(String[] classpaths, String[] vmArguments) {
- // determine if we can reuse the vm
- if (this.vm != null && this.vm.isRunning() && this.classpathCache != null) {
- boolean sameClasspaths = true;
- for (int i = 0; i < classpaths.length; i++) {
- if (!this.classpathCache[i].equals(classpaths[i])) {
- sameClasspaths = false;
- break;
- }
- }
- if (sameClasspaths) {
- return;
- }
- }
-
- // we could not reuse the vm, shut the existing one if running
- if (this.vm != null) {
- try {
- vm.shutDown();
- } catch (TargetException e) {
- }
- }
-
- this.classpathCache = classpaths;
-
- // launch a new one
- LocalVMLauncher launcher = LocalVMLauncher.getLauncher();
- int length = classpaths.length;
- String[] cp = new String[length + 1];
- System.arraycopy(classpaths, 0, cp, 0, length);
- String verifierDir = Util.getOutputDirectory() + File.separator + "verifier";
- this.compileVerifyTests(verifierDir);
- cp[length] = verifierDir;
- launcher.setClassPath(cp);
- launcher.setVMPath(Util.getJREDirectory());
- if (vmArguments != null) {
- String[] completeVmArguments = new String[vmArguments.length + 1];
- System.arraycopy(vmArguments, 0, completeVmArguments, 1, vmArguments.length);
- completeVmArguments[0] = "-verify";
- launcher.setVMArguments(completeVmArguments);
- } else {
- launcher.setVMArguments(new String[] {"-verify"});
- }
- launcher.setProgramClass(VerifyTests.class.getName());
- int portNumber = Util.nextAvailablePortNumber();
- launcher.setProgramArguments(new String[] {Integer.toString(portNumber)});
- try {
- this.vm = launcher.launch();
- final InputStream input = this.vm.getInputStream();
- Thread outputThread = new Thread(new Runnable() {
- public void run() {
- try {
- int c = input.read();
- while (c != -1) {
- outputBuffer.append((char) c);
- c = input.read();
- }
- } catch(IOException ioEx) {
- }
- }
- });
- final InputStream errorStream = this.vm.getErrorStream();
- Thread errorThread = new Thread(new Runnable() {
- public void run() {
- try {
- int c = errorStream.read();
- while (c != -1) {
- errorBuffer.append((char) c);
- c = errorStream.read();
- }
- } catch(IOException ioEx) {
- }
- }
- });
- outputThread.start();
- errorThread.start();
- } catch(TargetException e) {
- throw new Error(e.getMessage());
- }
-
- // connect to the vm
- this.socket = null;
- boolean isVMRunning = false;
- do {
- try {
- this.socket = new Socket("localhost", portNumber);
- this.socket.setTcpNoDelay(true);
- break;
- } catch (UnknownHostException e) {
- } catch (IOException e) {
- }
- if (this.socket == null) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- isVMRunning = vm.isRunning();
- }
- } while (this.socket == null && isVMRunning);
-
-}
-/**
- * Loads and runs the given class.
- * Return whether no exception was thrown while running the class.
- */
-private boolean loadAndRun(String className) {
- if (this.socket != null) {
- try {
- DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
- out.writeUTF(className);
- DataInputStream in = new DataInputStream(this.socket.getInputStream());
- try {
- boolean result = in.readBoolean();
- this.waitForFullBuffers();
- return result;
- } catch (SocketException e) {
- // connection was reset because target program has exited
- return true;
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return true;
-}
-public void shutDown() {
- // Close the socket first so that the OS resource has a chance to be freed.
- if (this.socket != null) {
- try {
- this.socket.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- // Wait for the vm to shut down by itself for 2 seconds. If not succesfull, force the shut down.
- if (this.vm != null) {
- try {
- int retry = 0;
- while (this.vm.isRunning() && (++retry < 20)) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- }
- if (this.vm.isRunning()) {
- this.vm.shutDown();
- }
- } catch (TargetException e) {
- e.printStackTrace();
- }
- }
-}
-/**
- * Verify that the class files created for the given test file can be loaded by
- * a virtual machine.
- */
-public boolean verifyClassFiles(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths) {
- return verifyClassFiles(sourceFilePath, className, expectedSuccessOutputString, classpaths, null, null);
-}
-/**
- * Verify that the class files created for the given test file can be loaded by
- * a virtual machine.
- */
-public boolean verifyClassFiles(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String[] programArguments, String[] vmArguments) {
- this.outputBuffer = new StringBuffer();
- this.errorBuffer = new StringBuffer();
- if (this.reuseVM && programArguments == null) {
- this.launchVerifyTestsIfNeeded(classpaths, vmArguments);
- this.loadAndRun(className);
- } else {
- this.launchAndRun(className, classpaths, programArguments, vmArguments);
- }
-
- this.failureReason = null;
- return this.checkBuffers(this.errorBuffer.toString(), this.outputBuffer.toString(), sourceFilePath, expectedSuccessOutputString);
-}
-
-/**
- * Verify that the class files created for the given test file can be loaded and run with an expected error contained
- * in the expectedSuccessOutputString string.
- */
-public boolean verifyClassFilesThrowingError(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String[] programArguments, String[] vmArguments) {
- this.outputBuffer = new StringBuffer();
- this.errorBuffer = new StringBuffer();
- if (this.reuseVM && programArguments == null) {
- this.launchVerifyTestsIfNeeded(classpaths, vmArguments);
- this.loadAndRun(className);
- } else {
- this.launchAndRun(className, classpaths, programArguments, vmArguments);
- }
-
- this.failureReason = null;
- return this.checkBuffersThrowingError(this.errorBuffer.toString(), sourceFilePath, expectedSuccessOutputString);
-}
-
-/**
- * Wait until there is nothing more to read from the stdout or sterr.
- */
-private void waitForFullBuffers() {
- String endString = VerifyTests.class.getName();
- int count = 50;
- int errorEndStringStart = this.errorBuffer.toString().indexOf(endString);
- int outputEndStringStart = this.outputBuffer.toString().indexOf(endString);
- while (errorEndStringStart == -1 || outputEndStringStart == -1) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- if (--count == 0) return;
- errorEndStringStart = this.errorBuffer.toString().indexOf(endString);
- outputEndStringStart = this.outputBuffer.toString().indexOf(endString);
- }
- this.errorBuffer.setLength(errorEndStringStart);
- this.outputBuffer.setLength(outputEndStringStart);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
deleted file mode 100644
index e0e9551..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.util;
-
-import java.io.*;
-public class Util {
- public static String OUTPUT_DIRECTORY = "comptest";
-
- public static int MAX_PORT_NUMBER = 9999;
-/**
- * Copy the given source (a file or a directory that must exists) to the given destination (a directory that must exists).
- */
-public static void copy(String sourcePath, String destPath) {
- sourcePath = toNativePath(sourcePath);
- destPath = toNativePath(destPath);
- File source = new File(sourcePath);
- if (!source.exists()) return;
- File dest = new File(destPath);
- if (!dest.exists()) return;
- if (source.isDirectory()) {
- String[] files = source.list();
- if (files != null) {
- for (int i = 0; i < files.length; i++) {
- String file = files[i];
- File sourceFile = new File(source, file);
- if (sourceFile.isDirectory()) {
- File destSubDir = new File(dest, file);
- destSubDir.mkdir();
- copy(sourceFile.getPath(), destSubDir.getPath());
- } else {
- copy(sourceFile.getPath(), dest.getPath());
- }
- }
- }
- } else {
- FileInputStream in = null;
- FileOutputStream out = null;
- try {
- in = new FileInputStream(source);
- File destFile = new File(dest, source.getName());
- if (destFile.exists() && !destFile.delete()) {
- throw new IOException(destFile + " is in use");
- }
- out = new FileOutputStream(destFile);
- int bufferLength = 1024;
- byte[] buffer = new byte[bufferLength];
- int read = 0;
- while (read != -1) {
- read = in.read(buffer, 0, bufferLength);
- if (read != -1) {
- out.write(buffer, 0, read);
- }
- }
- } catch (IOException e) {
- throw new Error(e.toString());
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- }
- }
- }
- }
-}
-/**
- * Generate a display string from the given String.
- * @param indent number of tabs are added at the begining of each line.
- *
- * Example of use: [org.eclipse.jdt.core.tests.util.Util.displayString("abc\ndef\tghi")]
-*/
-public static String displayString(String inputString){
- return displayString(inputString, 0);
-}
-/**
- * Generate a display string from the given String.
- * It converts:
- * <ul>
- * <li>\t to \t</li>
- * <li>\r to \\r</li>
- * <li>\n to \n</li>
- * <li>\b to \\b</li>
- * <li>\f to \\f</li>
- * <li>\" to \\\"</li>
- * <li>\' to \\'</li>
- * <li>\\ to \\\\</li>
- * <li>All other characters are unchanged.</li>
- * </ul>
- * This method doesn't convert \r\n to \n.
- * <p>
- * Example of use:
- * <o>
- * <li>
- * <pre>
- * input string = "abc\ndef\tghi",
- * indent = 3
- * result = "\"\t\t\tabc\\n" +
- * "\t\t\tdef\tghi\""
- * </pre>
- * </li>
- * <li>
- * <pre>
- * input string = "abc\ndef\tghi\n",
- * indent = 3
- * result = "\"\t\t\tabc\\n" +
- * "\t\t\tdef\tghi\\n\""
- * </pre>
- * </li>
- * <li>
- * <pre>
- * input string = "abc\r\ndef\tghi\r\n",
- * indent = 3
- * result = "\"\t\t\tabc\\r\\n" +
- * "\t\t\tdef\tghi\\r\\n\""
- * </pre>
- * </li>
- * </ol>
- * </p>
- *
- * @param inputString the given input string
- * @param indent number of tabs are added at the begining of each line.
- *
- * @return the displayed string
-*/
-public static String displayString(String inputString, int indent) {
- int length = inputString.length();
- StringBuffer buffer = new StringBuffer(length);
- java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(inputString, "\n\r", true);
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append("\"");
- while (tokenizer.hasMoreTokens()){
-
- String token = tokenizer.nextToken();
- if (token.equals("\r")) {
- buffer.append("\\r");
- if (tokenizer.hasMoreTokens()) {
- token = tokenizer.nextToken();
- if (token.equals("\n")) {
- buffer.append("\\n");
- if (tokenizer.hasMoreTokens()) {
- buffer.append("\" + \n");
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append("\"");
- }
- continue;
- } else {
- buffer.append("\" + \n");
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append("\"");
- }
- } else {
- continue;
- }
- } else if (token.equals("\n")) {
- buffer.append("\\n");
- if (tokenizer.hasMoreTokens()) {
- buffer.append("\" + \n");
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append("\"");
- }
- continue;
- }
-
- StringBuffer tokenBuffer = new StringBuffer();
- for (int i = 0; i < token.length(); i++){
- char c = token.charAt(i);
- switch (c) {
- case '\r' :
- tokenBuffer.append("\\r");
- break;
- case '\n' :
- tokenBuffer.append("\\n");
- break;
- case '\b' :
- tokenBuffer.append("\\b");
- break;
- case '\t' :
- tokenBuffer.append("\t");
- break;
- case '\f' :
- tokenBuffer.append("\\f");
- break;
- case '\"' :
- tokenBuffer.append("\\\"");
- break;
- case '\'' :
- tokenBuffer.append("\\'");
- break;
- case '\\' :
- tokenBuffer.append("\\\\");
- break;
- default :
- tokenBuffer.append(c);
- }
- }
- buffer.append(tokenBuffer.toString());
- }
- buffer.append("\"");
- return buffer.toString();
-}
-/**
- * Reads the content of the given source file and converts it to a display string.
- *
- * Example of use: [org.eclipse.jdt.core.tests.util.Util.fileContentToDisplayString("c:/temp/X.java", 0)]
-*/
-public static String fileContentToDisplayString(String sourceFilePath, int indent) {
- File sourceFile = new File(sourceFilePath);
- if (!sourceFile.exists()) {
- System.out.println("File " + sourceFilePath + " does not exists.");
- return null;
- }
- if (!sourceFile.isFile()) {
- System.out.println(sourceFilePath + " is not a file.");
- return null;
- }
- StringBuffer sourceContentBuffer = new StringBuffer();
- FileInputStream input = null;
- try {
- input = new FileInputStream(sourceFile);
- } catch (FileNotFoundException e) {
- return null;
- }
- try {
- int read;
- do {
- read = input.read();
- if (read != -1) {
- sourceContentBuffer.append((char)read);
- }
- } while (read != -1);
- input.close();
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- } finally {
- try {
- input.close();
- } catch (IOException e2) {
- }
- }
- return displayString(sourceContentBuffer.toString(), indent);
-}
-/**
- * Reads the content of the given source file, converts it to a display string.
- * If the destination file path is not null, writes the result to this file.
- * Otherwise writes it to the console.
- *
- * Example of use: [org.eclipse.jdt.core.tests.util.Util.fileContentToDisplayString("c:/temp/X.java", 0, null)]
-*/
-public static void fileContentToDisplayString(String sourceFilePath, int indent, String destinationFilePath) {
- String displayString = fileContentToDisplayString(sourceFilePath, indent);
- if (destinationFilePath == null) {
- System.out.println(displayString);
- return;
- }
- writeToFile(displayString, destinationFilePath);
-}
-/**
- * Flush content of a given directory (leaving it empty),
- * no-op if not a directory.
- */
-public static void flushDirectoryContent(File dir) {
- if (dir.isDirectory()) {
- String[] files = dir.list();
- if (files == null) return;
- for (int i = 0, max = files.length; i < max; i++) {
- File current = new File(dir, files[i]);
- if (current.isDirectory()) {
- flushDirectoryContent(current);
- }
- current.delete();
- }
- }
-}
-/**
- * Search the user hard-drive for a Java class library.
- * Returns null if none could be found.
- *
- * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJavaClassLib()]
-*/
-public static String getJavaClassLib() {
- String jreDir = getJREDirectory();
- if (jreDir == null) {
- return null;
- } else {
- if ("J9".equals(System.getProperty("java.vm.name"))) {
- return toNativePath(jreDir + "/lib/jclMax/classes.zip");
- } else {
- return toNativePath(jreDir + "/lib/rt.jar");
- }
- }
-}
-/**
- * Returns the JRE directory this tests are running on.
- * Returns null if none could be found.
- *
- * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJREDirectory()]
-*/
-public static String getJREDirectory() {
- return System.getProperty("java.home");
-}
-/**
- * Search the user hard-drive for a possible output directory.
- * Returns null if none could be found.
- *
- * Example of use: [org.eclipse.jdt.core.tests.util.Util.getOutputDirectory()]
-*/
-public static String getOutputDirectory() {
- String container = System.getProperty("java.io.tmpdir");
- if (container == null){
- return null;
- } else {
- return toNativePath(container) + File.separator + OUTPUT_DIRECTORY;
- }
-}
-/**
- * Returns whether one of the arguments is "-expert".
- */
-public static boolean isExpert(String[] args) {
- for (int i = 0; i < args.length; i++) {
- if (args[i].toLowerCase().equals("-expert")) {
- return true;
- }
- }
- return false;
-}
-/**
- * Returns the next available port number on the local host.
- */
-public static int nextAvailablePortNumber() {
- for (int i = MAX_PORT_NUMBER; i > 1000; i--) {
- int localPort = new SocketHelper().getAvailablePort(i);
- if (localPort != -1) {
- return localPort;
- }
- }
- return -1;
-}
-/**
- * Makes the given path a path using native path separators as returned by File.getPath()
- * and trimming any extra slash.
- */
-public static String toNativePath(String path) {
- String nativePath = path.replace('\\', File.separatorChar).replace('/', File.separatorChar);
- return
- nativePath.endsWith("/") || nativePath.endsWith("\\") ?
- nativePath.substring(0, nativePath.length() - 1) :
- nativePath;
-}
-public static void writeToFile(String contents, String destinationFilePath) {
- File destFile = new File(destinationFilePath);
- FileOutputStream output = null;
- try {
- output = new FileOutputStream(destFile);
- PrintWriter writer = new PrintWriter(output);
- writer.print(contents);
- writer.flush();
- } catch (IOException e) {
- e.printStackTrace();
- return;
- } finally {
- if (output != null) {
- try {
- output.close();
- } catch (IOException e2) {
- }
- }
- }
-}
-public static String convertToIndependantLineDelimiter(String source) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = source.length(); i < length; i++) {
- char car = source.charAt(i);
- if (car == '\r') {
- buffer.append('\n');
- if (i < length-1 && source.charAt(i+1) == '\n') {
- i++; // skip \n after \r
- }
- } else {
- buffer.append(car);
- }
- }
- return buffer.toString();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java
deleted file mode 100644
index dcd1dc8..0000000
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.util;
-
-import java.lang.reflect.*;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-public class VerifyTests {
- int portNumber;
- Socket socket;
-
-/**
- * NOTE: Code copied from junit.util.TestCaseClassLoader.
- *
- * A custom class loader which enables the reloading
- * of classes for each test run. The class loader
- * can be configured with a list of package paths that
- * should be excluded from loading. The loading
- * of these packages is delegated to the system class
- * loader. They will be shared across test runs.
- * <p>
- * The list of excluded package paths is specified in
- * a properties file "excluded.properties" that is located in
- * the same place as the TestCaseClassLoader class.
- * <p>
- * <b>Known limitation:</b> the VerifyClassLoader cannot load classes
- * from jar files.
- */
-
-
-public class VerifyClassLoader extends ClassLoader {
- /** scanned class path */
- private String[] fPathItems;
-
- /** excluded paths */
- private String[] fExcluded= {};
-
- /**
- * Constructs a VerifyClassLoader. It scans the class path
- * and the excluded package paths
- */
- public VerifyClassLoader() {
- super();
- String classPath= System.getProperty("java.class.path");
- String separator= System.getProperty("path.separator");
-
- // first pass: count elements
- StringTokenizer st= new StringTokenizer(classPath, separator);
- int i= 0;
- while (st.hasMoreTokens()) {
- st.nextToken();
- i++;
- }
- // second pass: split
- fPathItems= new String[i];
- st= new StringTokenizer(classPath, separator);
- i= 0;
- while (st.hasMoreTokens()) {
- fPathItems[i++]= st.nextToken();
- }
-
- }
- public java.net.URL getResource(String name) {
- return ClassLoader.getSystemResource(name);
- }
- public InputStream getResourceAsStream(String name) {
- return ClassLoader.getSystemResourceAsStream(name);
- }
- protected boolean isExcluded(String name) {
- // exclude the "java" packages.
- // They always need to be excluded so that they are loaded by the system class loader
- if (name.startsWith("java"))
- return true;
-
- // exclude the user defined package paths
- for (int i= 0; i < fExcluded.length; i++) {
- if (name.startsWith(fExcluded[i])) {
- return true;
- }
- }
- return false;
- }
- public synchronized Class loadClass(String name, boolean resolve)
- throws ClassNotFoundException {
-
- Class c= findLoadedClass(name);
- if (c != null)
- return c;
- //
- // Delegate the loading of excluded classes to the
- // standard class loader.
- //
- if (isExcluded(name)) {
- try {
- c= findSystemClass(name);
- return c;
- } catch (ClassNotFoundException e) {
- // keep searching
- }
- }
- if (c == null) {
- File file= locate(name);
- if (file == null)
- throw new ClassNotFoundException();
- byte data[]= loadClassData(file);
- c= defineClass(name, data, 0, data.length);
- }
- if (resolve)
- resolveClass(c);
- return c;
- }
- private byte[] loadClassData(File f) throws ClassNotFoundException {
- try {
- //System.out.println("loading: "+f.getPath());
- FileInputStream stream= new FileInputStream(f);
-
- try {
- byte[] b= new byte[stream.available()];
- stream.read(b);
- stream.close();
- return b;
- }
- catch (IOException e) {
- throw new ClassNotFoundException();
- }
- }
- catch (FileNotFoundException e) {
- throw new ClassNotFoundException();
- }
- }
- /**
- * Locate the given file.
- * @return Returns null if file couldn't be found.
- */
- private File locate(String fileName) {
- fileName= fileName.replace('.', '/')+".class";
- File path= null;
-
- if (fileName != null) {
- for (int i= 0; i < fPathItems.length; i++) {
- path= new File(fPathItems[i], fileName);
- if (path.exists())
- return path;
- }
- }
- return null;
- }
-}
-
-public void loadAndRun(String className) throws Throwable {
- //System.out.println("Loading " + className + "...");
- Class testClass = new VerifyClassLoader().loadClass(className);
- //System.out.println("Loaded " + className);
- try {
- Method main = testClass.getMethod("main", new Class[] {String[].class});
- //System.out.println("Running " + className);
- main.invoke(null, new Object[] {new String[] {}});
- //System.out.println("Finished running " + className);
- } catch (NoSuchMethodException e) {
- return;
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
-}
-public static void main(String[] args) throws IOException {
- VerifyTests verify = new VerifyTests();
- verify.portNumber = Integer.parseInt(args[0]);
- verify.run();
-}
-public void run() throws IOException {
- ServerSocket server = new ServerSocket(this.portNumber);
- this.socket = server.accept();
- this.socket.setTcpNoDelay(true);
- server.close();
-
- DataInputStream in = new DataInputStream(this.socket.getInputStream());
- final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
- while (true) {
- final String className = in.readUTF();
- Thread thread = new Thread() {
- public void run() {
- try {
- loadAndRun(className);
- out.writeBoolean(true);
- System.err.println(VerifyTests.class.getName());
- System.out.println(VerifyTests.class.getName());
- } catch (Throwable e) {
- e.printStackTrace();
- try {
- System.err.println(VerifyTests.class.getName());
- System.out.println(VerifyTests.class.getName());
- out.writeBoolean(false);
- } catch (IOException e1) {
- }
- }
- }
- };
- thread.start();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.compiler/test.xml b/org.eclipse.jdt.core.tests.compiler/test.xml
deleted file mode 100644
index 862e2d4..0000000
--- a/org.eclipse.jdt.core.tests.compiler/test.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <property name="eclipse-home" value="${basedir}\..\.."/>
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="plugin-name" value="org.eclipse.jdt.core.tests.compiler"/>
- <property name="library-file"
- value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <!-- Parser tests -->
- <property name="jdt-parser-folder"
- value="${eclipse-home}/jdt_parser_folder"/>
- <delete dir="${jdt-parser-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jdt-parser-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jdt.core.tests.compiler.parser.TestAll"/>
- </ant>
-
- <!-- Compiler regression tests -->
- <property name="jdt-compiler-folder"
- value="${eclipse-home}/jdt_compiler_folder"/>
- <delete dir="${jdt-compiler-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jdt-compiler-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jdt.core.tests.compiler.regression.TestAll"/>
- </ant>
-
- <!-- Evaluation tests -->
- <property name="jdt-eval-folder"
- value="${eclipse-home}/jdt_eval_folder"/>
- <delete dir="${jdt-eval-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jdt-eval-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jdt.core.tests.eval.TestAll"/>
- </ant>
-
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
diff --git a/org.eclipse.jdt.core.tests.model/.classpath b/org.eclipse.jdt.core.tests.model/.classpath
deleted file mode 100644
index 5e85bdf..0000000
--- a/org.eclipse.jdt.core.tests.model/.classpath
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.debug"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.core"/>
- <classpathentry kind="src" path="/org.junit"/>
- <classpathentry kind="src" path="/org.eclipse.jdt.core.tests.compiler"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/.cvsignore b/org.eclipse.jdt.core.tests.model/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/org.eclipse.jdt.core.tests.model/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/.project b/org.eclipse.jdt.core.tests.model/.project
deleted file mode 100644
index 808e66b..0000000
--- a/org.eclipse.jdt.core.tests.model/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core.tests.model</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.jdt.core</project>
- <project>org.eclipse.jdt.core.tests.compiler</project>
- <project>org.eclipse.jdt.debug</project>
- <project>org.junit</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
deleted file mode 100644
index 4042d21..0000000
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip
deleted file mode 100644
index dc11d08..0000000
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/jclMin.jar b/org.eclipse.jdt.core.tests.model/JCL/jclMin.jar
deleted file mode 100644
index 3907379..0000000
--- a/org.eclipse.jdt.core.tests.model/JCL/jclMin.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/jclMinsrc.zip b/org.eclipse.jdt.core.tests.model/JCL/jclMinsrc.zip
deleted file mode 100644
index 7c3809c..0000000
--- a/org.eclipse.jdt.core.tests.model/JCL/jclMinsrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/about.html b/org.eclipse.jdt.core.tests.model/about.html
deleted file mode 100644
index f43b493..0000000
--- a/org.eclipse.jdt.core.tests.model/about.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org 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
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Third Party Content</h3>
-
-<p>The Content includes items that may be have been sourced from third parties as follows:</p>
-
-<p><b>JUnit 3.7</b></p>
-<p>The plug-in is based on software developed by JUnit.org. Your use of JUnit 3.7 in both source and binary code
-form contained in the plug-in is subject to the terms and conditions of the IBM Public License 1.0 which is available at
-<a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>.
-The source code is located in workspace/Converter/junit.</p>
-
-<p>i) IBM effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;</p>
-<p>ii) IBM effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;</p>
-<p>iii) IBM states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/build.properties b/org.eclipse.jdt.core.tests.model/build.properties
deleted file mode 100644
index 511e60e..0000000
--- a/org.eclipse.jdt.core.tests.model/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- test.xml,\
- about.html,\
- *.jar,\
- JCL/,\
- workspace/
-src.includes = about.html
-source.jdtcoretestsmodel.jar = src
diff --git a/org.eclipse.jdt.core.tests.model/plugin.xml b/org.eclipse.jdt.core.tests.model/plugin.xml
deleted file mode 100644
index 24b2203..0000000
--- a/org.eclipse.jdt.core.tests.model/plugin.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.jdt.core.tests.model"
- name="Java Model Tests"
- version="2.1.0">
-
- <runtime>
- <library name="jdtcoretestsmodel.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.jdt.debug"/>
- <import plugin="org.eclipse.jdt.core"/>
- <import plugin="org.junit"/>
- <import plugin="org.eclipse.jdt.core.tests.compiler"/>
- </requires>
-
- <extension point = "org.eclipse.jdt.core.classpathVariableInitializer">
- <classpathVariableInitializer
- variable="TEST_LIB"
- class="org.eclipse.jdt.core.tests.model.VariablesInitializer"/>
- <classpathVariableInitializer
- variable="TEST_SRC"
- class="org.eclipse.jdt.core.tests.model.VariablesInitializer"/>
- <classpathVariableInitializer
- variable="TEST_ROOT"
- class="org.eclipse.jdt.core.tests.model.VariablesInitializer"/>
- </extension>
-
- <extension point = "org.eclipse.jdt.core.classpathContainerInitializer">
- <classpathContainerInitializer
- id="org.eclipse.jdt.core.tests.model.TEST_CONTAINER"
- class="org.eclipse.jdt.core.tests.model.ContainerInitializer"/>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java
deleted file mode 100644
index 926d6f5..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java
+++ /dev/null
@@ -1,9756 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import java.util.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.jdom.*;
-import org.eclipse.jdt.core.util.IModifierConstants;
-
-public class ASTConverterTest extends ConverterTestSetup {
-
- public ASTConverterTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new Suite(ASTConverterTest.class.getName());
-
- if (true) {
- Class c = ASTConverterTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTConverterTest(methods[i].getName()));
- }
- }
- return suite;
- }
- suite.addTest(new ASTConverterTest("test0204"));
- return suite;
- }
-
- public void test0001() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0001", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
-
- // check that we have the right tree
- CompilationUnit unit = this.ast.newCompilationUnit();
- PackageDeclaration packageDeclaration = this.ast.newPackageDeclaration();
- packageDeclaration.setName(this.ast.newSimpleName("test0001"));//$NON-NLS-1$
- unit.setPackage(packageDeclaration);
- ImportDeclaration importDeclaration = this.ast.newImportDeclaration();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"),//$NON-NLS-1$
- this.ast.newSimpleName("util"));//$NON-NLS-1$
- importDeclaration.setName(name);
- importDeclaration.setOnDemand(true);
- unit.imports().add(importDeclaration);
- TypeDeclaration type = this.ast.newTypeDeclaration();
- type.setInterface(false);
- type.setModifiers(Modifier.PUBLIC);
- type.setName(this.ast.newSimpleName("Test"));//$NON-NLS-1$
- MethodDeclaration methodDeclaration = this.ast.newMethodDeclaration();
- methodDeclaration.setConstructor(false);
- methodDeclaration.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
- methodDeclaration.setName(this.ast.newSimpleName("main"));//$NON-NLS-1$
- methodDeclaration.setReturnType(this.ast.newPrimitiveType(PrimitiveType.VOID));
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setModifiers(Modifier.NONE);
- variableDeclaration.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String"))));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("args"));//$NON-NLS-1$
- methodDeclaration.parameters().add(variableDeclaration);
- org.eclipse.jdt.core.dom.Block block = this.ast.newBlock();
- MethodInvocation methodInvocation = this.ast.newMethodInvocation();
- name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("Hello");//$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();
- literal.setLiteralValue(" world");//$NON-NLS-1$
- infixExpression.setRightOperand(literal);//$NON-NLS-1$
- methodInvocation.arguments().add(infixExpression);
- ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- block.statements().add(expressionStatement);
- methodDeclaration.setBody(block);
- type.bodyDeclarations().add(methodDeclaration);
- unit.types().add(type);
- assertTrue("Both AST trees should be identical", result.subtreeMatch(new ASTMatcher(), unit));//$NON-NLS-1$
- checkSourceRange(result, new String(source), source);
- }
-
- /**
- * Test allocation expression: new Object() ==> ClassInstanceCreation
- */
- public void test0002() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0002", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setName(this.ast.newSimpleName("Object")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Object() ==> ClassInstanceCreation
- */
- public void test0003() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0003", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Object"));//$NON-NLS-1$
- classInstanceCreation.setName(name);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Exception("ERROR") ==> ClassInstanceCreation
- */
- public void test0004() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0004", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Exception"));//$NON-NLS-1$
- classInstanceCreation.setName(name);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("ERROR"); //$NON-NLS-1$
- classInstanceCreation.arguments().add(literal);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Exception(\"ERROR\")", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Object() {} ==> ClassInstanceCreation
- */
- public void test0005() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0005", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Object"));//$NON-NLS-1$
- classInstanceCreation.setName(name);
- AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
- classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Object() {}", source); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression;
- Name name2 = classInstanceCreation2.getName();
- checkSourceRange(name2, "java.lang.Object", source); //$NON-NLS-1$
- }
-
-
- /**
- * Test allocation expression: new java.lang.Runnable() { public void run() {}} ==> ClassInstanceCreation
- */
- public void test0006() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0006", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Runnable"));//$NON-NLS-1$
- classInstanceCreation.setName(name);
- MethodDeclaration methodDeclaration = this.ast.newMethodDeclaration();
- methodDeclaration.setBody(this.ast.newBlock());
- methodDeclaration.setConstructor(false);
- methodDeclaration.setModifiers(Modifier.PUBLIC);
- methodDeclaration.setName(this.ast.newSimpleName("run"));//$NON-NLS-1$
- methodDeclaration.setReturnType(this.ast.newPrimitiveType(PrimitiveType.VOID));
- AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
- anonymousClassDeclaration.bodyDeclarations().add(methodDeclaration);
- classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Runnable() { public void run() {}}", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new Test().new D() ==> ClassInstanceCreation
- */
- public void test0007() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0007", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- ASTNode expression = (ASTNode) ((MethodInvocation) expressionStatement.getExpression()).arguments().get(0);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setName(this.ast.newSimpleName("D")); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreationExpression = this.ast.newClassInstanceCreation();
- classInstanceCreationExpression.setName(this.ast.newSimpleName("Test")); //$NON-NLS-1$
- classInstanceCreation.setExpression(classInstanceCreationExpression);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new Test().new D()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[] {1, 2, 3, 4} ==> ArrayCreation
- */
- public void test0008() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0008", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("3"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- arrayCreation.setInitializer(arrayInitializer);
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[] {1, 2, 3, 4}", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[][] {{1}, {2}} ==> ArrayCreation
- */
- public void test0009() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0009", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer();
- innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- arrayInitializer.expressions().add(innerArrayInitializer);
- innerArrayInitializer = this.ast.newArrayInitializer();
- innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- arrayInitializer.expressions().add(innerArrayInitializer);
- arrayCreation.setInitializer(arrayInitializer);
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[][] {{1}, {2}}", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[3] ==> ArrayCreation
- */
- public void test0010() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0010", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[3]", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[3][] ==> ArrayCreation
- */
- public void test0011() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0011", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
- arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[3][]", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[][] {{},{}} ==> ArrayCreation
- */
- public void test0012() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0012", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(innerArrayInitializer);
- innerArrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(innerArrayInitializer);
- arrayCreation.setInitializer(arrayInitializer);
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[][] {{}, {}}", source); //$NON-NLS-1$
- }
-
- /**
- * int i; ==> VariableDeclarationFragment
- */
- public void test0013() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0013", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * int i = 0; ==> VariableDeclarationFragment
- */
- public void test0014() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0014", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = 0;", source); //$NON-NLS-1$
- }
-
- /**
- * i = 1; ==> ExpressionStatement(Assignment)
- */
- public void test0015() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0015", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("1")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i = 1;", source); //$NON-NLS-1$
- }
-
- /**
- * i += 2; ==> ExpressionStatement(Assignment)
- */
- public void test0016() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0016", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.PLUS_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i += 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i -= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0017() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0017", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.MINUS_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i -= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i *= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0018() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0018", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.TIMES_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i *= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i /= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0019() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0019", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i /= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i &= 2 ==> ExpressionStatement(Assignment)
- */
- public void test0020() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0020", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i &= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i |= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0021() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0021", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i |= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i ^= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0022() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0022", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i ^= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i %= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0023() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0023", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i %= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i <<= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0024() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0024", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i <<= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i >>= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0025() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0025", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i >>= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i >>>= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0026() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0026", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i >>>= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * --i; ==> ExpressionStatement(PrefixExpression)
- */
- public void test0027() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0027", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "--i;", source); //$NON-NLS-1$
- }
-
- /**
- * --i; ==> ExpressionStatement(PrefixExpression)
- */
- public void test0028() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0028", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "++i;", source); //$NON-NLS-1$
- }
-
- /**
- * i--; ==> ExpressionStatement(PostfixExpression)
- */
- public void test0029() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0029", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i--;", source); //$NON-NLS-1$
- }
-
- /**
- * i++; ==> ExpressionStatement(PostfixExpression)
- */
- public void test0030() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0030", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i++;", source); //$NON-NLS-1$
- }
-
- /**
- * (String) o; ==> ExpressionStatement(CastExpression)
- */
- public void test0031() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0031", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("o"));//$NON-NLS-1$
- castExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "String s = (String) o;", source); //$NON-NLS-1$
- }
-
- /**
- * (int) d; ==> ExpressionStatement(CastExpression)
- */
- public void test0032() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0032", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
- castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = (int) d;", source); //$NON-NLS-1$
- }
-
- /**
- * (float) d; ==> ExpressionStatement(CastExpression)
- */
- public void test0033() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0033", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("f")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
- castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.FLOAT));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.FLOAT));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "float f = (float) d;", source); //$NON-NLS-1$
- }
-
- /**
- * (byte) d; ==> ExpressionStatement(CastExpression)
- */
- public void test0034() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0034", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
- castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.BYTE));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BYTE));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "byte b = (byte) d;", source); //$NON-NLS-1$
- }
-
- /**
- * (short) d; ==> ExpressionStatement(CastExpression)
- */
- public void test0035() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0035", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
- castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.SHORT));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.SHORT));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "short s = (short) d;", source); //$NON-NLS-1$
- }
-
- /**
- * (long) d; ==> ExpressionStatement(CastExpression)
- */
- public void test0036() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0036", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("l")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
- castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "long l = (long) d;", source); //$NON-NLS-1$
- }
-
- /**
- * (char) i; ==> ExpressionStatement(CastExpression)
- */
- public void test0037() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0037", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$
- castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.CHAR));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(castExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.CHAR));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "char c = (char) i;", source); //$NON-NLS-1$
- }
-
- /**
- * int.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0038() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0038", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "int.class", source); //$NON-NLS-1$
- }
-
- /**
- * void.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0039() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0039", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.VOID));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "void.class", source); //$NON-NLS-1$
- }
-
- /**
- * double.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0040() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0040", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.DOUBLE));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "double.class", source); //$NON-NLS-1$
- }
-
- /**
- * long.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0041() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0041", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "long.class", source); //$NON-NLS-1$
- }
-
- /**
- * false ==> BooleanLiteral
- */
- public void test0042() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0042", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- BooleanLiteral literal = this.ast.newBooleanLiteral(false);
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "false", source); //$NON-NLS-1$
- }
-
- /**
- * true ==> BooleanLiteral
- */
- public void test0043() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0043", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- BooleanLiteral literal = this.ast.newBooleanLiteral(true);
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * null ==> NullLiteral
- */
- public void test0044() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0044", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NullLiteral literal = this.ast.newNullLiteral();
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * CharLiteral ==> CharacterLiteral
- */
- public void test0045() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0045", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- CharacterLiteral literal = this.ast.newCharacterLiteral();
- literal.setEscapedValue("'c'"); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "'c'", source); //$NON-NLS-1$
- }
-
- /**
- * DoubleLiteral ==> NumberLiteral
- */
- public void test0046() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0046", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("1.00001");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "1.00001", source); //$NON-NLS-1$
- }
-
- /**
- * FloatLiteral ==> NumberLiteral
- */
- public void test0047() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0047", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("1.00001f");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "1.00001f", source); //$NON-NLS-1$
- }
-
- /**
- * IntLiteral ==> NumberLiteral
- */
- public void test0048() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0048", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("30000");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "30000", source); //$NON-NLS-1$
- }
-
- /**
- * IntLiteralMinValue ==> NumberLiteral
- */
- public void test0049() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0049", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("-2147483648");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-2147483648", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteral ==> NumberLiteral
- */
- public void test0050() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0050", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "2147483648L", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteral ==> NumberLiteral (negative value)
- */
- public void test0051() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0051", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(literal);
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
- assertTrue("Both AST trees should be identical", prefixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-2147483648L", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteralMinValue ==> NumberLiteral
- */
- public void test0052() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0052", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("-9223372036854775808L");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-9223372036854775808L", source); //$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0053() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0053", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- /*
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello World");*/
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("Hello");//$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();
- literal.setLiteralValue(" World");//$NON-NLS-1$
- infixExpression.setRightOperand(literal);//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\"", source); //$NON-NLS-1$
- }
-
- /**
- * AND_AND_Expression ==> InfixExpression
- */
- public void test0054() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0054", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b3 = b && b2;", source); //$NON-NLS-1$
- }
-
- /**
- * OR_OR_Expression ==> InfixExpression
- */
- public void test0055() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0055", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_OR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b3 = b || b2;", source); //$NON-NLS-1$
- }
-
- /**
- * EqualExpression ==> InfixExpression
- */
- public void test0056() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0056", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b3 = b == b2;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (+) ==> InfixExpression
- */
- public void test0057() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0057", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i + j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (-) ==> InfixExpression
- */
- public void test0058() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0058", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i - j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (*) ==> InfixExpression
- */
- public void test0059() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0059", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.TIMES);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i * j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (/) ==> InfixExpression
- */
- public void test0060() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0060", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.DIVIDE);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i / j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (%) ==> InfixExpression
- */
- public void test0061() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0061", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.REMAINDER);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i % j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (^) ==> InfixExpression
- */
- public void test0062() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0062", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.XOR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i ^ j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (&) ==> InfixExpression
- */
- public void test0063() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0063", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.AND);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i & j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (|) ==> InfixExpression
- */
- public void test0064() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0064", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.OR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i | j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (<) ==> InfixExpression
- */
- public void test0065() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0065", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b < b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (<=) ==> InfixExpression
- */
- public void test0066() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0066", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b <= b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (>) ==> InfixExpression
- */
- public void test0067() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0067", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.GREATER);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b > b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (>=) ==> InfixExpression
- */
- public void test0068() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0068", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.GREATER_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b >= b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (!=) ==> InfixExpression
- */
- public void test0069() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0069", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b != b1;", source); //$NON-NLS-1$
- }
-
- /**
- * InstanceofExpression ==> InfixExpression
- */
- public void test0070() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0070", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression();
- instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o"));//$NON-NLS-1$
- SimpleType simpleType = this.ast.newSimpleType(this.ast.newSimpleName("Integer"));//$NON-NLS-1$
- instanceOfExpression.setRightOperand(simpleType);
- variableDeclarationFragment.setInitializer(instanceOfExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b = o instanceof Integer;", source); //$NON-NLS-1$
- }
-
- /**
- * InstanceofExpression ==> InfixExpression
- */
- public void test0071() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0071", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression();
- instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o")); //$NON-NLS-1$
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Integer")); //$NON-NLS-1$
- Type type = ast.newSimpleType(name);
- instanceOfExpression.setRightOperand(type);
- variableDeclarationFragment.setInitializer(instanceOfExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b = o instanceof java.lang.Integer;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (!) ==> PrefixExpression
- */
- public void test0072() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0072", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.NOT);
- prefixExpression.setOperand(this.ast.newSimpleName("b"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b1 = !b;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (~) ==> PrefixExpression
- */
- public void test0073() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0073", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT);
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = ~i;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (+) ==> PrefixExpression
- */
- public void test0074() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0074", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.PLUS);
- prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = +2;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (-) ==> PrefixExpression
- */
- public void test0075() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0075", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
- prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = -2;", source); //$NON-NLS-1$
- }
-
- /**
- * ConditionalExpression ==> ConditionalExpression
- */
- public void test0076() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0076", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
- InfixExpression condition = this.ast.newInfixExpression();
- condition.setLeftOperand(this.ast.newSimpleName("args")); //$NON-NLS-1$
- condition.setRightOperand(this.ast.newNullLiteral()); //$NON-NLS-1$
- condition.setOperator(InfixExpression.Operator.NOT_EQUALS);
- conditionalExpression.setExpression(condition);
- conditionalExpression.setThenExpression(this.ast.newBooleanLiteral(true));
- conditionalExpression.setElseExpression(this.ast.newBooleanLiteral(false));
- variableDeclarationFragment.setInitializer(conditionalExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b = args != null ? true : false;", source); //$NON-NLS-1$
- }
-
- /**
- * ConditionalExpression ==> ConditionalExpression
- */
- public void test0077() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0077", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
- conditionalExpression.setExpression(this.ast.newBooleanLiteral(true));
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("args"), //$NON-NLS-1$
- this.ast.newSimpleName("length")); //$NON-NLS-1$
- conditionalExpression.setThenExpression(name);
- conditionalExpression.setElseExpression(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(conditionalExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = true ? args.length: 0;", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> SuperMethodInvocation
- */
- public void test0078() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0078", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation();
- superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "super.bar();", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> SuperMethodInvocation
- */
- public void test0079() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0079", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation();
- superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- superMethodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "super.bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> MethodInvocation
- */
- public void test0080() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0080", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- MethodInvocation methodInvocation = this.ast.newMethodInvocation();
- methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> MethodInvocation
- */
- public void test0081() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0081", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- MethodInvocation methodInvocation = this.ast.newMethodInvocation();
- methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- methodInvocation.setExpression(this.ast.newThisExpression());
- methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "this.bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0082() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0082", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (;;);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0083() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0083", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newBlock());
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i = 0; i < 10; i++) {}", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0084() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0084", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i = 0; i < 10; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0085() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0085", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i = 0;; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0086() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0086", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (; i < 10; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0087() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0087", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (;;i++);", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- */
- public void test0088() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0088", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- statement.setModifiers(Modifier.NONE);
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- */
- public void test0089() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0089", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"),//$NON-NLS-1$
- this.ast.newSimpleName("lang")//$NON-NLS-1$
- ),
- this.ast.newSimpleName("String") //$NON-NLS-1$
- );
- statement.setType(this.ast.newSimpleType(name));
- statement.setModifiers(Modifier.NONE);
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "java.lang.String s;", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- */
- public void test0090() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0090", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- ArrayInitializer initializer = this.ast.newArrayInitializer();
- initializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- initializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(initializer);
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- statement.setModifiers(Modifier.NONE);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int[] tab = {1, 2};", source); //$NON-NLS-1$
- }
-
- /**
- * Argument ==> SingleVariableDeclaration
- */
- public void test0091() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0091", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- MethodDeclaration method = (MethodDeclaration)((TypeDeclaration) ((CompilationUnit) result).types().get(0)).bodyDeclarations().get(0);
- SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setModifiers(Modifier.NONE);
- variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "String s", source); //$NON-NLS-1$
- }
-
- /**
- * Argument ==> SingleVariableDeclaration
- */
- public void test0092() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0092", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- MethodDeclaration method = (MethodDeclaration)((TypeDeclaration) ((CompilationUnit) result).types().get(0)).bodyDeclarations().get(0);
- SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setModifiers(Modifier.FINAL);
- variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "final String s", source); //$NON-NLS-1$
- assertEquals("Wrong dimension", 0, node.getExtraDimensions()); //$NON-NLS-1$
- }
-
- /**
- * Break ==> BreakStatement
- */
- public void test0093() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0093", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) node;
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break;", source); //$NON-NLS-1$
- }
-
- /**
- * Continue ==> ContinueStatement
- */
- public void test0094() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0094", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) node;
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue;", source); //$NON-NLS-1$
- }
-
- /**
- * Continue with Label ==> ContinueStatement
- */
- public void test0095() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0095", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((CompilationUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$
- }
-
- /**
- * Break + label ==> BreakStatement
- */
- public void test0096() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0096", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((CompilationUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break label;", source); //$NON-NLS-1$
- }
-
- /**
- * SwitchStatement ==> SwitchStatement
- */
- public void test0097() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0097", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SwitchStatement switchStatement = this.ast.newSwitchStatement();
- switchStatement.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$
- SwitchCase _case = this.ast.newSwitchCase();
- _case.setExpression(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- switchStatement.statements().add(_case);
- switchStatement.statements().add(this.ast.newBreakStatement());
- _case = this.ast.newSwitchCase();
- _case.setExpression(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- switchStatement.statements().add(_case);
- MethodInvocation methodInvocation = this.ast.newMethodInvocation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- methodInvocation.arguments().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- switchStatement.statements().add(expressionStatement);
- switchStatement.statements().add(this.ast.newBreakStatement());
- _case = this.ast.newSwitchCase();
- _case.setExpression(null);
- switchStatement.statements().add(_case);
- methodInvocation = this.ast.newMethodInvocation();
- name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("default"); //$NON-NLS-1$
- methodInvocation.arguments().add(literal);
- expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- switchStatement.statements().add(expressionStatement);
- assertTrue("Both AST trees should be identical", switchStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "switch(i) {\n" +//$NON-NLS-1$
- " case 1: \n" +//$NON-NLS-1$
- " break;\n" +//$NON-NLS-1$
- " case 2:\n" +//$NON-NLS-1$
- " System.out.println(2);\n" +//$NON-NLS-1$
- " break;\n" +//$NON-NLS-1$
- " default:\n" +//$NON-NLS-1$
- " System.out.println(\"default\");\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- SwitchStatement switchStatement2 = (SwitchStatement) node;
- List statements = switchStatement2.statements();
- assertEquals("wrong size", 7, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(5);
- assertTrue("Not a case statement", stmt instanceof SwitchCase); //$NON-NLS-1$
- SwitchCase switchCase = (SwitchCase) stmt;
- assertTrue("Not the default case", switchCase.isDefault()); //$NON-NLS-1$
- }
-
- /**
- * EmptyStatement ==> EmptyStatement
- */
- public void test0098() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0098", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- EmptyStatement emptyStatement = this.ast.newEmptyStatement();
- assertTrue("Both AST trees should be identical", emptyStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, ";", source); //$NON-NLS-1$
- }
-
- /**
- * DoStatement ==> DoStatement
- */
- public void test0099() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0099", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- DoStatement doStatement = this.ast.newDoStatement();
- Block block = this.ast.newBlock();
- block.statements().add(this.ast.newEmptyStatement());
- doStatement.setBody(block);
- doStatement.setExpression(this.ast.newBooleanLiteral(true));
- assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "do {;\n" +//$NON-NLS-1$
- " } while(true);";//$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * WhileStatement ==> WhileStatement
- */
- public void test0100() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0100", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- WhileStatement whileStatement = this.ast.newWhileStatement();
- whileStatement.setExpression(this.ast.newBooleanLiteral(true));
- whileStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "while(true);", source);//$NON-NLS-1$
- }
-
- /**
- * WhileStatement ==> WhileStatement
- */
- public void test0101() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0101", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- WhileStatement whileStatement = this.ast.newWhileStatement();
- whileStatement.setExpression(this.ast.newBooleanLiteral(true));
- whileStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "while(true) {}", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0102() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0102", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\"", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0103() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0103", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + \"!\"", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0104() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0104", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- NumberLiteral numberLiteral = this.ast.newNumberLiteral();//$NON-NLS-1$
- numberLiteral.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(numberLiteral);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0105() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0105", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 + 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0106() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0106", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
-
- InfixExpression infixExpression2 = this.ast.newInfixExpression();
- infixExpression2.setOperator(InfixExpression.Operator.PLUS);
- infixExpression2.setLeftOperand(infixExpression);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression2.setRightOperand(literal);
-
- InfixExpression infixExpression3 = this.ast.newInfixExpression();
- infixExpression3.setOperator(InfixExpression.Operator.PLUS);
- infixExpression3.setLeftOperand(infixExpression2);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression3.setRightOperand(literal);
-
- assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 - 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0107() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0107", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 - 5 - 6 - 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0108() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0108", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$
- stringLiteral.setLiteralValue("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(stringLiteral);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"4\" + 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0109() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0109", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$
- stringLiteral.setLiteralValue("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(stringLiteral);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
-
- InfixExpression infixExpression2 = this.ast.newInfixExpression();
- infixExpression2.setOperator(InfixExpression.Operator.PLUS);
- infixExpression2.setLeftOperand(infixExpression);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression2.setRightOperand(literal);
-
- InfixExpression infixExpression3 = this.ast.newInfixExpression();
- infixExpression3.setOperator(InfixExpression.Operator.PLUS);
- infixExpression3.setLeftOperand(infixExpression2);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression3.setRightOperand(literal);
-
- assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"4\" - 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * ReturnStatement ==> ReturnStatement
- */
- public void test0110() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0110", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "return 2;", source);//$NON-NLS-1$
- }
-
- /**
- * ReturnStatement ==> ReturnStatement
- */
- public void test0111() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0111", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "return 2\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * SynchronizedStatement ==> SynchronizedStatement
- */
- public void test0112() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0112", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SynchronizedStatement synchronizedStatement = this.ast.newSynchronizedStatement();
- synchronizedStatement.setExpression(this.ast.newThisExpression());
- synchronizedStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", synchronizedStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "synchronized(this) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- */
- public void test0113() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0113", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- tryStatement.setBody(this.ast.newBlock());
- tryStatement.setFinally(this.ast.newBlock());
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setModifiers(Modifier.NONE);
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
- exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " } catch(Exception e) {\n" +//$NON-NLS-1$
- " } finally {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- */
- public void test0114() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0114", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- tryStatement.setBody(this.ast.newBlock());
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setModifiers(Modifier.NONE);
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
- exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " } catch(Exception e) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- */
- public void test0115() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0115", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- Block block = this.ast.newBlock();
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- block.statements().add(returnStatement);
- tryStatement.setBody(block);
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setModifiers(Modifier.NONE);
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
- exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " return 2;\n" +//$NON-NLS-1$
- " } catch(Exception e) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0116() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0116", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0117() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0117", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0118() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0118", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0119() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0119", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "if (true)\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0120() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0120", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newEmptyStatement());
- ifStatement.setElseStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true)\\u003B\n" +//$NON-NLS-1$
- "\t\telse ;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0121() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0121", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newBlock());
- ifStatement.setElseStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true) {}\n" +//$NON-NLS-1$
- " else ;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0122() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0122", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setThenStatement(returnStatement);
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "if (true) return 2\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0123() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0123", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setThenStatement(returnStatement);
- returnStatement = this.ast.newReturnStatement();
- literal = this.ast.newNumberLiteral();
- literal.setToken("3");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setElseStatement(returnStatement);
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true) return 2;\n" +//$NON-NLS-1$
- " else return 3;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0124() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0124", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10");//$NON-NLS-1$
- fragment.setInitializer(literal);
- fragment.setExtraDimensions(0);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$
- fragment.setInitializer(this.ast.newNullLiteral());
- fragment.setExtraDimensions(1);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
- fragment.setExtraDimensions(0);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
- fragment.setExtraDimensions(2);
- statement.fragments().add(fragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- statement.setModifiers(Modifier.NONE);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
- checkSourceRange(node, "int x= 10, z[] = null, i, j[][];", source);//$NON-NLS-1$
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0125() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0125", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10");//$NON-NLS-1$
- fragment.setInitializer(literal);
- fragment.setExtraDimensions(0);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$
- fragment.setInitializer(this.ast.newNullLiteral());
- fragment.setExtraDimensions(1);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
- fragment.setExtraDimensions(0);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
- fragment.setExtraDimensions(2);
- statement.fragments().add(fragment);
- statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- statement.setModifiers(Modifier.NONE);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int[] x= 10, z[] = null, i, j[][];", source); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
- }
-
- /**
- * ForStatement
- */
- public void test0126() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0126", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
- variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String")), 1));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
- forStatement.updaters().add(prefixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (String[] tab[] = null;; ++i) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String[] tab[] = null", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement
- */
- public void test0127() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0127", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
- variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
- forStatement.updaters().add(prefixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (String tab[] = null;; ++i) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement
- */
- public void test0128() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0128", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
- variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (String tab[] = null;; i++/**/) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "i++", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$
- }
-
- /**
- * FieldDeclaration
- */
- public void test0129() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0129", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- VariableDeclarationFragment frag = (VariableDeclarationFragment) ((FieldDeclaration) node).fragments().get(0);
- assertTrue("Not a declaration", frag.getName().isDeclaration()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- fragment.setExtraDimensions(0);
- FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(fragment);
- fieldDeclaration.setModifiers(Modifier.NONE);
- fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", fieldDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * FieldDeclaration
- */
- public void test0130() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0130", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x")); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10"); //$NON-NLS-1$
- fragment.setInitializer(literal);
- fragment.setExtraDimensions(0);
- FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(fragment);
- fieldDeclaration.setModifiers(Modifier.PUBLIC);
- fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("y"));//$NON-NLS-1$
- fragment.setExtraDimensions(1);
- fragment.setInitializer(this.ast.newNullLiteral());
- fieldDeclaration.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
- fragment.setExtraDimensions(0);
- fieldDeclaration.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
- fragment.setExtraDimensions(2);
- fieldDeclaration.fragments().add(fragment);
- assertTrue("Both AST trees should be identical", fieldDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "public int x= 10, y[] = null, i, j[][];", source); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((FieldDeclaration) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "y[] = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
- }
-
- /**
- * Argument with final modifier
- */
- public void test0131() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0131", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- assertTrue("Not a declaration", ((MethodDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$
- List parameters = ((MethodDeclaration) node).parameters();
- assertTrue("Parameters.length != 1", parameters.size() == 1); //$NON-NLS-1$
- SingleVariableDeclaration arg = (SingleVariableDeclaration) ((MethodDeclaration) node).parameters().get(0);
- SingleVariableDeclaration singleVariableDeclaration = this.ast.newSingleVariableDeclaration();
- singleVariableDeclaration.setModifiers(Modifier.FINAL);
- singleVariableDeclaration.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- singleVariableDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", singleVariableDeclaration.subtreeMatch(new ASTMatcher(), arg)); //$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- checkSourceRange(arg, "final int i", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MethodDeclaration
- */
- public void test0132() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0132", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((MethodDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n void foo(final int i) {}", source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MethodDeclaration
- */
- public void test0133() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0133", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((MethodDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MethodDeclaration
- */
- public void test0134() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0134", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((MethodDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0135() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0135", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0136() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0136", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0137() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0137", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0138() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0138", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0139() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0139", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0140() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0140", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0141() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0141", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " class B {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0142() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0142", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0143() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0143", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0144() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0144", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0145() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0145", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0146() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0146", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "static {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0147() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0147", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " static {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- */
- public void test0148() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0148", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- */
- public void test0149() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0149", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0150() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0150", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertTrue("The compilation unit is malformed", !isMalformed(unit)); //$NON-NLS-1$
- assertTrue("The package declaration is malformed", !isMalformed(unit.getPackage())); //$NON-NLS-1$
- List imports = unit.imports();
- assertTrue("The imports list size is not one", imports.size() == 1); //$NON-NLS-1$
- assertTrue("The first import is not malformed", isMalformed((ASTNode) imports.get(0))); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0151() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0151", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0152() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0152", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The type is malformed", !isMalformed(node)); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The field is malformed", !isMalformed(node)); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0153() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0153", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-
- /**
- * Checking binding of package declaration
- */
- public void test0154() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0154", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- IBinding binding = compilationUnit.getPackage().getName().resolveBinding();
- assertNotNull("The package binding is null", binding); //$NON-NLS-1$
- assertTrue("The binding is not a package binding", binding instanceof IPackageBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = (IPackageBinding) binding;
- assertEquals("The package name is incorrect", "test0154", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = compilationUnit.getPackage().getName().resolveBinding();
- assertTrue("The package binding is not canonical", binding == binding2); //$NON-NLS-1$
- }
-
- /**
- * Checking arguments positions
- */
- public void test0155() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0155", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("The result is not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDecl = (MethodDeclaration) node;
- List parameters = methodDecl.parameters();
- assertTrue("The parameters size is different from 2", parameters.size() == 2); //$NON-NLS-1$
- Object parameter = parameters.get(0);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "int i", source); //$NON-NLS-1$
- parameter = parameters.get(1);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "final boolean b", source); //$NON-NLS-1$
- }
-
- /**
- * Checking arguments positions
- */
- public void test0156() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0156", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("The result is not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDecl = (MethodDeclaration) node;
- List parameters = methodDecl.parameters();
- assertTrue("The parameters size is different from 1", parameters.size() == 1); //$NON-NLS-1$
- Object parameter = parameters.get(0);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "int i", source); //$NON-NLS-1$
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertTrue("The statements size is different from 2", statements.size() == 2); //$NON-NLS-1$
- ASTNode statement = (ASTNode) statements.get(0);
- assertTrue("The statements[0] is a postfixExpression statement", statement instanceof ExpressionStatement); //$NON-NLS-1$
- }
-
- /**
- * Check canonic binding for fields
- */
- public void test0157() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "", "Test0157.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
- assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$
- typeBinding = variableBinding.getType();
- assertTrue("The type is not an array type", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical", typeBinding == variableBinding.getType()); //$NON-NLS-1$
- SimpleName name = fragment.getName();
- assertTrue("is a declaration", name.isDeclaration()); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$
- assertTrue("not a field", ((IVariableBinding) binding).isField()); //$NON-NLS-1$
- }
-
- /**
- * Check canonic bindings for fields
- */
- public void test0158() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "", "Test0158.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
- assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
- SimpleName simpleName = typeDeclaration.getName();
- assertTrue("is a declaration", simpleName.isDeclaration()); //$NON-NLS-1$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", simpleName.getIdentifier(), binding.getName()); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = variableBinding.getType();
- assertTrue("The type is not an array type", typeBinding2.isArray()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical", typeBinding2 == variableBinding.getType()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical with the declaration type binding", typeBinding == typeBinding2.getElementType()); //$NON-NLS-1$
- }
-
- /**
- * Define an anonymous type
- */
- public void test0159() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0159", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- }
-
- /**
- * Check bindings for multiple field declarations
- */
- public void test0160() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0160", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
- assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list size is not 2", variableFragments.size() == 2); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding1 = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding1); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding1 == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding type1 = variableBinding1.getType();
- assertNotNull("The type is null", type1); //$NON-NLS-1$
- assertTrue("The field type is canonical", type1 == variableBinding1.getType()); //$NON-NLS-1$
- assertTrue("The type is not an array type",type1.isArray()); //$NON-NLS-1$
- assertTrue("The type dimension is 1", type1.getDimensions() == 1); //$NON-NLS-1$
- fragment = (VariableDeclarationFragment) variableFragments.get(1);
- IVariableBinding variableBinding2 = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding2); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding2 == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding type2 = variableBinding2.getType();
- type2 = variableBinding2.getType();
- assertNotNull("The type is null", type2); //$NON-NLS-1$
- assertTrue("The field type is canonical", type2 == variableBinding2.getType()); //$NON-NLS-1$
- assertTrue("The type is not an array type",type2.isArray()); //$NON-NLS-1$
- assertTrue("The type dimension is 2", type2.getDimensions() == 2); //$NON-NLS-1$
- assertTrue("Element type is canonical", type1.getElementType() == type2.getElementType()); //$NON-NLS-1$
- assertTrue("type1.id < type2.id", variableBinding1.getVariableId() < variableBinding2.getVariableId()); //$NON-NLS-1$
-
- }
-
- /**
- * Check ITypeBinding APIs:
- * - getModifiers()
- * - getElementType() when it is not an array type
- * - getDimensions() when it is not an array type
- * - getDeclaringClass()
- * - getDeclaringName()
- * - getName()
- * - isNested()
- * - isAnonymous()
- * - isLocal()
- * - isMember()
- * - isArray()
- * - getDeclaredMethods() => returns binding for default constructor
- * - isPrimitive()
- * - isTopLevel()
- * - getSuperclass()
- */
- public void test0161() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0161", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$
- assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertTrue("From source", !superclass.isFromSource()); //$NON-NLS-1$
- ITypeBinding supersuperclass = superclass.getSuperclass();
- assertNull("No superclass for java.lang.Object", supersuperclass); //$NON-NLS-1$
- ITypeBinding[] interfaces = typeBinding.getInterfaces();
- assertNotNull("No interfaces", interfaces); //$NON-NLS-1$
- assertEquals("More then one super interface", 1, interfaces.length); //$NON-NLS-1$
- assertTrue("is not an interface", interfaces[0].isInterface()); //$NON-NLS-1$
- assertTrue("From source", !interfaces[0].isFromSource()); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Check ITypeBinding APIs:
- * - getModifiers()
- * - getElementType() when it is not an array type
- * - getDimensions() when it is not an array type
- * - getDeclaringClass()
- * - getDeclaringName()
- * - getName()
- * - isNested()
- * - isAnonymous()
- * - isLocal()
- * - isMember()
- * - isArray()
- * - getDeclaredMethods() => returns binding for default constructor
- * - isPrimitive()
- * - isTopLevel()
- * - getSuperclass()
- */
- public void test0162() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0162", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$
- assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains no methos", 0, methods.length); //$NON-NLS-1$
- assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("A class", !typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("Not an interface", typeBinding.isInterface()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Test binding for anonymous declaration: new java.lang.Object() {}
- */
- public void test0163() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0163", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- assertTrue("Not an anonymous type declaration", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation anonymousClass = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = anonymousClass.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an anonymous class", typeBinding.isAnonymous()); //$NON-NLS-1$
- assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNotNull("This is a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("The name is not empty", "", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Test binding for member type declaration
- */
- public void test0164() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0164", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertEquals("The modifier is not default", Modifier.PRIVATE, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("The name is not 'B'", "B", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("Not a member class", typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Test binding for local type declaration
- */
- public void test0165() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0165", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an type declaration", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDeclaration = statement.getTypeDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("The name is not 'C'", "C", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0166() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0166", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("Fragment list is not 4 ", fragments.size() == 4); //$NON-NLS-1$
- VariableDeclarationFragment fragment1 = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding binding1 = fragment1.resolveBinding();
- assertNotNull("Binding is null", binding1); //$NON-NLS-1$
- assertEquals("wrong name for binding1", "x", binding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding1", 0, binding1.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding1.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding1.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding1 = binding1.getType();
- assertNotNull("typeBinding1 is null", typeBinding1); //$NON-NLS-1$
- assertTrue("typeBinding1 is not a primitive type", typeBinding1.isPrimitive()); //$NON-NLS-1$
- assertTrue("typeBinding1 is not canonical", typeBinding1 == binding1.getType()); //$NON-NLS-1$
- VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fragments.get(1);
- IVariableBinding binding2 = fragment2.resolveBinding();
- assertNotNull("Binding is null", binding2); //$NON-NLS-1$
- assertEquals("wrong name for binding2", "z", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding2", 0, binding2.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding2.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding2.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = binding2.getType();
- assertNotNull("typeBinding2 is null", typeBinding2); //$NON-NLS-1$
- assertTrue("typeBinding2 is not an array type", typeBinding2.isArray()); //$NON-NLS-1$
- assertTrue("typeBinding2 is not canonical", typeBinding2 == binding2.getType()); //$NON-NLS-1$
- assertTrue("primitive type is not canonical", typeBinding1 == typeBinding2.getElementType()); //$NON-NLS-1$
- assertEquals("dimension is 1", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not int[]", "int[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- VariableDeclarationFragment fragment3 = (VariableDeclarationFragment) fragments.get(2);
- IVariableBinding binding3 = fragment3.resolveBinding();
- assertNotNull("Binding is null", binding3); //$NON-NLS-1$
- assertEquals("wrong name for binding3", "i", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding3", 0, binding3.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding3.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding3.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding3 = binding3.getType();
- assertNotNull("typeBinding3 is null", typeBinding3); //$NON-NLS-1$
- assertTrue("typeBinding3 is not an primitive type", typeBinding3.isPrimitive()); //$NON-NLS-1$
- assertTrue("typeBinding3 is not canonical", typeBinding3 == binding3.getType()); //$NON-NLS-1$
- assertTrue("primitive type is not canonical", typeBinding1 == typeBinding3); //$NON-NLS-1$
- assertEquals("dimension is 0", 0, typeBinding3.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not the primitive type int", "int", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- VariableDeclarationFragment fragment4 = (VariableDeclarationFragment) fragments.get(3);
- IVariableBinding binding4 = fragment4.resolveBinding();
- assertNotNull("Binding is null", binding4); //$NON-NLS-1$
- assertEquals("wrong name for binding4", "j", binding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding4", 0, binding4.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding4.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding4.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding4 = binding4.getType();
- assertNotNull("typeBinding4 is null", typeBinding4); //$NON-NLS-1$
- assertTrue("typeBinding4 is not an array type", typeBinding4.isArray()); //$NON-NLS-1$
- assertTrue("typeBinding4 is not canonical", typeBinding4 == binding4.getType()); //$NON-NLS-1$
- assertTrue("primitive type is not canonical", typeBinding1 == typeBinding4.getElementType()); //$NON-NLS-1$
- assertEquals("dimension is 2", 2, typeBinding4.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not int[][]", "int[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("ids in the wrong order", binding1.getVariableId() < binding2.getVariableId()); //$NON-NLS-1$
- assertTrue("ids in the wrong order", binding2.getVariableId() < binding3.getVariableId()); //$NON-NLS-1$
- assertTrue("ids in the wrong order", binding3.getVariableId() < binding4.getVariableId()); //$NON-NLS-1$
- }
-
- /**
- * Check source position for new Test[1+2].length.
- */
- public void test0167() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0167", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Instance of VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("fragment list size is not 1", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertNotNull("No initialization", initialization); //$NON-NLS-1$
- assertTrue("Not a FieldAccess", initialization instanceof FieldAccess); //$NON-NLS-1$
- checkSourceRange(initialization, "new Test[1+2].length", source); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0168.test
- */
- public void test0168() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0168.test1", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "test0168.test1", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 2", components.length == 2); //$NON-NLS-1$
- assertEquals("wrong component name", "test0168", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong component name", "test1", components[1]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong type", IPackageBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0169
- */
- public void test0169() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0169", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "test0169", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$
- assertEquals("wrong component name", "test0169", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong type", IPackageBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0170
- */
- public void test0170() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "", "Test0170.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "UNNAMED", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 0", components.length == 0); //$NON-NLS-1$
- assertEquals("wrong type", IPackageBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Not an unnamed package", packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0171
- */
- public void test0171() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0171", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() == 2); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "test0171", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$
- assertEquals("wrong component name", "test0171", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong type", IPackageBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
-
- typeDeclaration = (TypeDeclaration) types.get(1);
- typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding2 = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == packageBinding2); //$NON-NLS-1$
- }
-
- /**
- * Check method binding
- */
- public void test0172() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0172", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("methods.length != 4", 4, methods.length); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("body declaration size != 3", 3, bodyDeclarations.size()); //$NON-NLS-1$
- MethodDeclaration method1 = (MethodDeclaration) bodyDeclarations.get(0);
- IMethodBinding methodBinding1 = method1.resolveBinding();
- assertNotNull("No method binding for foo", methodBinding1); //$NON-NLS-1$
- SimpleName simpleName = method1.getName();
- assertTrue("not a declaration", simpleName.isDeclaration()); //$NON-NLS-1$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", binding.getName(), simpleName.getIdentifier()); //$NON-NLS-1$
- assertTrue("Canonical method binding", methodBinding1 == methods[1]); //$NON-NLS-1$
- assertTrue("declaring class is canonical", typeBinding == methodBinding1.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding[] exceptionTypes = methodBinding1.getExceptionTypes();
- assertNotNull("No exception types", exceptionTypes); //$NON-NLS-1$
- assertEquals("One exception", 1, exceptionTypes.length); //$NON-NLS-1$
- assertEquals("wrong name for exception", "IOException", exceptionTypes[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier", Modifier.NONE, methodBinding1.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "foo", methodBinding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters = methodBinding1.getParameterTypes();
- assertNotNull("No parameters", parameters); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters.length); //$NON-NLS-1$
- assertEquals("wrong type", "int[]", parameters[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "void", methodBinding1.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("A constructor", !methodBinding1.isConstructor()); //$NON-NLS-1$
-
- MethodDeclaration method2 = (MethodDeclaration) bodyDeclarations.get(1);
- IMethodBinding methodBinding2 = method2.resolveBinding();
- assertNotNull("No method binding for main", methodBinding2); //$NON-NLS-1$
- assertTrue("Canonical method binding", methodBinding2 == methods[2]); //$NON-NLS-1$
- assertTrue("declaring class is canonical", typeBinding == methodBinding2.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding[] exceptionTypes2 = methodBinding2.getExceptionTypes();
- assertNotNull("No exception types", exceptionTypes2); //$NON-NLS-1$
- assertEquals("No exception", 0, exceptionTypes2.length); //$NON-NLS-1$
- assertEquals("wrong modifier", Modifier.PUBLIC | Modifier.STATIC, methodBinding2.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "main", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters2 = methodBinding2.getParameterTypes();
- assertNotNull("No parameters", parameters2); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters2.length); //$NON-NLS-1$
- assertEquals("wrong type for parameter2[0]", "String[]", parameters2[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "void", methodBinding2.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("A constructor", !methodBinding2.isConstructor()); //$NON-NLS-1$
-
- MethodDeclaration method3 = (MethodDeclaration) bodyDeclarations.get(2);
- IMethodBinding methodBinding3 = method3.resolveBinding();
- assertNotNull("No method binding for main", methodBinding3); //$NON-NLS-1$
- assertTrue("Canonical method binding", methodBinding3 == methods[3]); //$NON-NLS-1$
- assertTrue("declaring class is canonical", typeBinding == methodBinding3.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding[] exceptionTypes3 = methodBinding3.getExceptionTypes();
- assertNotNull("No exception types", exceptionTypes3); //$NON-NLS-1$
- assertEquals("No exception", 1, exceptionTypes3.length); //$NON-NLS-1$
- assertEquals("wrong modifier", Modifier.PRIVATE, methodBinding3.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "bar", methodBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters3 = methodBinding3.getParameterTypes();
- assertNotNull("No parameters", parameters3); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters3.length); //$NON-NLS-1$
- assertEquals("wrong type", "String", parameters3[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "String", methodBinding3.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("A constructor", !methodBinding3.isConstructor()); //$NON-NLS-1$
- assertTrue("The binding is not canonical", parameters3[0] == methodBinding3.getReturnType()); //$NON-NLS-1$
- }
-
- /**
- * i++; IVariableBinding
- */
- public void test0173() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0173", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- assertTrue("a declaration", !name.isDeclaration()); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertTrue(variableBinding == binding);
- }
-
- /**
- * i++; IVariableBinding (field)
- */
- public void test0174() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0174", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- List fragments = fieldDeclaration.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertTrue(variableBinding == binding);
- }
-
- /**
- * int i = 0; Test IntBinding for the field declaration and the 0 literal
- */
- public void test0175() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0175", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- List fragments = fieldDeclaration.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- ITypeBinding typeBinding = fragment.getInitializer().resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * ThisReference
- */
- public void test0176() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0176", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- assertTrue("Not a field access", returnStatement.getExpression() instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) returnStatement.getExpression();
- ITypeBinding typeBinding = fieldAccess.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Expression expr = fieldAccess.getExpression();
- assertTrue("Not a this expression", expr instanceof ThisExpression); //$NON-NLS-1$
- ThisExpression thisExpression = (ThisExpression) expr;
- ITypeBinding typeBinding2 = thisExpression.resolveTypeBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * i++; IVariableBinding
- */
- public void test0177() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0177", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 1, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertEquals("return type is not int", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(variableBinding == binding);
- }
-
- /**
- * SuperReference
- */
- public void test0178() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0178", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 1, 0, 0);
- assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a field access", expr instanceof SuperFieldAccess); //$NON-NLS-1$
- SuperFieldAccess fieldAccess = (SuperFieldAccess) expr;
- ITypeBinding typeBinding = fieldAccess.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Allocation expression
- */
- public void test0179() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0179", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * Allocation expression
- */
- public void test0180() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0180", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- assertTrue("No an array creation", initialization instanceof ArrayCreation); //$NON-NLS-1$
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * Allocation expression
- */
- public void test0181() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0181", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * BinaryExpression
- */
- public void test0182() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0182", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0183() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0183", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10 && i < 20", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0184() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0184", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10 || i < 20", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0185() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0185", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i == 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0186() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0186", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "o == o", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0187() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0187", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node2;
- Expression expr = whileStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0188() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0188", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 2);
- assertTrue("DoStatement", node2 instanceof DoStatement); //$NON-NLS-1$
- DoStatement statement = (DoStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0189() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0189", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$
- ForStatement statement = (ForStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0190() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0190", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 2, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement statement = (IfStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "scanner.x < selection.start && selection.start < scanner.y", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0191() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0191", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$
- Assignment statement = (Assignment) ex;
- Expression rightExpr = statement.getRightHandSide();
- assertTrue("Not an infix expression", rightExpr instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) rightExpr;
- Expression expr = infixExpression.getRightOperand();
- assertNotNull("No right hand side expression", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "2 < 20", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0192() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0192", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "0", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0193() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0193", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "new Inner()", source); //$NON-NLS-1$
- assertEquals("Wrong type", "Inner", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Initializer
- */
- public void test0194() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0194", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "new Inner[10]", source); //$NON-NLS-1$
- assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong type", "Inner[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Initializer
- */
- public void test0195() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0195", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 1, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("MethodInvocation", ex instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) ex;
- checkSourceRange(methodInvocation, "a.useFile(/*]*/a.getFile()/*[*/)", source); //$NON-NLS-1$
- List list = methodInvocation.arguments();
- assertTrue("Parameter list not empty", list.size() == 1); //$NON-NLS-1$
- Expression parameter = (Expression) list.get(0);
- assertTrue("Not a method invocation", parameter instanceof MethodInvocation); //$NON-NLS-1$
- ITypeBinding typeBinding = parameter.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter, "a.getFile()", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0196() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0196", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 2);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$
- Assignment statement = (Assignment) ex;
- Expression rightExpr = statement.getRightHandSide();
- assertTrue("Not an instanceof expression", rightExpr instanceof InstanceofExpression); //$NON-NLS-1$
- ITypeBinding typeBinding = rightExpr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong type", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(rightExpr, "inner instanceof Inner", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0197() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0197", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 1, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("MethodInvocation", ex instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) ex;
- checkSourceRange(methodInvocation, "a.getFile()/*[*/.getName()", source); //$NON-NLS-1$
- Expression receiver = methodInvocation.getExpression();
- assertTrue("Not a method invocation", receiver instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation2 = (MethodInvocation) receiver;
- ITypeBinding typeBinding = methodInvocation2.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(methodInvocation2, "a.getFile()", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0198() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0198", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not an infixExpression", expr instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expr;
- Expression left = infixExpression.getLeftOperand();
- assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) left;
- Expression right = infixExpression2.getRightOperand();
- assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression3 = (InfixExpression) right;
- assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$
- ITypeBinding typeBinding = infixExpression3.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression3, "20 * 30", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0199() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0199", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not an infixExpression", initialization instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) initialization;
- Expression left = infixExpression.getLeftOperand();
- assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) left;
- Expression right = infixExpression2.getRightOperand();
- assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression3 = (InfixExpression) right;
- assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$
- ITypeBinding typeBinding = infixExpression3.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression3, "10 * 30", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0200() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0200", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 1, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not an infixExpression", initialization instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) initialization;
- Expression receiver = fieldAccess.getExpression();
- assertTrue("ArrayCreation", receiver instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) receiver;
- List dimensions = arrayCreation.dimensions();
- assertEquals("Wrong dimension", 1, dimensions.size()); //$NON-NLS-1$
- Expression dim = (Expression) dimensions.get(0);
- assertTrue("InfixExpression", dim instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) dim;
- ITypeBinding typeBinding = infixExpression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression, "1 + 2", source); //$NON-NLS-1$
- }
-
- /**
- * Position inside for statement: PR 3300
- */
- public void test0201() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0201", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node2;
- List initializers = forStatement.initializers();
- assertTrue("wrong size", initializers.size() == 1); //$NON-NLS-1$
- Expression init = (Expression) initializers.get(0);
- checkSourceRange(init, "int i= 0", source); //$NON-NLS-1$
- }
-
- /**
- * PR 7386
- */
- public void test0202() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0202", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- checkSourceRange(fieldDeclaration, "int f= (2);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- checkSourceRange(initialization, "(2)", source); //$NON-NLS-1$
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * PR 7386
- */
- public void test0203() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0203", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- checkSourceRange(fieldDeclaration, "int f= (2);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization;
- checkSourceRange(parenthesizedExpression, "(2)", source); //$NON-NLS-1$
- Expression expr = parenthesizedExpression.getExpression();
- checkSourceRange(expr, "2", source); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("type binding is canonical", typeBinding == parenthesizedExpression.resolveTypeBinding()); //$NON-NLS-1$
- }
-
- /**
- * PR 7386
- */
- public void test0204() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0204", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- checkSourceRange(fieldDeclaration, "int f= ((2));", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization;
- checkSourceRange(parenthesizedExpression, "((2))", source); //$NON-NLS-1$
- Expression expr = parenthesizedExpression.getExpression();
- assertTrue("Not a parenthesized expression", expr instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression2 = (ParenthesizedExpression) expr;
- checkSourceRange(parenthesizedExpression2, "(2)", source); //$NON-NLS-1$
- expr = parenthesizedExpression2.getExpression();
- checkSourceRange(expr, "2", source); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = parenthesizedExpression.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("type binding is canonical", typeBinding == parenthesizedExpression2.resolveTypeBinding()); //$NON-NLS-1$
- }
-
-
- /**
- * Local class end position when trailing comment
- */
- public void test0205() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0205", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("TypeDeclarationStatement", node2 instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node2;
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- assertEquals("wrong name", "AA", typeDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(typeDeclaration, "class AA extends Test {}", source); //$NON-NLS-1$
- }
-
- /**
- * QualifiedName
- */
- public void test0206() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0206", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 2, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expr;
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not an int (typeBinding)", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(qualifiedName, "field.field.field.field.i", source); //$NON-NLS-1$
- assertTrue("Not a simple name", qualifiedName.getName().isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = qualifiedName.getName();
- assertTrue("a declaration", !simpleName.isDeclaration()); //$NON-NLS-1$
- checkSourceRange(simpleName, "i", source); //$NON-NLS-1$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typebinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Not an int (typeBinding2)", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not Test", "Test", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.PUBLIC, variableBinding.getModifiers()); //$NON-NLS-1$
- Name qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.field.field.field", source); //$NON-NLS-1$
- ITypeBinding typeBinding5 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding5", typeBinding5); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifiedName = (QualifiedName) qualifierName;
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "field", source); //$NON-NLS-1$
- ITypeBinding typeBinding6 = simpleName.resolveTypeBinding();
- assertNotNull("No binding6", typeBinding6); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.field.field", source); //$NON-NLS-1$
- ITypeBinding typeBinding7 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding7", typeBinding7); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifiedName = (QualifiedName) qualifierName;
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "field", source); //$NON-NLS-1$
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.field", source); //$NON-NLS-1$
- ITypeBinding typeBinding3 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- qualifiedName = (QualifiedName) qualifierName;
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "field", source); //$NON-NLS-1$
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$
- assertTrue("a declaration", !((SimpleName)qualifierName).isDeclaration()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field", source); //$NON-NLS-1$
- ITypeBinding typeBinding4 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding4", typeBinding4); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check javadoc for MethodDeclaration
- */
- public void test0207() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0207", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((MethodDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n void foo(final int i) {}", source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MethodDeclaration
- */
- public void test0208() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0208", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((MethodDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MethodDeclaration
- */
- public void test0209() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0209", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((MethodDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0210() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0210", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0211() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0211", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0212() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0212", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0213() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0213", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0214() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0214", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0215() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0215", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0216() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0216", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " class B {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0217() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0217", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0218() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0218", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0219() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0219", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0220() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0220", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0221() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0221", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "static {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0222() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0222", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " static {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- */
- public void test0223() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0223", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$
- Javadoc javadoc = this.ast.newJavadoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- */
- public void test0224() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0224", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Continue ==> ContinueStatement
- */
- public void test0225() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0225", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((CompilationUnit) result, 0, 0, 0);
- checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$
- checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$
- }
-
- /**
- * Break + label ==> BreakStatement
- */
- public void test0226() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0226", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((CompilationUnit) result, 0, 0, 0);
- checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break label;", source); //$NON-NLS-1$
- checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$
- }
-
- /**
- * QualifiedName
- */
- public void test0227() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0227", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 3, 2, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expr;
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not an long (typeBinding)", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(qualifiedName, "field.fB.fA.j", source); //$NON-NLS-1$
-
- SimpleName simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "j", source); //$NON-NLS-1$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertEquals("Not an long (typeBinding2)", "long", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not A", "A", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.NONE, variableBinding.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "j", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- Name qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.fB.fA", source); //$NON-NLS-1$
- qualifiedName = (QualifiedName) qualifierName;
- ITypeBinding typeBinding3 = qualifiedName.resolveTypeBinding();
- assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("Not an A", "A", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "fA", source); //$NON-NLS-1$
- ITypeBinding typeBinding4 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding4", typeBinding4); //$NON-NLS-1$
- assertEquals("Not an A", "A", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = qualifiedName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("VariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding2 = (IVariableBinding) binding2;
- assertEquals("Not B", "B", variableBinding2.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.NONE, variableBinding2.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "fA", variableBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.fB", source); //$NON-NLS-1$
- qualifiedName = (QualifiedName) qualifierName;
- ITypeBinding typeBinding5 = qualifiedName.resolveTypeBinding();
- assertNotNull("No typeBinding5", typeBinding5); //$NON-NLS-1$
- assertEquals("Not a B", "B", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "fB", source); //$NON-NLS-1$
- ITypeBinding typeBinding6 = simpleName.resolveTypeBinding();
- assertNotNull("No typebinding6", typeBinding6); //$NON-NLS-1$
- assertEquals("not a B", "B", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding3 = qualifiedName.resolveBinding();
- assertNotNull("No binding2", binding3); //$NON-NLS-1$
- assertTrue("VariableBinding", binding3 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding3 = (IVariableBinding) binding3;
- assertEquals("Not C", "C", variableBinding3.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.NONE, variableBinding3.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "fB", variableBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field", source); //$NON-NLS-1$
- simpleName = (SimpleName) qualifierName;
- ITypeBinding typeBinding7 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding7", typeBinding7); //$NON-NLS-1$
- assertEquals("Not a C", "C", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding4 = simpleName.resolveBinding();
- assertNotNull("No binding4", binding4); //$NON-NLS-1$
- assertTrue("VariableBinding", binding4 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding4 = (IVariableBinding) binding4;
- assertEquals("Not Test", "Test", variableBinding4.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not public", Modifier.PUBLIC, variableBinding4.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "field", variableBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "C", variableBinding4.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * QualifiedName as TypeReference
- */
- public void test0228() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0228", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- checkSourceRange(expr, "test0228.Test.foo()", source); //$NON-NLS-1$
- assertTrue("MethodInvocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertNotNull("no qualifier", qualifier); //$NON-NLS-1$
- assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- checkSourceRange(qualifiedName, "test0228.Test", source); //$NON-NLS-1$
- ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong type", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Not a type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
-
- }
-
- /**
- * MethodInvocation
- */
- public void test0229() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0229", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expr = expressionStatement.getExpression();
- assertTrue("MethodInvocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- ITypeBinding typeBinding = qualifier.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName methodName = methodInvocation.getName();
- IBinding binding2 = methodName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- }
-
- /**
- * MethodInvocation
- */
- public void test0230() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0230", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expr = expressionStatement.getExpression();
- assertTrue("MethodInvocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- checkSourceRange(expr, "err.println()", source); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("SimpleName", qualifier instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) qualifier;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong name", "err", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wron type name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * MethodInvocation
- */
- public void test0231() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0231", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expr = expressionStatement.getExpression();
- assertTrue("MethodInvocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- ITypeBinding typeBinding = qualifier.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName methodName = methodInvocation.getName();
- IBinding binding2 = methodName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- Name name = qualifiedName.getQualifier();
- assertTrue("SimpleName", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong type name", "System", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * MethodInvocation
- */
- public void test0232() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0232", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = variableDeclarationFragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("QualifiedName", initialization instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) initialization;
- SimpleName simpleName = qualifiedName.getName();
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding2.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertNull("No declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$
- }
-
- /**
- * Checking that only syntax errors are reported for the MALFORMED tag
- */
- public void test0233() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0233", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * Checking that null is returned for a resolveBinding if the type is unknown
- */
- public void test0234() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0234", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$
- assertTrue("FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNull("binding not null", variableBinding); //$NON-NLS-1$
- }
-
- /**
- * Checking that null is returned for a resolveBinding if the type is unknown
- */
- public void test0235() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0235", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("problems found", 0, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("problems found", 0, unit.getProblems().length); //$NON-NLS-1$
- assertTrue("FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding); //$NON-NLS-1$
- }
-
- /**
- * Test the removal of a IField inside a CU that has an initializer
- */
- public void test0236() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0236", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType type = sourceUnit.getType("Test"); //$NON-NLS-1$
- assertNotNull("No type", type); //$NON-NLS-1$
- IField field = type.getField("i"); //$NON-NLS-1$
- assertNotNull("No field", field); //$NON-NLS-1$
- field.delete(true, null);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=9452
- */
- public void test0237() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "junit.framework", "TestCase.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- }
-
- /**
- * Check ThisExpression
- */
- public void test0238() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0238", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDecl = (MethodDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a method invocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- checkSourceRange(methodInvocation, "Test.this.bar()", source); //$NON-NLS-1$
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$
- ThisExpression thisExpression = (ThisExpression) qualifier;
- Name name = thisExpression.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check ThisExpression
- */
- public void test0239() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0239", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 1, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDecl = (MethodDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a SuperMethodInvocation", expr instanceof SuperMethodInvocation); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expr;
- Name name = superMethodInvocation.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name methodName = superMethodInvocation.getName();
- IBinding binding2 = methodName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("No an IMethodBinding", binding2 instanceof IMethodBinding); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding2;
- assertEquals("Not bar", "bar", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not T", "T", methodBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check FieldAccess
- */
- public void test0240() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0240", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDecl = (MethodDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a field access", expr instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expr;
- Expression qualifier = fieldAccess.getExpression();
- assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$
- ThisExpression thisExpression = (ThisExpression) qualifier;
- Name name = thisExpression.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name fieldName = fieldAccess.getName();
- IBinding binding2 = fieldName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong name", "f", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong modifier", Modifier.PUBLIC, binding2.getModifiers()); //$NON-NLS-1$
- ITypeBinding typeBinding = fieldName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check order of body declarations
- */
- public void test0241() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0241", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0);
- assertTrue("Not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- assertTrue("Not a declaration", ((TypeDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$
- assertEquals("Wrong size", 11, ((TypeDeclaration)node).bodyDeclarations().size()); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 1);
- assertTrue("Not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 2);
- assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 3);
- assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 4);
- assertTrue("Not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 5);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 6);
- assertTrue("Not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 7);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 8);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 9);
- assertTrue("Not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- node = getASTNode((CompilationUnit) result, 0, 10);
- assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- }
-
- /**
- * Check ThisExpression
- */
- public void test0242() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0242", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 1, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDecl = (MethodDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a SuperFieldAccess", expr instanceof SuperFieldAccess); //$NON-NLS-1$
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expr;
- Name name = superFieldAccess.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name fieldName = superFieldAccess.getName();
- IBinding binding2 = fieldName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("No an IVariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding2;
- assertEquals("Not f", "f", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not T", "T", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = fieldName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check catch clause positions:
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570
- */
- public void test0243() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0243", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$
- TryStatement tryStatement = (TryStatement) node;
- List catchClauses = tryStatement.catchClauses();
- assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- checkSourceRange(catchClause, "catch (Exception e){m();}", source); //$NON-NLS-1$
- }
-
- /**
- * Check catch clause positions:
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570
- */
- public void test0244() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0244", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$
- TryStatement tryStatement = (TryStatement) node;
- List catchClauses = tryStatement.catchClauses();
- assertEquals("wrong size", 2, catchClauses.size()); //$NON-NLS-1$
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- checkSourceRange(catchClause, "catch (RuntimeException e){m();}", source); //$NON-NLS-1$
- catchClause = (CatchClause) catchClauses.get(1);
- checkSourceRange(catchClause, "catch(Exception e) {}", source); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=10587
- */
- public void test0245() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0245", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expr = returnStatement.getExpression();
- assertTrue("not a name", expr instanceof Name); //$NON-NLS-1$
- Name name = (Name) expr;
- IBinding binding = name.resolveBinding();
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not i", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not int", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ASTNode declaringNode = unit.findDeclaringNode(variableBinding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertTrue("Not a VariableDeclarationFragment", declaringNode instanceof VariableDeclarationFragment); //$NON-NLS-1$
- }
-
- /**
- * Test binding resolution for import declaration
- */
- public void test0246() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0246", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- List imports = unit.imports();
- assertEquals("wrong imports size", 2, imports.size()); //$NON-NLS-1$
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- assertTrue("Not on demand", importDeclaration.isOnDemand()); //$NON-NLS-1$
- checkSourceRange(importDeclaration, "import java.util.*;", source); //$NON-NLS-1$
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- assertEquals("Wrong name", "java.util", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- importDeclaration = (ImportDeclaration) imports.get(1);
- assertTrue("On demand", !importDeclaration.isOnDemand()); //$NON-NLS-1$
- checkSourceRange(importDeclaration, "import java.io.IOException;", source); //$NON-NLS-1$
- binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("Wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Test binding resolution for import declaration
- */
- public void test0247() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0247", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- PackageDeclaration packageDeclaration = unit.getPackage();
- checkSourceRange(packageDeclaration, "package test0247;", source); //$NON-NLS-1$
- IPackageBinding binding = packageDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- assertEquals("Wrong name", "test0247", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0248() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0248", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 1, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Name name = singleVariableDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0249() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0249", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 2, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not an assignment", expression instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- Expression leftHandSide = assignment.getLeftHandSide();
- assertTrue("Not a qualified name", leftHandSide instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) leftHandSide;
- Name simpleName = qualifiedName.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertTrue("Not a IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "k", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong modifier", Modifier.STATIC, variableBinding.getModifiers()); //$NON-NLS-1$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong declaring class name", "j", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0250() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0250", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Name name = singleVariableDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check qualified name resolution for static fields
- */
- public void test0251() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0251", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- checkSourceRange(methodInvocation, "java.lang.System.out.println()", source); //$NON-NLS-1$
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$
- checkSourceRange(qualifier, "java.lang.System.out", source); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- Name typeName = qualifiedName.getQualifier();
- assertTrue("Not a QualifiedName", typeName instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedTypeName = (QualifiedName) typeName;
- IBinding binding = qualifiedTypeName.getName().resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong name", "System", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- binding = qualifiedTypeName.getQualifier().resolveBinding();
- assertNotNull("No binding2", binding); //$NON-NLS-1$
- assertEquals("Wrong type binding", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for anonymous class
- */
- public void test0252() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0252", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IMethodBinding methodBinding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$
- assertTrue("Not an anonymous class", methodBinding.getDeclaringClass().isAnonymous()); //$NON-NLS-1$
- assertEquals("Not an anonymous class of java.lang.Object", "Object", methodBinding.getDeclaringClass().getSuperclass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not an anonymous class of java.lang.Object", "java.lang", methodBinding.getDeclaringClass().getSuperclass().getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0253() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0253", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IMethodBinding methodBinding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$
- assertEquals("Wrong size", 1, methodBinding.getParameterTypes().length); //$NON-NLS-1$
- assertEquals("Wrong type", "String", methodBinding.getParameterTypes()[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0254() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0254", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 1, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IMethodBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", "C", binding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- /**
- * Check binding for allocation expression
- */
- public void test0255() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0255", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a MethodInvocation", expression instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression2;
- Type type = castExpression.getType();
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0256() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0256", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a MethodInvocation", expression instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression2;
- Type type = castExpression.getType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
- Name name = simpleType.getName();
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong type", "Object", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0257() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0257", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a MethodInvocation", expression instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression2;
- Type type = castExpression.getType();
- assertTrue("Not a primitive type", type.isPrimitiveType()); //$NON-NLS-1$
- PrimitiveType primitiveType = (PrimitiveType) type;
- assertEquals("Not int", PrimitiveType.INT, primitiveType.getPrimitiveTypeCode()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0258() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0258", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a MethodInvocation", expression instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression2;
- Type type = castExpression.getType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
- Name name = simpleType.getName();
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong type", "Object", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10663
- */
- public void test0259() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0259", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0260() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0260", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- IBinding binding = singleVariableDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- Name name = singleVariableDeclaration.getName();
- assertTrue("Not a simple name", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- assertEquals("Wrong name", "i", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertTrue("binding == binding2", binding == binding2); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding2;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10679
- */
- public void test0261() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0261", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("Wrong msg size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("Wrong pb size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- ITypeBinding binding = expression.resolveTypeBinding();
- assertNull("got a binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10676
- */
- public void test0262() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0262", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expr = expressionStatement.getExpression();
- assertTrue("Not a MethodInvocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$
- Expression expr2 = (Expression) arguments.get(0);
- assertTrue("Not a class instance creation", expr2 instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expr2;
- arguments = classInstanceCreation.arguments();
- assertEquals("Wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a string literal", expression2 instanceof StringLiteral); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression2;
- ITypeBinding typeBinding = stringLiteral.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10700
- */
- public void test0263() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0263", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expr = expressionStatement.getExpression();
- assertTrue("Not a MethodInvocation", expr instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expr;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$
- Expression expr2 = (Expression) arguments.get(0);
- assertTrue("Not a simple name", expr2 instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expr2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10699
- */
- public void test0264() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0264", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong fragment size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No anonymousclassdeclaration", anonymousClassDeclaration); //$NON-NLS-1$
- String expectedSourceRange =
- "{\n"+ //$NON-NLS-1$
- " void m(int k){\n"+ //$NON-NLS-1$
- " k= i;\n"+ //$NON-NLS-1$
- " }\n"+ //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(anonymousClassDeclaration, expectedSourceRange, source);
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
- assertEquals("Wrong name", "m", methodDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10698
- */
- public void test0265() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0265", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0266() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0266", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Inner\\u005b]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0267() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0267", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Inner[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0268() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0268", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0268.Test.Inner[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "test0268.Test.Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0268.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0269() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0269", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0269.Test.Inner[/**/]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "test0269.Test.Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0269.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0270() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0270", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0270.Test.Inner", source); //$NON-NLS-1$
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0270.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0271() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0271", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0271.Test.Inner[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "test0271.Test.Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0271.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0272() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0272", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (int i= 0; i < 10; i++) foo();", source); //$NON-NLS-1$
- Statement action = forStatement.getBody();
- checkSourceRange(action, "foo();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0273() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0273", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (int i= 0; i < 10; i++) { foo(); }", source); //$NON-NLS-1$
- Statement action = forStatement.getBody();
- checkSourceRange(action, "{ foo(); }", source); //$NON-NLS-1$
- assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- checkSourceRange(stmt, "foo();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0274() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0274", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while (i < 10) { foo(i++); }", source); //$NON-NLS-1$
- Statement action = whileStatement.getBody();
- checkSourceRange(action, "{ foo(i++); }", source); //$NON-NLS-1$
- assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- checkSourceRange(stmt, "foo(i++);", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0275() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0275", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while (i < 10) foo(i++);", source); //$NON-NLS-1$
- Statement action = whileStatement.getBody();
- checkSourceRange(action, "foo(i++);", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798
- */
- public void test0276() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0276", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- String expectedSource =
- "public void foo() {\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration.getBody(), expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798
- */
- public void test0277() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0277", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- String expectedSource =
- "public void foo() {\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration.getBody(), expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861
- */
- public void test0278() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0278", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Class c = java.lang.String.class;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861
- */
- public void test0279() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0279", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- checkSourceRange(variableDeclarationStatement, "Class c = java.lang.String.class;", source); //$NON-NLS-1$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10865
- * Check well known types
- */
- public void test0280() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0280", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- AST newAst = result.getAST();
- ITypeBinding typeBinding = newAst.resolveWellKnownType("boolean"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("char"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "char", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("byte"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "byte", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("short"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "short", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("int"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("long"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("float"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "float", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("double"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "double", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("void"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "void", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.String"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.StringBuffer"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "StringBuffer", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Throwable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Exception"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Exception", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.RuntimeException"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "RuntimeException", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Error"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Error", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Class"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Runnable"); //$NON-NLS-1$
- assertNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0281() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0281", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o= /*]*/new Object()/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0282() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0282", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "boolean b = /*]*/true/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0283() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0283", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "char c = /*]*/'c'/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "'c'", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0284() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0284", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /*]*/null/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0285() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0285", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /*]*/Object.class/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "Object.class", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0286() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0286", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "int i = /**/(2)/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "(2)", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0287() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0287", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "String[] tab = /**/new String[3]/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new String[3]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0288() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0288", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "String[] tab = /**/{ }/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "{ }", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0289() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0289", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "String s = /**/tab1[0]/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "tab1[0]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0290() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0290", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /*]*/new java.lang.Object()/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10898
- */
- public void test0291() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0291", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("no errors", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("no errors", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10913
- */
- public void test0292() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0292", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a qualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("Wrong name", "x", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("NO binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name name = qualifiedName.getQualifier();
- assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName2 = (SimpleName) name;
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("Not a type binding", binding2 instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10933
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10935
- */
- public void test0293() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0293", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
- String expectedSource =
- "{\n" + //$NON-NLS-1$
- " public void run() {\n" + //$NON-NLS-1$
- " /*]*/foo();/*[*/\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(anonymousClassDeclaration, expectedSource, source);
- expectedSource =
- "run= new Runnable() {\n" + //$NON-NLS-1$
- " public void run() {\n" + //$NON-NLS-1$
- " /*]*/foo();/*[*/\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(variableDeclarationFragment, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0294() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0294", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- String expectedSource =
- "public void fails() {\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- Block block = methodDeclaration.getBody();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(block, expectedSource, source);
- node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- methodDeclaration = (MethodDeclaration) node;
- block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10986
- */
- public void test0295() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0295", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not a method invocation", expression instanceof MethodInvocation); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
- assertNull("type binding is not null", typeBinding); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0296() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0296", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- String expectedSource =
- "public void fails() {\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- Block block = methodDeclaration.getBody();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(block, expectedSource, source);
- node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- methodDeclaration = (MethodDeclaration) node;
- block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11037
- */
- public void test0297() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0297", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- runConversion(sourceUnit, false);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0298() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0298", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a ReturnStatement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- checkSourceRange(expression, "a().length != 3", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0299() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0299", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "int i = (/**/2/**/);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a parenthesized expression", expression instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression;
- Expression expression2 = parenthesizedExpression.getExpression();
- checkSourceRange(expression2, "2", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0300() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0300", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "boolean b = /**/true/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0301() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0301", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /**/null/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11106
- */
- public void test0302() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0302", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a DoStatement", node instanceof DoStatement); //$NON-NLS-1$
- DoStatement doStatement = (DoStatement) node;
- String expectedSource =
- "do\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " while(1 < 10);"; //$NON-NLS-1$
- checkSourceRange(doStatement, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11129
- */
- public void test0303() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0303", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression2;
- Expression expression = assignment.getRightHandSide();
- assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression;
- ITypeBinding typeBinding = castExpression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "char", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = castExpression.getType();
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "char", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11151
- */
- public void test0304() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0304", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- checkSourceRange(node, "public void foo(int arg);", source); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNull("Has a body", block); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125
- */
- public void test0305() throws JavaModelException {
- char[] source =
- ("package test0304;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Test {\n" + //$NON-NLS-1$
- " public void foo(int arg) {}\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaProject project = getJavaProject("Converter"); //$NON-NLS-1$
- ASTNode result = runConversion(source, "Test.java", project); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "test0304", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125
- */
- public void test0306() throws JavaModelException {
- char[] source =
- ("package java.lang;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Object {\n" + //$NON-NLS-1$
- " public void foo(int arg) {}\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaProject project = getJavaProject("Converter"); //$NON-NLS-1$
- ASTNode result = runConversion(source, "Object.java", project); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.lang", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong size", 2, typeBinding.getDeclaredMethods().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371
- */
- public void test0307() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0307", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$
- checkSourceRange(statement, "super(10);", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371
- */
- public void test0308() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0308", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("not a method declaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$
- SuperConstructorInvocation superConstructorInvocation = (SuperConstructorInvocation) statement;
- IMethodBinding methodBinding = superConstructorInvocation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- IMethodBinding methodBinding2 = methodDeclaration.resolveBinding();
- assertNotNull("No methodBinding2", methodBinding2); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380
- */
- public void test0309() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0309", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a conditional expression", expression instanceof ConditionalExpression); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = (ConditionalExpression) expression;
- ITypeBinding typeBinding = conditionalExpression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380
- */
- public void test0310() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0310", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a qualified name", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- Name qualifier = qualifiedName.getQualifier();
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "I", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638
- */
- public void test0311() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0311", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("no body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement;
- List fragments2 = variableDeclarationStatement2.fragments();
- assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0);
- Expression expression2 = variableDeclarationFragment2.getInitializer();
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- checkSourceRange(name, "j", source); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- ASTNode declaringNode = compilationUnit.findDeclaringNode(binding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- checkSourceRange(declaringNode, "int j", source); //$NON-NLS-1$
- assertTrue("Not a single variable declaration", declaringNode instanceof SingleVariableDeclaration); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638
- * There is a error in this source. A is unresolved. Then there is no
- * declaring node.
- */
- public void test0312() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0312", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("no body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement;
- List fragments2 = variableDeclarationStatement2.fragments();
- assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0);
- Expression expression2 = variableDeclarationFragment2.getInitializer();
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- checkSourceRange(name, "j", source); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- ASTNode declaringNode = compilationUnit.findDeclaringNode(binding);
- assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11659
- */
- public void test0313() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0313", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an InfixExpression", expression instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "i+j", source); //$NON-NLS-1$
- Expression expression2 = infixExpression.getLeftOperand();
- checkSourceRange(expression2, "i", source); //$NON-NLS-1$
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- ASTNode astNode = compilationUnit.findDeclaringNode(binding);
- assertNotNull("No declaring node", astNode); //$NON-NLS-1$
- checkSourceRange(astNode, "int i", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326
- */
- public void test0314() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0314", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No result", result); //$NON-NLS-1$
- assertTrue("Not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("Wrong line number", 1, compilationUnit.lineNumber(0)); //$NON-NLS-1$
- // ensure that last character is on the last line
- assertEquals("Wrong line number", 3, compilationUnit.lineNumber(source.length - 1)); //$NON-NLS-1$
- // source.length is beyond the size of the compilation unit source
- assertEquals("Wrong line number", 1, compilationUnit.lineNumber(source.length)); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326
- */
- public void test0315() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0315", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a Return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not an instanceof expression", expression instanceof InstanceofExpression); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = (InstanceofExpression) expression;
- Type rightOperand = instanceOfExpression.getRightOperand();
- assertTrue("Not a simpleType", rightOperand instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) rightOperand;
- Name n = simpleType.getName();
- assertTrue("Not a qualified name", n instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName name = (QualifiedName) n;
- checkSourceRange(name, "java.io.Serializable", source); //$NON-NLS-1$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Serializable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name qualifier = name.getQualifier();
- assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$
- ITypeBinding typeBinding2 = qualifier.resolveTypeBinding();
- assertNull("typebinding2 is not null", typeBinding2); //$NON-NLS-1$
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- IPackageBinding pBinding = (IPackageBinding) binding;
- assertEquals("Wrong name", "java.io", pBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12454
- */
- public void test0316() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "", "Hello.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No result", result); //$NON-NLS-1$
- assertTrue("Not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12781
- */
- public void test0317() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0317", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("not an instanceof expression", expression instanceof InstanceofExpression); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = (InstanceofExpression) expression;
- Expression left = instanceOfExpression.getLeftOperand();
- assertTrue("Not a Name", left instanceof Name); //$NON-NLS-1$
- Name name = (Name) left;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong type", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type right = instanceOfExpression.getRightOperand();
- assertTrue("Not a simpleType", right instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) right;
- name = simpleType.getName();
- assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding2 = simpleName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13233
- */
- public void test0318() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0318", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("No error", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No error", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a variable declaration statement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- assertTrue("Not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0319() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0319", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayType arrayType = arrayCreation.getType();
- ITypeBinding typeBinding2 = arrayType.resolveBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding typeBinding3 = simpleType.resolveBinding();
- assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0320() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0320", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "int[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- Type elementType = arrayType.getElementType();
- assertTrue("Not a simple type", elementType.isPrimitiveType()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0321() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0321", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- checkSourceRange(type, "java.lang.Object[][]", source); //$NON-NLS-1$
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- Type elementType = arrayType.getComponentType();
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an array type", elementType.isArrayType()); //$NON-NLS-1$
- Type elementType2 = ((ArrayType) elementType).getComponentType();
- assertTrue("Not a simple type", elementType2.isSimpleType()); //$NON-NLS-1$
- ITypeBinding typeBinding3 = elementType2.resolveBinding();
- assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong dimension", 0, typeBinding3.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13231
- */
- public void test0322() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0322", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a null literal", expression instanceof NullLiteral); //$NON-NLS-1$
- NullLiteral nullLiteral = (NullLiteral) expression;
- ITypeBinding typeBinding = nullLiteral.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not the null type", typeBinding.isNullType()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", typeBinding.getQualifiedName(), "null"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0323() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0323", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression2;
- Expression expression = assignment.getRightHandSide();
- assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression;
- ITypeBinding typeBinding = castExpression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = castExpression.getType();
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0324() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0324", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression2;
- Expression expression = assignment.getRightHandSide();
- assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression;
- ITypeBinding typeBinding = castExpression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = castExpression.getType();
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0325() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0325", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression2;
- Expression expression = assignment.getRightHandSide();
- assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression;
- ITypeBinding typeBinding = castExpression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "int[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = castExpression.getType();
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "int[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14217
- */
- public void test0326() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0326", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- checkSourceRange(expressionStatement.getExpression(), "a().f= a()", source); //$NON-NLS-1$
- checkSourceRange(expressionStatement, "a().f= a();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0327() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0327", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("Wrong number of errors", 2, compilationUnit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$
- CastExpression castExpression = (CastExpression) expression;
- ITypeBinding typeBinding = castExpression.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName());
- Type type = castExpression.getType();
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0328() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0328", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "java.lang.Object[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type elementType = arrayType.getElementType();
- assertTrue("Not a simple type", elementType.isSimpleType()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ITypeBinding typeBinding3 = expression.resolveTypeBinding();
- assertNotNull("No typeBinding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayInitializer arrayInitializer = arrayCreation.getInitializer();
- assertNotNull("not array initializer", arrayInitializer); //$NON-NLS-1$
- ITypeBinding typeBinding4 = arrayInitializer.resolveTypeBinding();
- assertNotNull("No typeBinding4", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0329() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0329", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "java.lang.Object[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type elementType = arrayType.getElementType();
- assertTrue("Not a simple type", elementType.isSimpleType()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ITypeBinding typeBinding3 = expression.resolveTypeBinding();
- assertNotNull("No typeBinding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayInitializer arrayInitializer = arrayCreation.getInitializer();
- assertNotNull("not array initializer", arrayInitializer); //$NON-NLS-1$
- ITypeBinding typeBinding4 = arrayInitializer.resolveTypeBinding();
- assertNotNull("No typeBinding4", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14313
- */
- public void test0330() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0330", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- IMethodBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("wrong size", 1, methods.length); //$NON-NLS-1$
- assertTrue("not a constructor", methods[0].isConstructor()); //$NON-NLS-1$
- assertTrue("wrong name", !methods[0].getName().equals("foo")); //$NON-NLS-1$ //$NON-NLS-2$
- node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a methodDeclaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- IMethodBinding methodBinding = methodDeclaration.resolveBinding();
- assertNull("method binding not null", methodBinding); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- ITypeBinding typeBinding2 = expression.resolveTypeBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14322
- */
- public void test0331() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0331", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a QualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- IBinding binding = qualifiedName.getName().resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertTrue("Not a field", variableBinding.isField()); //$NON-NLS-1$
- assertNull("Got a declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("wrong name", "length", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14403
- */
- public void test0332() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0332", "LocalSelectionTransfer.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0333() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0333", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayType arrayType = arrayCreation.getType();
- ITypeBinding typeBinding2 = arrayType.resolveBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding typeBinding3 = simpleType.resolveBinding();
- assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- type = arrayType.getComponentType();
- assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type;
- ITypeBinding typeBinding4 = arrayType2.resolveBinding();
- assertNotNull("no type binding4", typeBinding4); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0334() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0334", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][][]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayType arrayType = arrayCreation.getType();
- checkSourceRange(arrayType, "Object[10][][]", source); //$NON-NLS-1$
- ITypeBinding typeBinding2 = arrayType.resolveBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][][]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- checkSourceRange(simpleType, "Object", source); //$NON-NLS-1$
- ITypeBinding typeBinding3 = simpleType.resolveBinding();
- assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- type = arrayType.getComponentType();
- assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type;
- checkSourceRange(arrayType2, "Object[10][]", source); //$NON-NLS-1$
- ITypeBinding typeBinding4 = arrayType2.resolveBinding();
- assertNotNull("no type binding4", typeBinding4); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- type = arrayType2.getComponentType();
- assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$
- ArrayType arrayType3 = (ArrayType) type;
- ITypeBinding typeBinding5 = arrayType3.resolveBinding();
- assertNotNull("no type binding5", typeBinding5); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(arrayType3, "Object[10]", source); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14526
- */
- public void test0335() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0335", "ExceptionTestCaseTest.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("errors found", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- Name name = typeDeclaration.getSuperclass();
- assertNotNull("no super class", name); //$NON-NLS-1$
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "junit", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14526
- */
- public void test0336() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0336", "SorterTest.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("errors found", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List superInterfaces = typeDeclaration.superInterfaces();
- assertEquals("wrong size", 1, superInterfaces.size()); //$NON-NLS-1$
- Name name = (Name) superInterfaces.get(0);
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "Sorter", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14602
- */
- public void test0337() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0337", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(variableDeclarationFragment, "message= Test.m(\"s\", new String[]{\"g\"})", source); //$NON-NLS-1$
- checkSourceRange(fieldDeclaration, "String message= Test.m(\"s\", new String[]{\"g\"});", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852
- */
- public void test0338() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0338", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List thrownExceptions = methodDeclaration.thrownExceptions();
- assertEquals("Wrong size", 1, thrownExceptions.size()); //$NON-NLS-1$
- Name name = (Name) thrownExceptions.get(0);
- IBinding binding = name.resolveBinding();
- assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15061
- */
- public void test0339() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0339", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("No errors found", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclarations.get(0);
- checkSourceRange(methodDeclaration, "int doQuery(boolean x);", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a MethodDeclaration", node instanceof MethodDeclaration); //$NON-NLS-1$
- String expectedSource =
- "public void setX(boolean x) {\n" + //$NON-NLS-1$
- " {\n" + //$NON-NLS-1$
- " z\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- int methodEndPosition = node.getStartPosition() + node.getLength();
- node = getASTNode(compilationUnit, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- int typeEndPosition = node.getStartPosition() + node.getLength();
- assertEquals("different positions", methodEndPosition, typeEndPosition); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852
- */
- public void test0340() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "p3", "B.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not an method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertNotNull("No receiver", expression2); //$NON-NLS-1$
- ITypeBinding binding = expression2.resolveTypeBinding();
- assertNotNull("No type binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "A", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p2", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not a qualified name", expression2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "A", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "A", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p2", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName2 = (SimpleName) name;
- assertEquals("wrong name", "p2", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.PACKAGE, binding2.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "p2", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement2 = (ExpressionStatement) node;
- Expression expression3 = expressionStatement2.getExpression();
- assertTrue("Not an method invocation", expression3.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation2 = (MethodInvocation) expression3;
- Expression expression4 = methodInvocation2.getExpression();
- assertNotNull("No receiver", expression4); //$NON-NLS-1$
- ITypeBinding binding3 = expression4.resolveTypeBinding();
- assertNotNull("No type binding", binding3); //$NON-NLS-1$
- assertEquals("wrong name", "A", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p1", binding3.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15804
- */
- public void test0341() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0341", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- String expectedSource =
- "if (field != null) {\n" + //$NON-NLS-1$
- " throw new IOException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- IfStatement ifStatement = (IfStatement) node;
- Statement thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new IOException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- Statement elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "if (field == null) {\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- ifStatement = (IfStatement) elseStatement;
- thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- ifStatement = (IfStatement) elseStatement;
- thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15657
- */
- public void test0342() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0342", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IDOMCompilationUnit dcompUnit = new DOMFactory().createCompilationUnit(sourceUnit.getSource(), sourceUnit.getElementName());
- assertNotNull("dcompUnit is null", dcompUnit); //$NON-NLS-1$
-
- // searching class
- IDOMType classNode = null;
- Enumeration children = dcompUnit.getChildren();
- assertNotNull("dcompUnit has no children", children); //$NON-NLS-1$
-
- while (children.hasMoreElements()) {
- IDOMNode child = (IDOMNode) children.nextElement();
- if (child.getNodeType() == IDOMNode.TYPE) {
- classNode = (IDOMType) child;
- break;
- }
- }
- assertNotNull("classNode is null", classNode); //$NON-NLS-1$
-
- // searching for methods
- children = classNode.getChildren();
-
- assertNotNull("classNode has no children", children); //$NON-NLS-1$
-
- while (children.hasMoreElements()) {
- IDOMNode child = (IDOMNode) children.nextElement();
- if (child.getNodeType() == IDOMNode.METHOD) {
- IDOMMethod childMethod = (IDOMMethod) child;
-
- // returnType is always null;
- String returnType = childMethod.getReturnType();
- if (childMethod.isConstructor()) {
- assertNull(returnType);
- } else {
- assertNotNull("no return type", returnType); //$NON-NLS-1$
- }
- }
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=16051
- */
- public void test0343() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0343", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- String expectedSource =
- "if (flag)\n" + //$NON-NLS-1$
- " i= 10;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=16132
- */
- public void test0344() throws JavaModelException {
- Preferences preferences = null;
- String pb_assert = null;
- String compiler_source = null;
- String compiler_compliance = null;
- try {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0344", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- preferences = JavaCore.getPlugin().getPluginPreferences();
- pb_assert = preferences.getString(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER);
- compiler_source = preferences.getString(JavaCore.COMPILER_SOURCE);
- compiler_compliance = preferences.getString(JavaCore.COMPILER_COMPLIANCE);
-
- preferences.setValue(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
- preferences.setValue(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
- preferences.setValue(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
-
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- } finally {
- if (preferences != null) {
- preferences.setValue(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, pb_assert);
- preferences.setValue(JavaCore.COMPILER_SOURCE, compiler_source);
- preferences.setValue(JavaCore.COMPILER_COMPLIANCE, compiler_compliance);
- }
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=17922
- */
- public void test0345() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0345", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an ArrayCreation", expression.getNodeType() == ASTNode.ARRAY_CREATION); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayType arrayType = arrayCreation.getType();
- IBinding binding2 = arrayType.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertEquals("not a type", binding2.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding2 = (ITypeBinding) binding2;
- assertTrue("Not an array type binding2", typeBinding2.isArray()); //$NON-NLS-1$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("QualifiedName", name.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- SimpleName simpleName = ((QualifiedName) name).getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("not a type", binding.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertTrue("An array type binding", !typeBinding.isArray()); //$NON-NLS-1$
- Type type2 = fieldDeclaration.getType();
- assertTrue("Not a array type", type2.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type2;
- Type type3 = arrayType2.getElementType();
- assertTrue("Not a simple type", type3.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType2 = (SimpleType) type3;
- Name name2 = simpleType2.getName();
- assertTrue("Not a qualified name", name2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- SimpleName simpleName2 = ((QualifiedName) name2).getName();
- IBinding binding3 = simpleName2.resolveBinding();
- assertNotNull("no binding", binding3); //$NON-NLS-1$
- assertEquals("not a type", binding3.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding3 = (ITypeBinding) binding3;
- assertTrue("An array type binding", !typeBinding3.isArray()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0346() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0346", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector", source); //$NON-NLS-1$
- assertTrue("not an array type", !type.isArrayType()); //$NON-NLS-1$
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a simpleName", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = simpleType.resolveBinding();
- assertNotNull("No binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, typeBinding2.getKind()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0347() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0347", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector[]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0348() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0348", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0349() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0349", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0350() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0350", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Vector", source); //$NON-NLS-1$
- assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding binding = simpleType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("An array type", binding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169
- */
- public void test0351() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0351", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "int[] b", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (MethodDeclaration) node;
- parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "int b[]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169
- */
- public void test0352() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0352", "Test2.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "final int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "final int[] b", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (MethodDeclaration) node;
- parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "final int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "final int b[]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18042
- */
- public void test0353() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0353", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "InputStream", source); //$NON-NLS-1$
- assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "InputStream", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.io", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding2.getKind()); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding2;
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "InputStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.io", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=19851
- */
- public void test0354() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0354", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=20520
- */
- public void test0355() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0355", "Foo.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- Expression condition = ifStatement.getExpression();
- assertTrue("Not an infixExpression", condition.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) condition;
- Expression expression = infixExpression.getLeftOperand();
- assertTrue("Not a method invocation expression", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=20865
- */
- public void test0356() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0356", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- ITypeBinding binding = type.resolveBinding();
- assertNull(binding);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21757
- */
- public void test0357() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0357", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration statement", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- checkSourceRange(name, "A", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768
- */
- public void test0358() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0358", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0);
- assertNotNull(node);
- assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- checkSourceRange(name, "mdd", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768
- */
- public void test0359() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0359", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0);
- assertNotNull(node);
- assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- checkSourceRange(name, "mdd", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0360() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0360", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0361() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0361", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0362() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0362", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
-
- VariableDeclarationFragment iFragment = this.ast.newVariableDeclarationFragment();
- iFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- iFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationFragment jFragment = this.ast.newVariableDeclarationFragment();
- jFragment.setName(this.ast.newSimpleName("j")); //$NON-NLS-1$
- jFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationFragment kFragment = this.ast.newVariableDeclarationFragment();
- kFragment.setName(this.ast.newSimpleName("k")); //$NON-NLS-1$
- kFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(iFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- variableDeclarationExpression.fragments().add(jFragment);
- variableDeclarationExpression.fragments().add(kFragment);
- forStatement.initializers().add(variableDeclarationExpression);
-
- PostfixExpression iPostfixExpression = this.ast.newPostfixExpression();
- iPostfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- iPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(iPostfixExpression);
-
- PostfixExpression jPostfixExpression = this.ast.newPostfixExpression();
- jPostfixExpression.setOperand(this.ast.newSimpleName("j"));//$NON-NLS-1$
- jPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(jPostfixExpression);
-
- PostfixExpression kPostfixExpression = this.ast.newPostfixExpression();
- kPostfixExpression.setOperand(this.ast.newSimpleName("k"));//$NON-NLS-1$
- kPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(kPostfixExpression);
-
- forStatement.setBody(this.ast.newBlock());
-
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
-
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i=0, j=0, k=0; i<10 ; i++, j++, k++) {}", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0363() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0363", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a parenthesized expression", expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- Expression expression2 = ((ParenthesizedExpression) expression).getExpression();
- checkSourceRange(expression2, "xxxx", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529
- */
- public void test0364() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0364", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(variableDeclarationStatement, "int local;", source); //$NON-NLS-1$
- SimpleName simpleName = variableDeclarationFragment.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529
- */
- public void test0365() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0365", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializers.get(0);
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- SimpleName simpleName = variableDeclarationFragment.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0366() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0366", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (int i = 0; i < 5; ++i);", source); //$NON-NLS-1$
- Statement statement = forStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0367() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0367", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a while statement", node.getNodeType() == ASTNode.WHILE_STATEMENT); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while(i == 2);", source); //$NON-NLS-1$
- Statement statement = whileStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0368() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0368", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$
- LabeledStatement labeledStatement = (LabeledStatement) node;
- checkSourceRange(labeledStatement, "test:;", source); //$NON-NLS-1$
- Statement statement = labeledStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0369() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0369", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$
- LabeledStatement labeledStatement = (LabeledStatement) node;
- checkSourceRange(labeledStatement, "test:\\u003B", source); //$NON-NLS-1$
- Statement statement = labeledStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, "\\u003B", source); //$NON-NLS-1$
- }
-
- /**
- * DoStatement ==> DoStatement
- */
- public void test0370() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0370", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- DoStatement doStatement = this.ast.newDoStatement();
- doStatement.setBody(this.ast.newEmptyStatement());
- doStatement.setExpression(this.ast.newBooleanLiteral(true));
- assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "do ; while(true);";//$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- DoStatement doStatement2 = (DoStatement) node;
- Statement statement = doStatement2.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0371() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0371", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- checkSourceRange(ifStatement, "if (i == 6);", source); //$NON-NLS-1$
- Statement statement = ifStatement.getThenStatement();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0372() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0372", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- checkSourceRange(ifStatement, "if (i == 6) {} else ;", source); //$NON-NLS-1$
- Statement statement = ifStatement.getElseStatement();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23118
- */
- public void test0373() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0373", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- Statement statement = forStatement.getBody();
- assertTrue("Not a block statement", statement.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) statement;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(0);
- assertTrue("Not a break statement", statement2.getNodeType() == ASTNode.BREAK_STATEMENT); //$NON-NLS-1$
- BreakStatement breakStatement = (BreakStatement) statement2;
- checkSourceRange(breakStatement, "break;", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23118
- */
- public void test0374() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0374", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- Statement statement = forStatement.getBody();
- assertTrue("Not a block statement", statement.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) statement;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(0);
- assertTrue("Not a break statement", statement2.getNodeType() == ASTNode.CONTINUE_STATEMENT); //$NON-NLS-1$
- ContinueStatement continueStatement = (ContinueStatement) statement2;
- checkSourceRange(continueStatement, "continue;", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23052
- */
- public void test0375() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0375", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("problems found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- List imports = compilationUnit.imports();
- assertEquals("wrong size", 1, imports.size()); //$NON-NLS-1$
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Not a type binding", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0376() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0376", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a cast expression", expression.getNodeType() == ASTNode.CAST_EXPRESSION); //$NON-NLS-1$
- Type type = ((CastExpression) expression).getType();
- checkSourceRange(type, "A", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23050
- */
- public void test0377() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0377", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = variableDeclarationFragment.resolveBinding();
- assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$
- assertEquals("Wrong modifier", IModifierConstants.ACC_FINAL, variableBinding.getModifiers()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22161
- */
- public void test0378() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0378", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- checkSourceRange(name, "B", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22161
- */
- public void test0379() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0379", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode expression = getASTNodeToCompare((CompilationUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression;
- Name name2 = classInstanceCreation2.getName();
- checkSourceRange(name2, "Object", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22054
- */
- public void test0380() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0380", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expression;
- ITypeBinding typeBinding = superMethodInvocation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong declaring class", typeBinding.getSuperclass().getName(), "Object"); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName = superMethodInvocation.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding;
- assertEquals("Wrong declaring class", methodBinding.getDeclaringClass().getName(), "Object"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23054
- */
- public void test0381() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0381", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- Javadoc javadoc = typeDeclaration.getJavadoc();
- assertNull("Javadoc not null", javadoc); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0382() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0382", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0382.A"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0383() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0383", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0383.A.B"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0384() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0384", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0384.A.B.D"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
- */
- public void test0385() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0385", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23259
- */
- public void test0386() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0386", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$
- SwitchStatement switchStatement = (SwitchStatement) node;
- List statements = switchStatement.statements();
- assertEquals("Wrong size", 5, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a case statement", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- checkSourceRange(statement, "case 1:", source); //$NON-NLS-1$
- statement = (Statement) statements.get(3);
- assertTrue("Not a default case statement", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- checkSourceRange(statement, "default :", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0387() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0387", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a cast expression", expression.getNodeType() == ASTNode.CAST_EXPRESSION); //$NON-NLS-1$
- Type type = ((CastExpression) expression).getType();
- checkSourceRange(type, "A", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0388() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0388", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "test0388.A", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0389() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0389", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "test0389.A.B", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0390() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0390", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "int", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0391() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0391", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "int[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0392() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0392", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0393() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0393", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- checkSourceRange(type, "String", source); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 1, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$
- IMethodBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No method binding", methodBinding); //$NON-NLS-1$
- ITypeBinding typeBinding2 = methodBinding.getReturnType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0394() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0394", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- checkSourceRange(type, "String", source); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 0, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0395() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0395", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- checkSourceRange(type, "String[]", source); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 1, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$
- IMethodBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No method binding", methodBinding); //$NON-NLS-1$
- ITypeBinding typeBinding2 = methodBinding.getReturnType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[][]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 2, typeBinding2.getDimensions()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0396() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0396", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration method = (MethodDeclaration) node;
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", singleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange(singleVariableDeclaration, "final String s[]", source); //$NON-NLS-1$
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String", source); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, singleVariableDeclaration.getExtraDimensions()); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("An array binding", !typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding();
- assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$
- ITypeBinding typeBinding2 = variableBinding.getType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertTrue("Not an array binding", typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String[]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0397() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0397", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration method = (MethodDeclaration) node;
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", singleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange(singleVariableDeclaration, "final String[] \\u0073\\u005B][]", source); //$NON-NLS-1$
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String[]", source); //$NON-NLS-1$
- assertEquals("Wrong dimension", 2, singleVariableDeclaration.getExtraDimensions()); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an array binding", typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding();
- assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$
- ITypeBinding typeBinding2 = variableBinding.getType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertTrue("Not an array binding", typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 3, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String[][][]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23362
- */
- public void test0398() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0398", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(1 + 2) * 3", source); //$NON-NLS-1$
- Expression expression2 = infixExpression.getLeftOperand();
- assertTrue("Not an parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- assertTrue("Not an infix expression", expression3.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- checkSourceRange(expression3, "1 + 2", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22306
- */
- public void test0399() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0399", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor()); //$NON-NLS-1$
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22306
- */
- public void test0400() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0400", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor()); //$NON-NLS-1$
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 3, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an superconstructorinvocation", statement.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$
- checkSourceRange(statement, "super();", source); //$NON-NLS-1$
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java
deleted file mode 100644
index efb0c1b..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java
+++ /dev/null
@@ -1,1887 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import java.util.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.dom.*;
-
-public class ASTConverterTest2 extends ConverterTestSetup {
-
- public ASTConverterTest2(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new Suite(ASTConverterTest2.class.getName());
-
- if (true) {
- Class c = ASTConverterTest2.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTConverterTest2(methods[i].getName()));
- }
- }
- return suite;
- }
- suite.addTest(new ASTConverterTest2("test0470"));
- return suite;
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22560
- */
- public void test0401() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0401", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a return statement", statement.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) statement;
- Expression expression = returnStatement.getExpression();
- assertNotNull("there is no expression", expression); //$NON-NLS-1$
- // call the default initialization
- methodDeclaration.getReturnType();
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23464
- */
- public void test0402() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0402", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 1, 0, 0);
- assertEquals("Wrong number of problems", 0, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not a super method invocation", node.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$
- checkSourceRange(node, "new A().super();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0403() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0403", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 1, 0, 1);
- assertEquals("Wrong number of problems", 1, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "test", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IMethodBinding methodBinding2 = methodInvocation.resolveMethodBinding();
- assertNotNull("No method binding2", methodBinding2);
- assertTrue("Wrong binding", methodBinding == methodBinding2);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0404() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0404", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertEquals("Wrong number of problems", 1, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0405() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0405", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((CompilationUnit) result, 1, 0, 1);
- assertEquals("Wrong number of problems", 1, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0406() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0406", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit unit = (CompilationUnit) result;
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 1);
- assertEquals("Wrong number of problems", 1, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "foo", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding2;
- assertEquals("Wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertNull("Got a declaring node in the unit", unit.findDeclaringNode(methodBinding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0407() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0407", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- CompilationUnit unit = (CompilationUnit) result;
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- SimpleName simpleName = methodDeclaration.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a method binding", binding.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IMethodBinding methodBinding = (IMethodBinding) binding;
- assertEquals("wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- methodDeclaration.setName(methodDeclaration.getAST().newSimpleName("foo2")); //$NON-NLS-1$
- IMethodBinding methodBinding2 = methodDeclaration.resolveBinding();
- assertNotNull("No methodbinding2", methodBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "foo", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = methodDeclaration.getName();
- IBinding binding2 = simpleName.resolveBinding();
- assertNull("Got a binding2", binding2); //$NON-NLS-1$
-
- ASTNode astNode = unit.findDeclaringNode(methodBinding);
- assertNotNull("No declaring node", astNode);
- assertEquals("wrong declaring node", methodDeclaration, astNode);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0408() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0408", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a package binding", binding.getKind() == IBinding.PACKAGE); //$NON-NLS-1$
- assertEquals("Wrong name", "java", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0409() throws JavaModelException {
- Hashtable options = JavaCore.getOptions();
- Hashtable newOptions = JavaCore.getOptions();
- try {
- newOptions.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
- JavaCore.setOptions(newOptions);
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0409", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertEquals("Unexpected problem", "The import java.lang is never used", compilationUnit.getProblems()[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- BindingsCollectorVisitor bindingsCollectorVisitor = new BindingsCollectorVisitor();
- compilationUnit.accept(bindingsCollectorVisitor);
- assertEquals("wrong number", 3, bindingsCollectorVisitor.getUnresolvedNodesSet().size()); //$NON-NLS-1$
- Map bindingsMap = bindingsCollectorVisitor.getBindingsMap();
- assertEquals("wrong number", 187, bindingsMap.size()); //$NON-NLS-1$
- ASTNodesCollectorVisitor nodesCollector = new ASTNodesCollectorVisitor();
- compilationUnit.accept(nodesCollector);
- Set detachedNodes = nodesCollector.getDetachedAstNodes();
- int counter = 0;
- for (Iterator iterator = detachedNodes.iterator(); iterator.hasNext(); ) {
- ASTNode detachedNode = (ASTNode) iterator.next();
- counter++;
- IBinding binding = (IBinding) bindingsMap.get(detachedNode);
- assertNotNull(binding);
- switch(detachedNode.getNodeType()) {
- case ASTNode.ARRAY_ACCESS :
- case ASTNode.ARRAY_CREATION :
- case ASTNode.ARRAY_INITIALIZER :
- case ASTNode.ASSIGNMENT :
- case ASTNode.BOOLEAN_LITERAL :
- case ASTNode.CAST_EXPRESSION :
- case ASTNode.CHARACTER_LITERAL :
- case ASTNode.CLASS_INSTANCE_CREATION :
- case ASTNode.CONDITIONAL_EXPRESSION :
- case ASTNode.FIELD_ACCESS :
- case ASTNode.INFIX_EXPRESSION :
- case ASTNode.INSTANCEOF_EXPRESSION :
- case ASTNode.METHOD_INVOCATION :
- case ASTNode.NULL_LITERAL :
- case ASTNode.NUMBER_LITERAL :
- case ASTNode.POSTFIX_EXPRESSION :
- case ASTNode.PREFIX_EXPRESSION :
- case ASTNode.THIS_EXPRESSION :
- case ASTNode.TYPE_LITERAL :
- case ASTNode.VARIABLE_DECLARATION_EXPRESSION :
- ITypeBinding typeBinding = ((Expression) detachedNode).resolveTypeBinding();
- if (!binding.equals(typeBinding)) {
- System.out.println(detachedNode);
- }
- assertTrue("binding not equals", binding.equals(typeBinding)); //$NON-NLS-1$
- break;
- case ASTNode.VARIABLE_DECLARATION_FRAGMENT :
- assertTrue("binding not equals", binding.equals(((VariableDeclarationFragment) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.ANONYMOUS_CLASS_DECLARATION :
- assertTrue("binding not equals", binding.equals(((AnonymousClassDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.QUALIFIED_NAME :
- case ASTNode.SIMPLE_NAME :
- IBinding newBinding = ((Name) detachedNode).resolveBinding();
- assertTrue("binding not equals", binding.equals(newBinding)); //$NON-NLS-1$
- break;
- case ASTNode.ARRAY_TYPE :
- case ASTNode.SIMPLE_TYPE :
- case ASTNode.PRIMITIVE_TYPE :
- assertTrue("binding not equals", binding.equals(((Type) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.CONSTRUCTOR_INVOCATION :
- assertTrue("binding not equals", binding.equals(((ConstructorInvocation) detachedNode).resolveConstructorBinding())); //$NON-NLS-1$
- break;
- case ASTNode.IMPORT_DECLARATION :
- assertTrue("binding not equals", binding.equals(((ImportDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.METHOD_DECLARATION :
- assertTrue("binding not equals", binding.equals(((MethodDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.PACKAGE_DECLARATION :
- assertTrue("binding not equals", binding.equals(((PackageDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.TYPE_DECLARATION :
- assertTrue("binding not equals", binding.equals(((TypeDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- }
- }
- } finally {
- JavaCore.setOptions(options);
- }
- }
-
- /**
- * Test for message on jdt-core-dev
- */
- public void test0410() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0410", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ReturnStatement) node).getExpression();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 3, extendedOperands.size()); //$NON-NLS-1$
- }
-
- /**
- * Test for message on jdt-core-dev
- */
- public void test0411() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0411", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((CompilationUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((CompilationUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ReturnStatement) node).getExpression();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 0, extendedOperands.size()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23901
- */
- public void test0412() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0412", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertTrue("Not an interface", typeDeclaration.isInterface()); //$NON-NLS-1$
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertNotNull("No declaring node", unit.findDeclaringNode(typeBinding)); //$NON-NLS-1$
- Name name = typeDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- ASTNode declaringNode = unit.findDeclaringNode(binding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$
- typeBinding = name.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- declaringNode = unit.findDeclaringNode(typeBinding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=20881
- */
- public void test0413() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0413", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List throwsException = methodDeclaration.thrownExceptions();
- assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
- Name name = (Name) throwsException.get(0);
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23734
- */
- public void test0414() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0414", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- ASTNode declaringNode = unit.findDeclaringNode(typeBinding);
- assertNull("Got a declaring node", declaringNode); //$NON-NLS-1$
-
- node = getASTNode(unit, 0, 1);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration2 = (MethodDeclaration) node;
- Type type2 = methodDeclaration2.getReturnType();
- ITypeBinding typeBinding2 = type2.resolveBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- ASTNode declaringNode2 = unit.findDeclaringNode(typeBinding2);
- assertNotNull("No declaring node", declaringNode2); //$NON-NLS-1$
-
- ICompilationUnit sourceUnit2 = getCompilationUnit("Converter" , "", "test0414", "B.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- result = runConversion(sourceUnit2, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit2 = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit2.getProblems().length); //$NON-NLS-1$
- ASTNode declaringNode3 = unit2.findDeclaringNode(typeBinding);
- assertNull("Got a declaring node", declaringNode3); //$NON-NLS-1$
-
- ASTNode declaringNode4 = unit2.findDeclaringNode(typeBinding.getKey());
- assertNotNull("No declaring node", declaringNode4); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24268
- */
- public void test0415() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0415", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$
- SwitchStatement switchStatement = (SwitchStatement) node;
- List statements = switchStatement.statements();
- assertEquals("wrong size", statements.size(), 5); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(3);
- assertTrue("not a switch case (default)", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- SwitchCase defaultCase = (SwitchCase) statement;
- assertTrue("not a default case", defaultCase.isDefault());
- assertEquals("wrong toString()", "default : ", defaultCase.toString());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24324
- */
- public void test0416() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0416", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", fragments.size(), 1);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression init = fragment.getInitializer();
- assertTrue("not a qualified name", init.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) init;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("Wrong name", "CONST", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong modifier", variableBinding.getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
- ASTNode declaringNode = unit.findDeclaringNode(variableBinding);
- assertNotNull("No declaring node", declaringNode);
- assertTrue("not a variable declaration fragment", declaringNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) declaringNode;
- FieldDeclaration fieldDeclaration = (FieldDeclaration) variableDeclarationFragment.getParent();
- assertEquals("Wrong modifier", fieldDeclaration.getModifiers(), Modifier.NONE);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24347
- */
- public void test0417() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0417", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- Name qualifier = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifier.isSimpleName());
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24406
- */
- public void test0418() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0418", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertNotNull("No node", node);
- assertTrue("not an expression statement ", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not an method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION); //$NON-NLS-1$
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- Name name = methodInvocation.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0419() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0419", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a name", expression2.getNodeType(), ASTNode.SIMPLE_NAME);
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull(binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0420() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0420", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getRightOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "(2 + 3)", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "2 + 3", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0421() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0421", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(1 + 2) + 3", source);
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "(1 + 2)", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "1 + 2", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0422() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0422", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "( 1 + 2 ) + 3", source);
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "( 1 + 2 )", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "1 + 2", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0423() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0423", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getRightOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "( 2 + 3 )", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "2 + 3", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0424() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0424", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- assertEquals("Wrong size", 1, infixExpression.extendedOperands().size());
- Expression expression2 = (Expression) infixExpression.extendedOperands().get(0);
- checkSourceRange(expression2, "( 2 + 3 )", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0425() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0425", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- assertEquals("Wrong size", 0, infixExpression.extendedOperands().size());
- Expression expression2 = infixExpression.getRightOperand();
- assertTrue("not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) expression2;
- Expression expression3 = infixExpression2.getRightOperand();
- assertTrue("not a parenthesized expression", expression3.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- checkSourceRange(expression3, "( 2 + 3 )", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0426() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0426", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertNotNull("No name", name);
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0427() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0427", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a super field access", expression2.getNodeType(), ASTNode.SUPER_FIELD_ACCESS);
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2;
- Name name = superFieldAccess.getName();
- assertNotNull("No name", name);
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding);
- assertNull("Got a binding", superFieldAccess.resolveFieldBinding());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0428() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0428", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME);
- QualifiedName name = (QualifiedName) expression2;
- SimpleName simpleName = name.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0429() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0429", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME);
- QualifiedName name = (QualifiedName) expression2;
- SimpleName simpleName = name.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24499
- */
- public void test0430() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0430", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- checkSourceRange(constructorInvocation, "this(coo2());", source);
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.METHOD_INVOCATION);
- MethodInvocation methodInvocation = (MethodInvocation) expression;
- SimpleName simpleName = methodInvocation.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24500
- */
- public void test0431() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0431", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression = (Expression) arguments.get(0);
- assertTrue("Not a simple name", expression.getNodeType() == ASTNode.SIMPLE_NAME);
- SimpleName simpleName = (SimpleName) expression;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0432() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0432", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType());
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0433() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0433", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a super field access", ASTNode.SUPER_FIELD_ACCESS, expression2.getNodeType());
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2;
- SimpleName simpleName = superFieldAccess.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong binding", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = superFieldAccess.resolveFieldBinding();
- assertTrue("Different binding", binding == variableBinding);
- ASTNode astNode = unit.findDeclaringNode(variableBinding);
- assertTrue("Wrong type", astNode.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0434() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0434", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0435() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0435", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0436() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0436", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) name;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "CInner", simpleName.getIdentifier());
- IBinding binding2 = simpleName.resolveBinding();
- assertNull("Got a binding", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0437() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0437", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24511
- */
- public void test0438() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0438", "D.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- List imports = unit.imports();
- assertEquals("Wrong size", 1, imports.size()); //$NON-NLS-1$<
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0439() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0439", "E.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0440() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0440", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- // 2 * 3 + "" + (true)
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "2 * 3 + \"\" + (true)", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2 * 3 + \"\"", source);
- checkSourceRange(infixExpression.getRightOperand(), "(true)", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS);
- assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- infixExpression = (InfixExpression) leftOperand;
- checkSourceRange(infixExpression, "2 * 3 + \"\"", source);
- leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2 * 3", source);
- checkSourceRange(infixExpression.getRightOperand(), "\"\"", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS);
- assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- infixExpression = (InfixExpression) leftOperand;
- checkSourceRange(infixExpression, "2 * 3", source);
- leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2", source);
- checkSourceRange(infixExpression.getRightOperand(), "3", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.TIMES);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0441() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0441", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(2 + 2) * 3 * 1", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "(2 + 2)", source);
- checkSourceRange(infixExpression.getRightOperand(), "3", source);
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 1, extendedOperands.size());
- checkSourceRange((Expression) extendedOperands.get(0), "1", source);
- assertEquals("wrong operator", InfixExpression.Operator.TIMES, infixExpression.getOperator());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0442() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0442", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "2 + (2 * 3) + 1", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2", source);
- Expression rightOperand = infixExpression.getRightOperand();
- checkSourceRange(rightOperand, "(2 * 3)", source);
- assertEquals("wrong type", ASTNode.PARENTHESIZED_EXPRESSION, rightOperand.getNodeType());
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 1, extendedOperands.size());
- checkSourceRange((Expression) extendedOperands.get(0), "1", source);
- assertEquals("wrong operator", InfixExpression.Operator.PLUS, infixExpression.getOperator());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623
- */
- public void test0443() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0443", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, node.getNodeType());
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- assertNotNull("No body", methodDeclaration.getBody());
- assertNotNull("No binding", methodDeclaration.resolveBinding());
- assertTrue("Not an abstract method", Modifier.isAbstract(methodDeclaration.getModifiers()));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623
- */
- public void test0444() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0444", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0);
- assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 2, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(0);
- assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
- assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
- assertNull("Got a binding", methodDeclaration.resolveBinding());
- bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
- assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType());
- assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24773
- */
- public void test0445() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0445", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25018
- */
- public void test0446() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0446", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25124
- */
- public void test0447() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0447", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 4, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25330
- */
- public void test0448() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0448", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", node.getNodeType(), ASTNode.METHOD_DECLARATION);
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- ITypeBinding returnTypeBinding = methodDeclaration.getReturnType().resolveBinding();
- assertNotNull("No return type binding", returnTypeBinding);
- Block block = methodDeclaration.getBody();
- assertNotNull("No method body", block);
- assertEquals("wrong size", 0, block.statements().size());
- }
-
- /**
- * Check that the implicit super constructor call is not there
- */
- public void test0449() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0449", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", node.getNodeType(), ASTNode.METHOD_DECLARATION);
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- Block block = methodDeclaration.getBody();
- assertNotNull("No method body", block);
- assertEquals("wrong size", 1, block.statements().size());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26452
- */
- public void test0450() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0450", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", node.getNodeType(), ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("not a toplevel type", typeBinding.isTopLevel());
- assertTrue("a local type", !typeBinding.isLocal());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("a member type", !typeBinding.isMember());
- assertTrue("a nested type", !typeBinding.isNested());
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a class instance creation", expression.getNodeType(), ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- typeBinding = anonymousClassDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("not a local type", typeBinding.isLocal());
- assertTrue("not an anonymous type", typeBinding.isAnonymous());
- assertTrue("a member type", !typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- ASTNode astNode = unit.findDeclaringNode(typeBinding);
- assertEquals("Wrong type", ASTNode.ANONYMOUS_CLASS_DECLARATION, astNode.getNodeType());
- assertNull("Got a key", typeBinding.getKey());
- astNode = unit.findDeclaringNode(typeBinding.getKey());
- assertNull("Got a declaring node", astNode);
-
- ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding();
- assertEquals("wrong binding", typeBinding, typeBinding3);
-
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size", 2, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) bodyDeclaration;
-
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(1);
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block);
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size());
- Statement statement = (Statement) statements.get(1);
- assertEquals("Not a variable declaration statement", statement.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- Type type = variableDeclarationStatement.getType();
- assertNotNull("No type", type);
-
- ITypeBinding typeBinding2 = type.resolveBinding();
- typeBinding = typeDeclaration.resolveBinding();
- assertTrue("not equals", typeBinding == typeBinding2);
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("not a member type", typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- assertTrue("a local type", !typeBinding.isLocal());
-
- bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) bodyDeclaration;
- typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("not a member type", typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- assertTrue("a local type", !typeBinding.isLocal());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24916
- */
- public void test0451() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0451", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit unit = (CompilationUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- checkSourceRange(type, "int", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27204
- */
- public void test0452() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "", "NO_WORKING.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- assertEquals("wrong line number", 3, compilationUnit.lineNumber(name.getStartPosition()));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27173
- */
- public void test0453() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0453", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,0);
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$
- SuperMethodInvocation methodInvocation = (SuperMethodInvocation) expression;
- IMethodBinding methodBinding = methodInvocation.resolveMethodBinding();
- assertNotNull("No method binding", methodBinding);
- assertEquals("Wrong binding", "toString", methodBinding.getName());
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28296
- */
- public void test0454() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0454", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,1);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("not a cast expression", expression.getNodeType() == ASTNode.CAST_EXPRESSION); //$NON-NLS-1$
- checkSourceRange(expression, "(int) (3.14f * a)", source);
- CastExpression castExpression = (CastExpression) expression;
- checkSourceRange(castExpression.getType(), "int", source);
- Expression expression2 = castExpression.getExpression();
- checkSourceRange(expression2, "(3.14f * a)", source);
- assertTrue("not a parenthesized expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0455() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0455", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i = 0; i < 10; i++) // for 1\n" +
- " for (int j = 0; j < 10; j++) // for 2\n" +
- " if (true) { }";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int j = 0; j < 10; j++) // for 2\n" +
- " if (true) { }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "if (true) { }";
- checkSourceRange(body, expectedSource, source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0456() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0456", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int x= 10; x < 20; x++)\n" +
- " main();";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "main();";
- checkSourceRange(body, expectedSource, source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0457() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0457", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " foo();";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " foo();";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "foo();";
- checkSourceRange(body, expectedSource, source);
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0458() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0458", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " ;";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " ;";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = ";";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not an empty statement", body.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0459() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0459", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " { }";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " { }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "{ }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a block", body.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28869
- */
- public void test0460() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0460", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Malformed", !isMalformed(node));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28824
- */
- public void test0461() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0461", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Malformed", !isMalformed(node));
- assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- checkSourceRange(assignment, "z= foo().y.toList()", source);
- Expression expression2 = assignment.getRightHandSide();
- checkSourceRange(expression2, "foo().y.toList()", source);
- assertTrue("not a method invocation", expression2.getNodeType() == ASTNode.METHOD_INVOCATION);
- MethodInvocation methodInvocation = (MethodInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- checkSourceRange(expression3, "foo().y", source);
- checkSourceRange(methodInvocation.getName(), "toList", source);
- assertTrue("not a field access", expression3.getNodeType() == ASTNode.FIELD_ACCESS);
- FieldAccess fieldAccess = (FieldAccess) expression3;
- checkSourceRange(fieldAccess.getName(), "y", source);
- Expression expression4 = fieldAccess.getExpression();
- checkSourceRange(expression4, "foo()", source);
- assertTrue("not a method invocation", expression4.getNodeType() == ASTNode.METHOD_INVOCATION);
- MethodInvocation methodInvocation2 = (MethodInvocation) expression4;
- checkSourceRange(methodInvocation2.getName(), "foo", source);
- assertNull("no null", methodInvocation2.getExpression());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=32338
- */
- public void test0462() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "", "Test462.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$
- CompilationUnit compilationUnit = (CompilationUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("Wrong name", "Test462", typeDeclaration.getName().getIdentifier());
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name", "Test462", typeBinding.getQualifiedName());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33450
- */
- public void test0463() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0463", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a string literal", expression.getNodeType() == ASTNode.STRING_LITERAL); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression;
- checkSourceRange(stringLiteral, "\"\\012\\015\\u0061\"", source);
- assertEquals("wrong value", "\012\015a", stringLiteral.getLiteralValue());
- assertEquals("wrong value", "\"\\012\\015\\u0061\"", stringLiteral.getEscapedValue());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33039
- */
- public void test0464() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0464", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a null literal", expression.getNodeType() == ASTNode.NULL_LITERAL); //$NON-NLS-1$
- NullLiteral nullLiteral = (NullLiteral) expression;
- ITypeBinding typeBinding = nullLiteral.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding);
- assertFalse("A primitive type", typeBinding.isPrimitive());
- assertTrue("Null type", typeBinding.isNullType());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831
- */
- public void test0465() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0465", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- Name name = fieldAccess.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName());
- assertEquals("Wrong type", "int", variableBinding.getType().getName());
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertTrue("different binding", variableBinding == variableBinding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949
- */
- public void test0466() throws JavaModelException {
- Hashtable options = JavaCore.getOptions();
- Hashtable newOptions = JavaCore.getOptions();
- try {
- newOptions.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
- JavaCore.setOptions(newOptions);
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0466", "Assert.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- checkSourceRange(node, "assert ref != null : message;", source);
- assertTrue("not an assert statement", node.getNodeType() == ASTNode.ASSERT_STATEMENT); //$NON-NLS-1$
- AssertStatement statement = (AssertStatement) node;
- checkSourceRange(statement.getExpression(), "ref != null", source);
- checkSourceRange(statement.getMessage(), "message", source);
- } finally {
- JavaCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949
- */
- public void test0467() throws JavaModelException {
- Hashtable options = JavaCore.getOptions();
- Hashtable newOptions = JavaCore.getOptions();
- try {
- newOptions.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
- JavaCore.setOptions(newOptions);
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0467", "Assert.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- checkSourceRange(node, "assert ref != null : message\\u003B", source);
- assertTrue("not an assert statement", node.getNodeType() == ASTNode.ASSERT_STATEMENT); //$NON-NLS-1$
- AssertStatement statement = (AssertStatement) node;
- checkSourceRange(statement.getExpression(), "ref != null", source);
- checkSourceRange(statement.getMessage(), "message", source);
-
- node = getASTNode(compilationUnit, 0, 0, 1);
- checkSourceRange(node, "assert ref != null\\u003B", source);
- assertTrue("not an assert statement", node.getNodeType() == ASTNode.ASSERT_STATEMENT); //$NON-NLS-1$
- statement = (AssertStatement) node;
- checkSourceRange(statement.getExpression(), "ref != null", source);
- } finally {
- JavaCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772
- */
- public void test0468() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0468", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- Name name = fieldAccess.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName());
- assertEquals("Wrong type", "int", variableBinding.getType().getName());
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertTrue("different binding", variableBinding == variableBinding2);
-
- node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-
- ASTNode foundNode = compilationUnit.findDeclaringNode(variableBinding);
- assertNotNull("No found node", foundNode);
- assertEquals("wrong node", fragment, foundNode);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36895
- */
- public void test0469() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "codeManipulation", "bug.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 2, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- ASTNode parent = node.getParent();
- assertNotNull(parent);
- assertTrue("not a block", parent.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381
- */
- public void test0470() throws JavaModelException {
- ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "", "test0470", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- CompilationUnit compilationUnit = (CompilationUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("wrong size", 1, initializers.size());
- Expression initializer = (Expression) initializers.get(0);
- assertTrue("not a variable declaration expression", initializer.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializer;
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("wrong size", 2, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(fragment, "i= 0", source);
- fragment = (VariableDeclarationFragment) fragments.get(1);
- checkSourceRange(fragment, "j= goo(3)", source);
- checkSourceRange(variableDeclarationExpression, "int i= 0, j= goo(3)", source);
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java
deleted file mode 100644
index 448a70b..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java
+++ /dev/null
@@ -1,835 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-
-import junit.framework.Test;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.dom.ASTNode;
-
-/**
- * Test suite for <code>ASTMatcher</code> and <code>ASTNode.subtreeMatch</code>.
- */
-public class ASTMatcherTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
-
- public static Test suite() {
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTMatcherTest.class.getName());
-
- Class c = ASTMatcherTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTMatcherTest(methods[i].getName()));
- }
- }
- return suite;
- }
-
- AST ast;
- SimpleName N1;
- String N1S;
- SimpleName N2;
- String N2S;
- SimpleName N3;
- String N3S;
- Expression E1;
- String E1S;
- Expression E2;
- String E2S;
- Type T1;
- String T1S;
- Statement S1;
- String S1S;
- Statement S2;
- Block B1;
- String B1S;
- String S2S;
- SingleVariableDeclaration V1;
- String V1S;
- SingleVariableDeclaration V2;
- String V2S;
- VariableDeclarationFragment W1;
- String W1S;
- VariableDeclarationFragment W2;
- String W2S;
- FieldDeclaration FD1;
- String FD1S;
- FieldDeclaration FD2;
- String FD2S;
- PackageDeclaration PD1;
- String PD1S;
- ImportDeclaration ID1;
- String ID1S;
- ImportDeclaration ID2;
- String ID2S;
- TypeDeclaration TD1;
- String TD1S;
- TypeDeclaration TD2;
- String TD2S;
- AnonymousClassDeclaration ACD1;
- String ACD1S;
- Javadoc JD1;
- String JD1S;
- Javadoc JD2;
- String JD2S;
-
- final StringBuffer b = new StringBuffer();
-
- public ASTMatcherTest(String name) {
- super(name);
- }
-
- protected void setUp() {
- ast = new AST();
- N1 = ast.newSimpleName("N"); //$NON-NLS-1$
- N1S = "(nSNNnS)"; //$NON-NLS-1$
- N2 = ast.newSimpleName("M"); //$NON-NLS-1$
- N2S = "(nSMMnS)"; //$NON-NLS-1$
- N3 = ast.newSimpleName("O"); //$NON-NLS-1$
- N3S = "(nSOOnS)"; //$NON-NLS-1$
- E1 = ast.newSimpleName("X"); //$NON-NLS-1$
- E1S = "(nSXXnS)"; //$NON-NLS-1$
- E2 = ast.newSimpleName("Y"); //$NON-NLS-1$
- E2S = "(nSYYnS)"; //$NON-NLS-1$
- T1 = ast.newSimpleType(ast.newSimpleName("Z")); //$NON-NLS-1$
- T1S = "(tS(nSZZnS)tS)"; //$NON-NLS-1$
- S1 = ast.newContinueStatement();
- S1S = "(sCNsCN)"; //$NON-NLS-1$
- S2 = ast.newBreakStatement();
- S2S = "(sBRsBR)"; //$NON-NLS-1$
- B1 = ast.newBlock();
- B1S = "(sBsB)"; //$NON-NLS-1$
- V1 = ast.newSingleVariableDeclaration();
- V1.setType(ast.newPrimitiveType(PrimitiveType.INT));
- V1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
- V1S = "(VD(tPintinttP)(nSaanS)VD)"; //$NON-NLS-1$
- V2 = ast.newSingleVariableDeclaration();
- V2.setType(ast.newPrimitiveType(PrimitiveType.BYTE));
- V2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- V2S = "(VD(tPbytebytetP)(nSbbnS)VD)"; //$NON-NLS-1$
- W1 = ast.newVariableDeclarationFragment();
- W1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
- W1S = "(VS(nSaanS)VS)"; //$NON-NLS-1$
- W2 = ast.newVariableDeclarationFragment();
- W2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- W2S = "(VS(nSbbnS)VS)"; //$NON-NLS-1$
- {
- VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
- temp.setName(ast.newSimpleName("f")); //$NON-NLS-1$
- FD1 = ast.newFieldDeclaration(temp);
- FD1.setType(ast.newPrimitiveType(PrimitiveType.INT));
- FD1S = "(FD(tPintinttP)(VS(nSffnS)VS)FD)"; //$NON-NLS-1$
- }
- {
- VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
- temp.setName(ast.newSimpleName("g")); //$NON-NLS-1$
- FD2 = ast.newFieldDeclaration(temp);
- FD2.setType(ast.newPrimitiveType(PrimitiveType.CHAR));
- FD2S = "(FD(tPcharchartP)(VS(nSggnS)VS)FD)"; //$NON-NLS-1$
- }
- PD1 = ast.newPackageDeclaration();
- PD1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
- PD1S = "(PD(nSppnS)PD)"; //$NON-NLS-1$
- ID1 = ast.newImportDeclaration();
- ID1.setName(ast.newSimpleName("i")); //$NON-NLS-1$
- ID1S = "(ID(nSiinS)ID)"; //$NON-NLS-1$
- ID2 = ast.newImportDeclaration();
- ID2.setName(ast.newSimpleName("j")); //$NON-NLS-1$
- ID2S = "(ID(nSjjnS)ID)"; //$NON-NLS-1$
- TD1 = ast.newTypeDeclaration();
- TD1.setName(ast.newSimpleName("c")); //$NON-NLS-1$
- TD1S = "(TD(nSccnS)TD)"; //$NON-NLS-1$
- TD2 = ast.newTypeDeclaration();
- TD2.setName(ast.newSimpleName("d")); //$NON-NLS-1$
- TD2S = "(TD(nSddnS)TD)"; //$NON-NLS-1$
-
- ACD1 = ast.newAnonymousClassDeclaration();
- ACD1S = "(ACDACD)"; //$NON-NLS-1$
-
- JD1 = ast.newJavadoc();
- JD1.setComment("/**X*/"); //$NON-NLS-1$
- JD1S = "(JD/**X*//**X*/JD)"; //$NON-NLS-1$
- JD2 = ast.newJavadoc();
- JD2.setComment("/**Y*/"); //$NON-NLS-1$
- JD2S = "(JD/**Y*//**Y*/JD)"; //$NON-NLS-1$
-
- }
-
- protected void tearDown() {
- ast = null;
- }
-
-
- /**
- * An ASTMatcher that simply records the arguments it is passed,
- * immediately returns a pre-ordained answer, and counts how many
- * times it is called.
- */
- class TestMatcher extends ASTMatcher {
-
- public Object receiverNode;
- public Object otherNode;
- public boolean result;
- public boolean superMatch;
- public boolean superMatchResult;
- public int matchCalls = 0;
-
- TestMatcher() {
- }
-
- boolean standardBody(ASTNode receiver, Object other, boolean matchResult) {
- matchCalls++;
- this.receiverNode = receiver;
- this.otherNode = other;
- this.superMatchResult = matchResult;
- if (superMatch) {
- return this.superMatchResult;
- } else {
- return this.result;
- }
- }
-
- public boolean match(AnonymousClassDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayAccess node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayCreation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayInitializer node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(AssertStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Assignment node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Block node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(BooleanLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(BreakStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(CastExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(CatchClause node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(CharacterLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ClassInstanceCreation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(CompilationUnit node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ConditionalExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ConstructorInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ContinueStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(DoStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(EmptyStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ExpressionStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FieldAccess node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FieldDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ForStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(IfStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ImportDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(InfixExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Initializer node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Javadoc node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(LabeledStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(MethodDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(MethodInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(NullLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(NumberLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PackageDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ParenthesizedExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PostfixExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PrefixExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PrimitiveType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(QualifiedName node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ReturnStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SimpleName node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SimpleType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SingleVariableDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(StringLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SuperConstructorInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SuperFieldAccess node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SuperMethodInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SwitchCase node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SwitchStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SynchronizedStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ThisExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ThrowStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TryStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TypeDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TypeDeclarationStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TypeLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(VariableDeclarationExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(VariableDeclarationFragment node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(VariableDeclarationStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(WhileStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- }
-
- /**
- * AST node visitor that counts the nodes visited.
- */
- static class NodeCounter extends ASTVisitor {
- public int count = 0;
-
- /* (no javadoc for this method)
- * Method declared on ASTVisitor.
- */
- public void preVisit(ASTNode node) {
- count++;
- }
-
- }
-
- /**
- * Returns the number of AST nodes in the given subtree.
- *
- * @param node the root of the subtree
- * @return the number of nodes (always positive)
- */
- static int nodeCount(ASTNode node) {
- NodeCounter c = new NodeCounter();
- node.accept(c);
- return c.count;
- }
-
- /**
- * Checks that the ASTNode.subtreeMatch mechanism is working
- * for a node of a given type.
- */
- void basicMatch(ASTNode node) {
- int count = nodeCount(node);
-
- // check that matcher was called with right arguments
- // and that matches succeed
- TestMatcher m1 = new TestMatcher();
- Object o1 = new Object();
- m1.result = true;
- boolean result = node.subtreeMatch(m1, o1);
- assertTrue(m1.matchCalls == 1);
- assertTrue(m1.receiverNode == node);
- assertTrue(m1.otherNode == o1);
- assertTrue(result == true);
-
- // check that matcher was called with right arguments
- // and that non-matches fail
- m1 = new TestMatcher();
- o1 = new Object();
- m1.result = false;
- result = node.subtreeMatch(m1, o1);
- assertTrue(m1.matchCalls == 1);
- assertTrue(m1.receiverNode == node);
- assertTrue(m1.otherNode == o1);
- assertTrue(result == false);
-
- // check that ASTMatcher default implementations delegate
- m1 = new TestMatcher();
- m1.superMatch = true;
- result = node.subtreeMatch(m1, node);
- assertTrue(m1.matchCalls == count);
- assertTrue(result == true);
-
- }
-
- // NAMES
- public void testSimpleName() {
- Name x1 = ast.newName(new String[]{"Z"}); //$NON-NLS-1$
- basicMatch(x1);
- }
-
- public void testQualifiedName() {
- Name x1 = ast.newName(new String[]{"X", "Y"}); //$NON-NLS-1$ //$NON-NLS-2$
- basicMatch(x1);
- }
-
-
- // TYPES
- public void testPrimitiveType() {
- Type x1 = ast.newPrimitiveType(PrimitiveType.CHAR);
- basicMatch(x1);
- }
-
- public void testSimpleType() {
- Type x1 = ast.newSimpleType(ast.newName(new String[]{"Z"})); //$NON-NLS-1$
- basicMatch(x1);
- }
-
- public void testArrayType() {
- Type x0 = ast.newPrimitiveType(PrimitiveType.CHAR);
- Type x1 = ast.newArrayType(x0);
- basicMatch(x1);
- }
-
- // EXPRESSIONS and STATEMENTS
-
- public void testAnonymousClassDeclaration() {
- AnonymousClassDeclaration x1 = ast.newAnonymousClassDeclaration();
- x1.bodyDeclarations().add(FD1);
- x1.bodyDeclarations().add(FD2);
- basicMatch(x1);
- }
- public void testArrayAccess() {
- ArrayAccess x1 = ast.newArrayAccess();
- x1.setArray(E1);
- x1.setIndex(E2);
- basicMatch(x1);
- }
- public void testArrayCreation() {
- ArrayCreation x1 = ast.newArrayCreation();
- x1.setType(ast.newArrayType(T1));
- x1.dimensions().add(E1);
- x1.dimensions().add(E2);
- x1.setInitializer(ast.newArrayInitializer());
- basicMatch(x1);
- }
- public void testArrayInitializer() {
- ArrayInitializer x1 = ast.newArrayInitializer();
- x1.expressions().add(E1);
- x1.expressions().add(E2);
- basicMatch(x1);
- }
- public void testAssertStatement() {
- AssertStatement x1 = ast.newAssertStatement();
- x1.setExpression(E1);
- x1.setMessage(E2);
- basicMatch(x1);
- }
- public void testAssignment() {
- Assignment x1 = ast.newAssignment();
- x1.setLeftHandSide(E1);
- x1.setRightHandSide(E2);
- basicMatch(x1);
- }
- public void testBlock() {
- Block x1 = ast.newBlock();
- x1.statements().add(S1);
- x1.statements().add(S2);
- basicMatch(x1);
- }
- public void testBooleanLiteral() {
- BooleanLiteral x1 = ast.newBooleanLiteral(true);
- basicMatch(x1);
- }
- public void testBreakStatement() {
- BreakStatement x1 = ast.newBreakStatement();
- x1.setLabel(N1);
- basicMatch(x1);
- }
- public void testCastExpression() {
- CastExpression x1 = ast.newCastExpression();
- x1.setType(T1);
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testCatchClause() {
- CatchClause x1 = ast.newCatchClause();
- x1.setException(V1);
- x1.setBody(B1);
- basicMatch(x1);
- }
- public void testCharacterLiteral() {
- CharacterLiteral x1 = ast.newCharacterLiteral();
- x1.setCharValue('q');
- basicMatch(x1);
- }
- public void testClassInstanceCreation() {
- ClassInstanceCreation x1 = ast.newClassInstanceCreation();
- x1.setExpression(E1);
- x1.setName(N1);
- x1.setAnonymousClassDeclaration(ACD1);
- basicMatch(x1);
- }
- public void testCompilationUnit() {
- CompilationUnit x1 = ast.newCompilationUnit();
- x1.setPackage(PD1);
- x1.imports().add(ID1);
- x1.imports().add(ID2);
- x1.types().add(TD1);
- x1.types().add(TD2);
- basicMatch(x1);
- }
- public void testConditionalExpression() {
- ConditionalExpression x1 = ast.newConditionalExpression();
- x1.setExpression(E1);
- x1.setThenExpression(E2);
- x1.setElseExpression(N1);
- basicMatch(x1);
- }
- public void testConstructorInvocation() {
- ConstructorInvocation x1 = ast.newConstructorInvocation();
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testContinueStatement() {
- ContinueStatement x1 = ast.newContinueStatement();
- x1.setLabel((SimpleName) N1);
- basicMatch(x1);
- }
- public void testDoStatement() {
- DoStatement x1 = ast.newDoStatement();
- x1.setExpression(E1);
- x1.setBody(S1);
- basicMatch(x1);
- }
- public void testEmptyStatement() {
- EmptyStatement x1 = ast.newEmptyStatement();
- basicMatch(x1);
- }
- public void testExpressionStatement() {
- ExpressionStatement x1 = ast.newExpressionStatement(E1);
- basicMatch(x1);
- }
- public void testFieldAccess() {
- FieldAccess x1 = ast.newFieldAccess();
- x1.setExpression(E1);
- x1.setName(N1);
- basicMatch(x1);
- }
- public void testFieldDeclaration() {
- FieldDeclaration x1 = ast.newFieldDeclaration(W1);
- x1.setJavadoc(JD1);
- x1.setType(T1);
- x1.fragments().add(W2);
- basicMatch(x1);
- }
- public void testForStatement() {
- ForStatement x1 = ast.newForStatement();
- x1.initializers().add(E1);
- x1.initializers().add(E2);
- x1.setExpression(N1);
- x1.updaters().add(N2);
- x1.updaters().add(N3);
- x1.setBody(S1);
- basicMatch(x1);
- }
- public void testIfStatement() {
- IfStatement x1 = ast.newIfStatement();
- x1.setExpression(E1);
- x1.setThenStatement(S1);
- x1.setElseStatement(S2);
- basicMatch(x1);
- }
- public void testImportDeclaration() {
- ImportDeclaration x1 = ast.newImportDeclaration();
- x1.setName(N1);
- basicMatch(x1);
- }
- public void testInfixExpression() {
- InfixExpression x1 = ast.newInfixExpression();
- x1.setOperator(InfixExpression.Operator.PLUS);
- x1.setLeftOperand(E1);
- x1.setRightOperand(E2);
- x1.extendedOperands().add(N1);
- x1.extendedOperands().add(N2);
- basicMatch(x1);
- }
- public void testInitializer() {
- Initializer x1 = ast.newInitializer();
- x1.setJavadoc(JD1);
- x1.setBody(B1);
- basicMatch(x1);
- }
- public void testJavadoc() {
- Javadoc x1 = ast.newJavadoc();
- x1.setComment("/**?*/"); //$NON-NLS-1$
- basicMatch(x1);
- }
-
- public void testLabeledStatement() {
- LabeledStatement x1 = ast.newLabeledStatement();
- x1.setLabel(N1);
- x1.setBody(S1);
- basicMatch(x1);
- }
- public void testMethodDeclaration() {
- MethodDeclaration x1 = ast.newMethodDeclaration();
- x1.setJavadoc(JD1);
- x1.setReturnType(T1);
- x1.setName(N1);
- x1.parameters().add(V1);
- x1.parameters().add(V2);
- x1.thrownExceptions().add(N2);
- x1.thrownExceptions().add(N3);
- x1.setBody(B1);
- basicMatch(x1);
- }
- public void testMethodInvocation() {
- MethodInvocation x1 = ast.newMethodInvocation();
- x1.setExpression(N1);
- x1.setName(N2);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testNullLiteral() {
- NullLiteral x1 = ast.newNullLiteral();
- basicMatch(x1);
- }
- public void testNumberLiteral() {
- NumberLiteral x1 = ast.newNumberLiteral("1.0"); //$NON-NLS-1$
- basicMatch(x1);
- }
- public void testPackageDeclaration() {
- PackageDeclaration x1 = ast.newPackageDeclaration();
- basicMatch(x1);
- }
- public void testParenthesizedExpression() {
- ParenthesizedExpression x1 = ast.newParenthesizedExpression();
- basicMatch(x1);
- }
- public void testPostfixExpression() {
- PostfixExpression x1 = ast.newPostfixExpression();
- x1.setOperand(E1);
- x1.setOperator(PostfixExpression.Operator.INCREMENT);
- basicMatch(x1);
- }
- public void testPrefixExpression() {
- PrefixExpression x1 = ast.newPrefixExpression();
- x1.setOperand(E1);
- x1.setOperator(PrefixExpression.Operator.INCREMENT);
- basicMatch(x1);
- }
- public void testReturnStatement() {
- ReturnStatement x1 = ast.newReturnStatement();
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testSingleVariableDeclaration() {
- SingleVariableDeclaration x1 = ast.newSingleVariableDeclaration();
- x1.setType(T1);
- x1.setName(N1);
- x1.setInitializer(E1);
- basicMatch(x1);
- }
- public void testStringLiteral() {
- StringLiteral x1 = ast.newStringLiteral();
- x1.setLiteralValue("H"); //$NON-NLS-1$
- basicMatch(x1);
- }
- public void testSuperConstructorInvocation() {
- SuperConstructorInvocation x1 = ast.newSuperConstructorInvocation();
- x1.setExpression(N1);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testSuperFieldAccess() {
- SuperFieldAccess x1 = ast.newSuperFieldAccess();
- x1.setQualifier(N1);
- x1.setName(N2);
- basicMatch(x1);
- }
- public void testSuperMethodInvocation() {
- SuperMethodInvocation x1 = ast.newSuperMethodInvocation();
- x1.setQualifier(N1);
- x1.setName(N2);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testSwitchCase() {
- SwitchCase x1 = ast.newSwitchCase();
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testSwitchStatement() {
- SwitchStatement x1 = ast.newSwitchStatement();
- x1.setExpression(E1);
- x1.statements().add(S1);
- x1.statements().add(S2);
- basicMatch(x1);
- }
- public void testSynchronizedStatement() {
- SynchronizedStatement x1 = ast.newSynchronizedStatement();
- x1.setExpression(E1);
- x1.setBody(B1);
- basicMatch(x1);
- }
- public void testThisExpression() {
- ThisExpression x1 = ast.newThisExpression();
- x1.setQualifier(N1);
- basicMatch(x1);
- }
- public void testThrowStatement() {
- ThrowStatement x1 = ast.newThrowStatement();
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testTryStatement() {
- TryStatement x1 = ast.newTryStatement();
- x1.setBody(B1);
- CatchClause c1 = ast.newCatchClause();
- c1.setException(V1);
- c1.setBody(ast.newBlock());
- x1.catchClauses().add(c1);
- CatchClause c2 = ast.newCatchClause();
- c2.setException(V2);
- c2.setBody(ast.newBlock());
- x1.catchClauses().add(c2);
- x1.setFinally(ast.newBlock());
- basicMatch(x1);
- }
- public void testTypeDeclaration() {
- TypeDeclaration x1 = ast.newTypeDeclaration();
- x1.setJavadoc(JD1);
- x1.setName(N1);
- x1.setSuperclass(N2);
- x1.superInterfaces().add(N3);
- x1.superInterfaces().add(ast.newSimpleName("J")); //$NON-NLS-1$
- x1.bodyDeclarations().add(FD1);
- x1.bodyDeclarations().add(FD2);
- basicMatch(x1);
- }
- public void testTypeDeclarationStatement() {
- TypeDeclarationStatement x1 = ast.newTypeDeclarationStatement(TD1);
- basicMatch(x1);
- }
- public void testTypeLiteral() {
- TypeLiteral x1 = ast.newTypeLiteral();
- x1.setType(T1);
- basicMatch(x1);
- }
- public void testVariableDeclarationFragment() {
- VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
- x1.setName(N1);
- x1.setInitializer(E1);
- basicMatch(x1);
- }
- public void testVariableDeclarationExpression() {
- VariableDeclarationExpression x1 = ast.newVariableDeclarationExpression(W1);
- x1.setType(T1);
- x1.fragments().add(W2);
- basicMatch(x1);
- }
- public void testVariableDeclarationStatement() {
- VariableDeclarationStatement x1 = ast.newVariableDeclarationStatement(W1);
- x1.setType(T1);
- x1.fragments().add(W2);
- basicMatch(x1);
- }
- public void testWhileStatement() {
- WhileStatement x1 = ast.newWhileStatement();
- x1.setExpression(E1);
- x1.setBody(S1);
- basicMatch(x1);
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTNodesCollectorVisitor.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTNodesCollectorVisitor.java
deleted file mode 100644
index 264c611..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTNodesCollectorVisitor.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.dom;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-
-class ASTNodesCollectorVisitor extends ASTVisitor {
-
- private Set detachedAstNodes;
-
- /**
- *
- * @see java.lang.Object#Object()
- */
- ASTNodesCollectorVisitor() {
- this.detachedAstNodes = new HashSet();
- }
-
- private void add(ASTNode node) {
- this.detachedAstNodes.add(node);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.AnonymousClassDeclaration)
- */
- public void endVisit(AnonymousClassDeclaration node) {
- add(node);
- detachedListElement(node.bodyDeclarations());
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ArrayAccess)
- */
- public void endVisit(ArrayAccess node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ArrayCreation)
- */
- public void endVisit(ArrayCreation node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ArrayInitializer)
- */
- public void endVisit(ArrayInitializer node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ArrayType)
- */
- public void endVisit(ArrayType node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.AssertStatement)
- */
- public void endVisit(AssertStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.Assignment)
- */
- public void endVisit(Assignment node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.Block)
- */
- public void endVisit(Block node) {
- }
-
- private void detachedListElement(List list) {
- for (int i = 0; i < list.size(); i++) {
- list.remove(0);
- }
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.BooleanLiteral)
- */
- public void endVisit(BooleanLiteral node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.BreakStatement)
- */
- public void endVisit(BreakStatement node) {
-
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.CastExpression)
- */
- public void endVisit(CastExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.CatchClause)
- */
- public void endVisit(CatchClause node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.CharacterLiteral)
- */
- public void endVisit(CharacterLiteral node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ClassInstanceCreation)
- */
- public void endVisit(ClassInstanceCreation node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.CompilationUnit)
- */
- public void endVisit(CompilationUnit node) {
- detachedListElement(node.imports());
- node.setPackage(node.getAST().newPackageDeclaration());
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ConditionalExpression)
- */
- public void endVisit(ConditionalExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ConstructorInvocation)
- */
- public void endVisit(ConstructorInvocation node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ContinueStatement)
- */
- public void endVisit(ContinueStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.DoStatement)
- */
- public void endVisit(DoStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.EmptyStatement)
- */
- public void endVisit(EmptyStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ExpressionStatement)
- */
- public void endVisit(ExpressionStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.FieldAccess)
- */
- public void endVisit(FieldAccess node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.FieldDeclaration)
- */
- public void endVisit(FieldDeclaration node) {
- detachedListElement(node.fragments());
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ForStatement)
- */
- public void endVisit(ForStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.IfStatement)
- */
- public void endVisit(IfStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ImportDeclaration)
- */
- public void endVisit(ImportDeclaration node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.InfixExpression)
- */
- public void endVisit(InfixExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.Initializer)
- */
- public void endVisit(Initializer node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.InstanceofExpression)
- */
- public void endVisit(InstanceofExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.Javadoc)
- */
- public void endVisit(Javadoc node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.LabeledStatement)
- */
- public void endVisit(LabeledStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.MethodDeclaration)
- */
- public void endVisit(MethodDeclaration node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.MethodInvocation)
- */
- public void endVisit(MethodInvocation node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.NullLiteral)
- */
- public void endVisit(NullLiteral node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.NumberLiteral)
- */
- public void endVisit(NumberLiteral node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.PackageDeclaration)
- */
- public void endVisit(PackageDeclaration node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ParenthesizedExpression)
- */
- public void endVisit(ParenthesizedExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.PostfixExpression)
- */
- public void endVisit(PostfixExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.PrefixExpression)
- */
- public void endVisit(PrefixExpression node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.PrimitiveType)
- */
- public void endVisit(PrimitiveType node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.QualifiedName)
- */
- public void endVisit(QualifiedName node) {
- add(node);
- node.setQualifier(node.getAST().newSimpleName("sss")); //$NON-NLS-1$
- node.setName(node.getAST().newSimpleName("sss")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ReturnStatement)
- */
- public void endVisit(ReturnStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SimpleName)
- */
- public void endVisit(SimpleName node) {
- ASTNode parent = node.getParent();
- switch(parent.getNodeType()) {
- case ASTNode.CONTINUE_STATEMENT :
- case ASTNode.BREAK_STATEMENT :
- case ASTNode.LABELED_STATEMENT :
- break;
- default :
- add(node);
- }
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SimpleType)
- */
- public void endVisit(SimpleType node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SingleVariableDeclaration)
- */
- public void endVisit(SingleVariableDeclaration node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.StringLiteral)
- */
- public void endVisit(StringLiteral node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SuperConstructorInvocation)
- */
- public void endVisit(SuperConstructorInvocation node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SuperFieldAccess)
- */
- public void endVisit(SuperFieldAccess node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SuperMethodInvocation)
- */
- public void endVisit(SuperMethodInvocation node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SwitchCase)
- */
- public void endVisit(SwitchCase node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SwitchStatement)
- */
- public void endVisit(SwitchStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.SynchronizedStatement)
- */
- public void endVisit(SynchronizedStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ThisExpression)
- */
- public void endVisit(ThisExpression node) {
- node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.ThrowStatement)
- */
- public void endVisit(ThrowStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.TryStatement)
- */
- public void endVisit(TryStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.TypeDeclaration)
- */
- public void endVisit(TypeDeclaration node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- node.setSuperclass(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- detachedListElement(node.bodyDeclarations());
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.TypeDeclarationStatement)
- */
- public void endVisit(TypeDeclarationStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.TypeLiteral)
- */
- public void endVisit(TypeLiteral node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.VariableDeclarationExpression)
- */
- public void endVisit(VariableDeclarationExpression node) {
- detachedListElement(node.fragments());
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.VariableDeclarationFragment)
- */
- public void endVisit(VariableDeclarationFragment node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.VariableDeclarationStatement)
- */
- public void endVisit(VariableDeclarationStatement node) {
- detachedListElement(node.fragments());
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.WhileStatement)
- */
- public void endVisit(WhileStatement node) {
- }
-
- /**
- * Returns the detachedAstNodes.
- * @return Set
- */
- public Set getDetachedAstNodes() {
- return detachedAstNodes;
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
deleted file mode 100644
index a326a1a..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
+++ /dev/null
@@ -1,6062 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import java.util.Map;
-
-import junit.framework.Test;
-import org.eclipse.jdt.core.dom.*;
-
-// testing
-
-public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
-
- class CheckPositionsMatcher extends ASTMatcher {
-
- private void checkPositions(Object source, Object destination) {
- assertTrue(source instanceof ASTNode);
- assertTrue(destination instanceof ASTNode);
- int startPosition = ((ASTNode)source).getStartPosition();
- if (startPosition != -1) {
- assertTrue(startPosition == ((ASTNode)destination).getStartPosition());
- }
- int length = ((ASTNode)source).getLength();
- if (length != 0) {
- assertTrue(length == ((ASTNode)destination).getLength());
- }
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(AnonymousClassDeclaration, Object)
- */
- public boolean match(AnonymousClassDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ArrayAccess, Object)
- */
- public boolean match(ArrayAccess node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ArrayCreation, Object)
- */
- public boolean match(ArrayCreation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ArrayInitializer, Object)
- */
- public boolean match(ArrayInitializer node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ArrayType, Object)
- */
- public boolean match(ArrayType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(AssertStatement, Object)
- */
- public boolean match(AssertStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(Assignment, Object)
- */
- public boolean match(Assignment node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(Block, Object)
- */
- public boolean match(Block node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(BooleanLiteral, Object)
- */
- public boolean match(BooleanLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(BreakStatement, Object)
- */
- public boolean match(BreakStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(CastExpression, Object)
- */
- public boolean match(CastExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(CatchClause, Object)
- */
- public boolean match(CatchClause node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(CharacterLiteral, Object)
- */
- public boolean match(CharacterLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ClassInstanceCreation, Object)
- */
- public boolean match(ClassInstanceCreation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(CompilationUnit, Object)
- */
- public boolean match(CompilationUnit node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ConditionalExpression, Object)
- */
- public boolean match(ConditionalExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ConstructorInvocation, Object)
- */
- public boolean match(ConstructorInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ContinueStatement, Object)
- */
- public boolean match(ContinueStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(DoStatement, Object)
- */
- public boolean match(DoStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(EmptyStatement, Object)
- */
- public boolean match(EmptyStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ExpressionStatement, Object)
- */
- public boolean match(ExpressionStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(FieldAccess, Object)
- */
- public boolean match(FieldAccess node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(FieldDeclaration, Object)
- */
- public boolean match(FieldDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ForStatement, Object)
- */
- public boolean match(ForStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(IfStatement, Object)
- */
- public boolean match(IfStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ImportDeclaration, Object)
- */
- public boolean match(ImportDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(InfixExpression, Object)
- */
- public boolean match(InfixExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(Initializer, Object)
- */
- public boolean match(Initializer node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(InstanceofExpression, Object)
- */
- public boolean match(InstanceofExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(Javadoc, Object)
- */
- public boolean match(Javadoc node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(LabeledStatement, Object)
- */
- public boolean match(LabeledStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(MethodDeclaration, Object)
- */
- public boolean match(MethodDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(MethodInvocation, Object)
- */
- public boolean match(MethodInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(NullLiteral, Object)
- */
- public boolean match(NullLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(NumberLiteral, Object)
- */
- public boolean match(NumberLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(PackageDeclaration, Object)
- */
- public boolean match(PackageDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ParenthesizedExpression, Object)
- */
- public boolean match(ParenthesizedExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(PostfixExpression, Object)
- */
- public boolean match(PostfixExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(PrefixExpression, Object)
- */
- public boolean match(PrefixExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(PrimitiveType, Object)
- */
- public boolean match(PrimitiveType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(QualifiedName, Object)
- */
- public boolean match(QualifiedName node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ReturnStatement, Object)
- */
- public boolean match(ReturnStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SimpleName, Object)
- */
- public boolean match(SimpleName node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SimpleType, Object)
- */
- public boolean match(SimpleType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SingleVariableDeclaration, Object)
- */
- public boolean match(SingleVariableDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(StringLiteral, Object)
- */
- public boolean match(StringLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SuperConstructorInvocation, Object)
- */
- public boolean match(SuperConstructorInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SuperFieldAccess, Object)
- */
- public boolean match(SuperFieldAccess node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SuperMethodInvocation, Object)
- */
- public boolean match(SuperMethodInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SwitchCase, Object)
- */
- public boolean match(SwitchCase node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SwitchStatement, Object)
- */
- public boolean match(SwitchStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(SynchronizedStatement, Object)
- */
- public boolean match(SynchronizedStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ThisExpression, Object)
- */
- public boolean match(ThisExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(ThrowStatement, Object)
- */
- public boolean match(ThrowStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(TryStatement, Object)
- */
- public boolean match(TryStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(TypeDeclaration, Object)
- */
- public boolean match(TypeDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(TypeDeclarationStatement, Object)
- */
- public boolean match(TypeDeclarationStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(TypeLiteral, Object)
- */
- public boolean match(TypeLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(VariableDeclarationExpression, Object)
- */
- public boolean match(VariableDeclarationExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(VariableDeclarationFragment, Object)
- */
- public boolean match(VariableDeclarationFragment node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(VariableDeclarationStatement, Object)
- */
- public boolean match(VariableDeclarationStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTMatcher#match(WhileStatement, Object)
- */
- public boolean match(WhileStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- }
-
- public static Test suite() {
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTTest.class.getName());
-
- Class c = ASTTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTTest(methods[i].getName()));
- }
- }
- return suite;
- }
-
- AST ast;
-
- public ASTTest(String name) {
- super(name);
- }
-
- protected void setUp() {
- ast = new AST();
- }
-
- protected void tearDown() {
- ast = null;
- }
-
-
- /**
- * Snippets that show how to...
- */
- public void testExampleSnippets() {
- {
- AST localAst = new AST();
- CompilationUnit cu = localAst.newCompilationUnit();
-
- // package com.example;
- PackageDeclaration pd = localAst.newPackageDeclaration();
- pd.setName(localAst.newName(new String[]{"com", "example"})); //$NON-NLS-1$ //$NON-NLS-2$
- cu.setPackage(pd);
- assertTrue(pd.getRoot() == cu);
-
- // import java.io;*;
- ImportDeclaration im1 = localAst.newImportDeclaration();
- im1.setName(localAst.newName(new String[]{"java", "io"})); //$NON-NLS-1$ //$NON-NLS-2$
- im1.setOnDemand(true);
- cu.imports().add(im1);
- assertTrue(im1.getRoot() == cu);
-
- // import java.util.List;
- ImportDeclaration im2 = localAst.newImportDeclaration();
- im2.setName(localAst.newName(new String[]{"java", "util", "List"})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- im2.setOnDemand(false);
- cu.imports().add(im2);
- assertTrue(im2.getRoot() == cu);
-
- // public class MyClass {}
- TypeDeclaration td = localAst.newTypeDeclaration();
- td.setModifiers(Modifier.PUBLIC);
- td.setInterface(false);
- td.setName(localAst.newSimpleName("MyClass")); //$NON-NLS-1$
- cu.types().add(td);
- assertTrue(td.getRoot() == cu);
-
- // private static boolean DEBUG = true;
- VariableDeclarationFragment f1 = localAst.newVariableDeclarationFragment();
- f1.setName(localAst.newSimpleName("DEBUG")); //$NON-NLS-1$
- f1.setInitializer(localAst.newBooleanLiteral(true));
- FieldDeclaration fd = localAst.newFieldDeclaration(f1);
- fd.setType(localAst.newPrimitiveType(PrimitiveType.BOOLEAN));
- fd.setModifiers(Modifier.PRIVATE | Modifier.STATIC);
- td.bodyDeclarations().add(fd);
- assertTrue(fd.getRoot() == cu);
-
- // public static void main();
- MethodDeclaration md = localAst.newMethodDeclaration();
- md.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
- md.setConstructor(false);
- md.setName(localAst.newSimpleName("main")); //$NON-NLS-1$
- md.setReturnType(localAst.newPrimitiveType(PrimitiveType.VOID));
- td.bodyDeclarations().add(md);
- assertTrue(md.getRoot() == cu);
-
- // String[] args
- SingleVariableDeclaration a1 = localAst.newSingleVariableDeclaration();
- a1.setType(localAst.newArrayType(
- localAst.newSimpleType(localAst.newSimpleName("String")))); //$NON-NLS-1$
- a1.setName(localAst.newSimpleName("args")); //$NON-NLS-1$
- md.parameters().add(a1);
- assertTrue(a1.getRoot() == cu);
-
- // {}
- Block b = localAst.newBlock();
- md.setBody(b);
- assertTrue(b.getRoot() == cu);
-
- // System.out.println("hello world");
- MethodInvocation e = localAst.newMethodInvocation();
- e.setExpression(localAst.newName(new String[] {"System", "out"})); //$NON-NLS-1$ //$NON-NLS-2$
- e.setName(localAst.newSimpleName("println")); //$NON-NLS-1$
- StringLiteral h = localAst.newStringLiteral();
- h.setLiteralValue("hello world"); //$NON-NLS-1$
- e.arguments().add(h);
-
- b.statements().add(localAst.newExpressionStatement(e));
- assertTrue(e.getRoot() == cu);
- assertTrue(h.getRoot() == cu);
-
- // new String[len]
- ArrayCreation ac1 = localAst.newArrayCreation();
- ac1.setType(
- localAst.newArrayType(
- localAst.newSimpleType(localAst.newSimpleName("String")))); //$NON-NLS-1$
- ac1.dimensions().add(localAst.newSimpleName("len")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(ac1));
- assertTrue(ac1.getRoot() == cu);
-
- // new double[7][24][]
- ArrayCreation ac2 = localAst.newArrayCreation();
- ac2.setType(
- localAst.newArrayType(
- localAst.newPrimitiveType(PrimitiveType.DOUBLE), 3));
- ac2.dimensions().add(localAst.newNumberLiteral("7")); //$NON-NLS-1$
- ac2.dimensions().add(localAst.newNumberLiteral("24")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(ac2));
- assertTrue(ac2.getRoot() == cu);
-
- // new int[] {1, 2}
- ArrayCreation ac3 = localAst.newArrayCreation();
- ac3.setType(
- localAst.newArrayType(
- localAst.newPrimitiveType(PrimitiveType.INT)));
- ArrayInitializer ai = localAst.newArrayInitializer();
- ac3.setInitializer(ai);
- ai.expressions().add(localAst.newNumberLiteral("1")); //$NON-NLS-1$
- ai.expressions().add(localAst.newNumberLiteral("2")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(ac3));
- assertTrue(ac3.getRoot() == cu);
- assertTrue(ai.getRoot() == cu);
-
- // new String(10)
- ClassInstanceCreation cr1 = localAst.newClassInstanceCreation();
- cr1.setName(localAst.newSimpleName("String")); //$NON-NLS-1$
- cr1.arguments().add(localAst.newNumberLiteral("10")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(cr1));
- assertTrue(cr1.getRoot() == cu);
-
- // new Listener() {public void handleEvent() {} }
- ClassInstanceCreation cr2 = localAst.newClassInstanceCreation();
- AnonymousClassDeclaration ad1 = localAst.newAnonymousClassDeclaration();
- cr2.setAnonymousClassDeclaration(ad1);
- cr2.setName(localAst.newSimpleName("Listener")); //$NON-NLS-1$
- MethodDeclaration md0 = localAst.newMethodDeclaration();
- md0.setModifiers(Modifier.PUBLIC);
- md0.setName(localAst.newSimpleName("handleEvent")); //$NON-NLS-1$
- md0.setBody(localAst.newBlock());
- ad1.bodyDeclarations().add(md0);
- b.statements().add(localAst.newExpressionStatement(cr2));
- assertTrue(cr2.getRoot() == cu);
- assertTrue(md0.getRoot() == cu);
- assertTrue(ad1.getRoot() == cu);
-
- }
- }
-
- abstract class Property {
-
- /**
- * Indicates whether this property is compulsory, in that every node
- * must have a value at all times.
- */
- private boolean compulsory;
-
- /**
- * Creates a new property with the given name.
- */
- Property(String propertyName, boolean compulsory, Class nodeType) {
- this.compulsory = compulsory;
- }
-
- /**
- * Returns a sample node of a type suitable for storing
- * in this property.
- *
- * @param ast the target AST
- * @param parented <code>true</code> if the sample should be
- * parented, and <code>false</code> if unparented
- * @return a sample node
- */
- public abstract ASTNode sample(AST newValue, boolean parented);
-
- /**
- * Returns a sample node of a type suitable for storing
- * in this property. The sample embeds the node itself.
- * <p>
- * For instance, for an Expression-valued property of a given
- * Statement, this method returns an Expression that embeds
- * this Statement node (as a descendent).
- * </p>
- * <p>
- * Returns <code>null</code> if such an embedding is impossible.
- * For instance, for an Name-valued property of a given
- * Statement, this method returns <code>null</code> because
- * an Expression cannot be embedded in a Name.
- * </p>
- * <p>
- * This implementation returns <code>null</code>. Subclasses
- * should reimplement to specify an embedding.
- * </p>
- *
- * @param ast the target AST
- * @return a sample node that embeds the given node,
- * and <code>null</code> if such an embedding is impossible
- */
- public ASTNode wrap() {
- return null;
- }
-
- /**
- * Undoes the effects of a previous <code>wrap</code>.
- * <p>
- * This implementation does nothing. Subclasses
- * should reimplement if they reimplement <code>wrap</code>.
- * </p>
- *
- * @param ast the target AST
- * @return a sample node that embeds the given node,
- * and <code>null</code> if such an embedding is impossible
- */
- public void unwrap() {
- }
-
- /**
- * Returns whether this property is compulsory, in that every node
- * must have a value at all times.
- *
- * @return <code>true</code> if the property is compulsory,
- * and <code>false</code> if the property may be null
- */
- public final boolean isCompulsory() {
- return compulsory;
- }
-
- /**
- * Returns the value of this property.
- * <p>
- * This implementation throws an unchecked exception. Subclasses
- * should reimplement.
- * </p>
- *
- * @return the property value, or <code>null</code> if no value
- */
- public ASTNode get() {
- throw new RuntimeException("get not implemented"); //$NON-NLS-1$
- }
-
- /**
- * Sets or clears the value of this property.
- * <p>
- * This implementation throws an unchecked exception. Subclasses
- * should reimplement.
- * </p>
- *
- * @param value the property value, or <code>null</code> if no value
- */
- public void set(ASTNode value) {
- throw new RuntimeException("get(" + value + ") not implemented"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Exercises the given property of the given node.
- *
- * @param node the node to test
- * @param prop the property descriptor
- */
- void genericPropertyTest(ASTNode node, Property prop) {
-
- ASTNode x1 = prop.sample(node.getAST(), false);
- prop.set(x1);
- assertTrue(prop.get() == x1);
- assertTrue(x1.getParent() == node);
-
- // check handling of null
- if (prop.isCompulsory()) {
- try {
- prop.set(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- } else {
- long previousCount = node.getAST().modificationCount();
- prop.set(null);
- assertTrue(prop.get() == null);
- assertTrue(node.getAST().modificationCount() > previousCount);
- }
-
- // check that a child from a different AST is detected
- try {
- prop.set(prop.sample(new AST(), false));
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a child with a parent is detected
- try {
- ASTNode b1 = prop.sample(node.getAST(), true);
- prop.set(b1); // bogus: already has parent
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a cycle is detected
- assertTrue(node.getParent() == null);
- ASTNode s1 = null;
- try {
- s1 = prop.wrap();
- if (s1 != null) {
- prop.set(s1); // bogus: creates a cycle
- assertTrue(false);
- }
- } catch (RuntimeException e) {
- // pass
- } finally {
- if (s1 != null) {
- prop.unwrap();
- assertTrue(node.getParent() == null);
- }
- }
- }
-
- /**
- * Exercises the given property of the given node.
- *
- * @param node the node to test
- * @param children the node to test
- * @param prop the property descriptor
- */
- void genericPropertyListTest(ASTNode node, List children, Property prop) {
-
- // wipe the slate clean
- children.clear();
- assertTrue(children.size() == 0);
-
- // add a child
- ASTNode x1 = prop.sample(node.getAST(), false);
- long previousCount = node.getAST().modificationCount();
- children.add(x1);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 1);
- assertTrue(children.get(0) == x1);
- assertTrue(x1.getParent() == node);
-
- // add a second child
- ASTNode x2 = prop.sample(node.getAST(), false);
- previousCount = node.getAST().modificationCount();
- children.add(x2);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 2);
- assertTrue(children.get(0) == x1);
- assertTrue(children.get(1) == x2);
- assertTrue(x1.getParent() == node);
- assertTrue(x2.getParent() == node);
-
- // remove the first child
- previousCount = node.getAST().modificationCount();
- children.remove(0);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 1);
- assertTrue(children.get(0) == x2);
- assertTrue(x1.getParent() == null);
- assertTrue(x2.getParent() == node);
-
- // remove the remaining child
- previousCount = node.getAST().modificationCount();
- children.remove(x2);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 0);
- assertTrue(x1.getParent() == null);
- assertTrue(x2.getParent() == null);
-
- // check that null is never allowed
- try {
- children.add(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a child from a different AST is detected
- try {
- children.add(prop.sample(new AST(), false));
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a child with a parent is detected
- try {
- ASTNode b1 = prop.sample(node.getAST(), true);
- children.add(b1); // bogus: already has parent
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a cycle is detected
- assertTrue(node.getParent() == null);
- ASTNode s1 = null;
- try {
- s1 = prop.wrap();
- if (s1 != null) {
- children.add(s1); // bogus: creates a cycle
- assertTrue(false);
- }
- } catch (RuntimeException e) {
- // pass
- } finally {
- if (s1 != null) {
- prop.unwrap();
- assertTrue(node.getParent() == null);
- }
- }
-
- }
-
- public void testAST() {
-
- // modification count is always non-negative
- assertTrue(ast.modificationCount() >= 0);
-
- // modification count increases for node creations
- long previousCount = ast.modificationCount();
- SimpleName x = ast.newSimpleName("first"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
-
- // modification count does not increase for reading node attributes
- previousCount = ast.modificationCount();
- x.getIdentifier();
- x.getParent();
- x.getRoot();
- x.getAST();
- x.getFlags();
- x.getStartPosition();
- x.getLength();
- x.equals(x);
- assertTrue(ast.modificationCount() == previousCount);
-
- // modification count does not increase for reading or writing properties
- previousCount = ast.modificationCount();
- x.getProperty("any"); //$NON-NLS-1$
- x.setProperty("any", "value"); // N.B. //$NON-NLS-1$ //$NON-NLS-2$
- x.properties();
- assertTrue(ast.modificationCount() == previousCount);
-
- // modification count increases for changing node attributes
- previousCount = ast.modificationCount();
- x.setIdentifier("second"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
-
- previousCount = ast.modificationCount();
- x.setFlags(0);
- assertTrue(ast.modificationCount() > previousCount);
-
- previousCount = ast.modificationCount();
- x.setSourceRange(-1,0);
- assertTrue(ast.modificationCount() > previousCount);
- }
-
- public void testWellKnownBindings() {
-
- // well known bindings
- String[] wkbs = {
- "byte", "char", "short", "int", "long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "boolean", "float", "double", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "java.lang.Object", //$NON-NLS-1$
- "java.lang.String", //$NON-NLS-1$
- "java.lang.StringBuffer", //$NON-NLS-1$
- "java.lang.Throwable", //$NON-NLS-1$
- "java.lang.Exception", //$NON-NLS-1$
- "java.lang.RuntimeException", //$NON-NLS-1$
- "java.lang.Error", //$NON-NLS-1$
- };
-
- // no-so-well-known bindings
- String[] nwkbs = {
- "verylong", //$NON-NLS-1$
- "java.lang.Math", //$NON-NLS-1$
- "com.example.MyCode", //$NON-NLS-1$
- };
-
- // none of the well known bindings resolve in a plain AST
- for (int i = 0; i<wkbs.length; i++) {
- assertTrue(ast.resolveWellKnownType(wkbs[i]) == null);
- }
-
- // none of the no so well known bindings resolve either
- for (int i = 0; i<nwkbs.length; i++) {
- assertTrue(ast.resolveWellKnownType(nwkbs[i]) == null);
- }
- }
-
- public void testSimpleName() {
- long previousCount = ast.modificationCount();
- SimpleName x = ast.newSimpleName("foo"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Name);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("foo".equals(x.getIdentifier())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.SIMPLE_NAME);
- assertTrue(x.isDeclaration() == false);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setIdentifier("bar"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("bar".equals(x.getIdentifier())); //$NON-NLS-1$
-
- // check that property cannot be set to null
- try {
- x.setIdentifier(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that property cannot be set to keyword or reserved work
- String[] reserved =
- new String[] {
- "true", "false", "null", // literals //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "abstract", "default", "if", "private", "this", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "boolean", "do", "implements", "protected", "throw", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "break", "double", "import", "public", "throws", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "byte", "else", "instanceof", "return", "transient", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "case", "extends", "int", "short", "try", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "catch", "final", "interface", "static", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "char", "finally", "long", "strictfp", "volatile", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "class", "float", "native", "super", "while", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "const", "for", "new", "switch", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "continue", "goto", "package", "synchronized"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- for (int i=0; i<reserved.length; i++) {
- try {
- x.setIdentifier(reserved[i]);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
-
- // check that "assert" is not considered a keyword
- x.setIdentifier("assert"); //$NON-NLS-1$
-
- // check that isDeclaration works
- QualifiedName y = ast.newQualifiedName(ast.newSimpleName("a"), x); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
- y.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- TypeDeclaration td = ast.newTypeDeclaration();
- td.setName(x);
- assertTrue(x.isDeclaration() == true);
- td.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- MethodDeclaration md = ast.newMethodDeclaration();
- md.setName(x);
- assertTrue(x.isDeclaration() == true);
- md.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- SingleVariableDeclaration vd = ast.newSingleVariableDeclaration();
- vd.setName(x);
- assertTrue(x.isDeclaration() == true);
- vd.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- VariableDeclarationFragment fd = ast.newVariableDeclarationFragment();
- fd.setName(x);
- assertTrue(x.isDeclaration() == true);
- fd.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- }
-
- public void testQualifiedName() {
- long previousCount = ast.modificationCount();
- final QualifiedName x = ast.newQualifiedName(
- ast.newSimpleName("q"), //$NON-NLS-1$
- ast.newSimpleName("i")); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Name);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getQualifier().getParent() == x);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == false);
- assertTrue(x.getNodeType() == ASTNode.QUALIFIED_NAME);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- QualifiedName s1 = ast.newQualifiedName(x, ast.newSimpleName("z")); //$NON-NLS-1$
- return s1;
- }
- public void unwrap() {
- QualifiedName s1 = (QualifiedName) x.getParent();
- s1.setQualifier(ast.newSimpleName("z")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- }
-
- public void testNullLiteral() {
- long previousCount = ast.modificationCount();
- NullLiteral x = ast.newNullLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.NULL_LITERAL);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- }
-
- public void testBooleanLiteral() {
- long previousCount = ast.modificationCount();
- BooleanLiteral x = ast.newBooleanLiteral(true);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.booleanValue() == true);
- assertTrue(x.getNodeType() == ASTNode.BOOLEAN_LITERAL);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setBooleanValue(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.booleanValue() == false);
-
- previousCount = ast.modificationCount();
- x.setBooleanValue(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.booleanValue() == true);
- }
-
- public void testStringLiteral() {
- long previousCount = ast.modificationCount();
- // check 0-arg factory first
- StringLiteral x = ast.newStringLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("\"\"".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue("".equals(x.getLiteralValue())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.STRING_LITERAL);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setEscapedValue("\"bye\""); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\"bye\"".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue("bye".equals(x.getLiteralValue())); //$NON-NLS-1$
-
- previousCount = ast.modificationCount();
- x.setLiteralValue("hi"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\"hi\"".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue("hi".equals(x.getLiteralValue())); //$NON-NLS-1$
-
- previousCount = ast.modificationCount();
- x.setLiteralValue("\\012\\015"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertEquals("different", "\"\\\\012\\\\015\"", x.getEscapedValue()); //$NON-NLS-1$
- assertTrue("\\012\\015".equals(x.getLiteralValue())); //$NON-NLS-1$
-
- previousCount = ast.modificationCount();
- x.setLiteralValue("\012\015"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\n\r".equals(x.getLiteralValue())); //$NON-NLS-1$
- assertEquals("different", "\"\\n\\r\"", x.getEscapedValue()); //$NON-NLS-1$
-
- // check that property cannot be set to null
- try {
- x.setEscapedValue(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that property cannot be set to null
- try {
- x.setLiteralValue(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
-
- public void testStringLiteralUnicode() {
- AST localAst = new AST();
- StringLiteral literal = localAst.newStringLiteral();
- literal.setEscapedValue("\"hello\\u0026\\u0050worl\\u0064\""); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello&Pworld")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setEscapedValue("\"hello\\nworld\""); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\nworld")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("hello\nworld"); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\nworld")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("\n"); //$NON-NLS-1$
- assertTrue(literal.getEscapedValue().equals("\"\\n\"")); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("\n")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setEscapedValue("\"hello\\\"world\""); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\"world")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("hello\\u0026world"); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\\u0026world")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("hello\\u0026world"); //$NON-NLS-1$
- assertTrue(literal.getEscapedValue().equals("\"hello\\\\u0026world\"")); //$NON-NLS-1$
-
- localAst = new AST();
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("\\u0001"); //$NON-NLS-1$
- assertTrue(literal.getEscapedValue().equals("\"\\\\u0001\"")); //$NON-NLS-1$
- }
-
- public void testCharacterLiteral() {
- long previousCount = ast.modificationCount();
- CharacterLiteral x = ast.newCharacterLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getEscapedValue().startsWith("\'")); //$NON-NLS-1$
- assertTrue(x.getEscapedValue().endsWith("\'")); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.CHARACTER_LITERAL);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setEscapedValue("\'z\'"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\'z\'".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue(x.charValue() == 'z');
-
- // test other factory method
- previousCount = ast.modificationCount();
- CharacterLiteral y = ast.newCharacterLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(y instanceof Expression);
- assertTrue(y.getAST() == ast);
- assertTrue(y.getParent() == null);
- String v = y.getEscapedValue();
- assertTrue(v.length() >= 3 && v.charAt(0) == '\'' & v.charAt(v.length()-1 ) == '\'');
-
- // check that property cannot be set to null
- try {
- x.setEscapedValue(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // test escaped characters
- // b, t, n, f, r, ", ', \, 0, 1, 2, 3, 4, 5, 6, or 7
- try {
- x.setEscapedValue("\'\\b\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\t\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\n\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\f\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\\"\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\'\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\\\\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\0\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\1\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\2\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\3\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\4\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\5\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\6\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\7\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\u0041\'"); //$NON-NLS-1$
- assertTrue(x.charValue() == 'A');
- } catch(IllegalArgumentException e) {
- assertTrue(false);
- }
-
- x.setCharValue('\u0041');
- assertTrue(x.getEscapedValue().equals("\'A\'")); //$NON-NLS-1$
- x.setCharValue('\t');
- assertTrue(x.getEscapedValue().equals("\'\\t\'")); //$NON-NLS-1$
- x.setEscapedValue("\'\\\\\'"); //$NON-NLS-1$
- assertTrue(x.getEscapedValue().equals("\'\\\\\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\\');
- x.setEscapedValue("\'\\\'\'"); //$NON-NLS-1$
- assertTrue(x.getEscapedValue().equals("\'\\\'\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\'');
- x.setCharValue('\'');
- assertTrue(x.getEscapedValue().equals("\'\\\'\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\'');
- x.setCharValue('\\');
- assertTrue(x.getEscapedValue().equals("\'\\\\\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\\');
- }
-
- public void testNumberLiteral() {
- long previousCount = ast.modificationCount();
- NumberLiteral x = ast.newNumberLiteral("1234"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("1234".equals(x.getToken())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.NUMBER_LITERAL);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // test other factory method
- previousCount = ast.modificationCount();
- NumberLiteral y = ast.newNumberLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(y.getAST() == ast);
- assertTrue(y.getParent() == null);
- assertTrue("0".equals(y.getToken())); //$NON-NLS-1$
-
- final String[] samples =
- { "0", "1", "1234567890", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0L", "1L", "1234567890L", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0l", "1l", "1234567890l", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "077", "0177", "012345670", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "077L", "0177L", "012345670L", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "077l", "0177l", "012345670l", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0x00", "0x1", "0x0123456789ABCDEF", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0x00L", "0x1L", "0x0123456789ABCDEFL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0x00l", "0x1l", "0x0123456789ABCDEFl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "1e1f", "2.f", ".3f", "0f", "3.14f", "6.022137e+23f", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- "1e1", "2.", ".3", "0.0", "3.14", "1e-9d", "1e137", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- };
- for (int i = 0; i < samples.length; i++) {
- previousCount = ast.modificationCount();
- x.setToken(samples[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(samples[i].equals(x.getToken()));
- }
-
- // check that property cannot be set to null
- try {
- x.setToken(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- }
-
- public void testSimpleType() {
- long previousCount = ast.modificationCount();
- final SimpleType x = ast.newSimpleType(ast.newSimpleName("String")); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Type);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.isSimpleType());
- assertTrue(!x.isArrayType());
- assertTrue(!x.isPrimitiveType());
- assertTrue(x.getNodeType() == ASTNode.SIMPLE_TYPE);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
- }
-
- public void testPrimitiveType() {
- long previousCount = ast.modificationCount();
- PrimitiveType x = ast.newPrimitiveType(PrimitiveType.INT);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Type);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getPrimitiveTypeCode().equals(PrimitiveType.INT));
- assertTrue(!x.isSimpleType());
- assertTrue(!x.isArrayType());
- assertTrue(x.isPrimitiveType());
- assertTrue(x.getNodeType() == ASTNode.PRIMITIVE_TYPE);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // check the names of the primitive type codes
- assertTrue(PrimitiveType.BYTE.toString().equals("byte")); //$NON-NLS-1$
- assertTrue(PrimitiveType.INT.toString().equals("int")); //$NON-NLS-1$
- assertTrue(PrimitiveType.BOOLEAN.toString().equals("boolean")); //$NON-NLS-1$
- assertTrue(PrimitiveType.CHAR.toString().equals("char")); //$NON-NLS-1$
- assertTrue(PrimitiveType.SHORT.toString().equals("short")); //$NON-NLS-1$
- assertTrue(PrimitiveType.LONG.toString().equals("long")); //$NON-NLS-1$
- assertTrue(PrimitiveType.FLOAT.toString().equals("float")); //$NON-NLS-1$
- assertTrue(PrimitiveType.DOUBLE.toString().equals("double")); //$NON-NLS-1$
- assertTrue(PrimitiveType.VOID.toString().equals("void")); //$NON-NLS-1$
-
-
- PrimitiveType.Code[] known = {
- PrimitiveType.BOOLEAN,
- PrimitiveType.BYTE,
- PrimitiveType.CHAR,
- PrimitiveType.INT,
- PrimitiveType.SHORT,
- PrimitiveType.LONG,
- PrimitiveType.FLOAT,
- PrimitiveType.DOUBLE,
- PrimitiveType.VOID,
- };
-
- // check all primitive type codes are distinct
- for (int i = 0; i < known.length; i++) {
- for (int j = 0; j < known.length; j++) {
- assertTrue(i == j || !known[i].equals(known[j]));
- }
- }
-
- // check all primitive type codes work
- for (int i = 0; i < known.length; i++) {
- previousCount = ast.modificationCount();
- x.setPrimitiveTypeCode(known[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getPrimitiveTypeCode().equals(known[i]));
- }
- // ensure null does not work as a primitive type code
- try {
- x.setPrimitiveTypeCode(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check toCode lookup of primitive type code by name
- for (int i = 0; i < known.length; i++) {
- String name = known[i].toString();
- assertTrue(PrimitiveType.toCode(name).equals(known[i]));
- }
- assertTrue(PrimitiveType.toCode("not-a-type") == null); //$NON-NLS-1$
- }
-
- public void testArrayType() {
- SimpleName x1 = ast.newSimpleName("String"); //$NON-NLS-1$
- SimpleType x2 = ast.newSimpleType(x1);
- long previousCount = ast.modificationCount();
- final ArrayType x = ast.newArrayType(x2);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Type);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getComponentType().getParent() == x);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
- assertTrue(!x.isSimpleType());
- assertTrue(x.isArrayType());
- assertTrue(!x.isPrimitiveType());
- assertTrue(x.getNodeType() == ASTNode.ARRAY_TYPE);
-
- assertTrue(x.getDimensions() == 1);
- assertTrue(x.getElementType() == x2);
-
- genericPropertyTest(x, new Property("ComponentType", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("a")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ArrayType result = ast.newArrayType(x);
- return result;
- }
- public void unwrap() {
- ArrayType a = (ArrayType) x.getParent();
- a.setComponentType(ast.newPrimitiveType(PrimitiveType.INT));
- }
- public ASTNode get() {
- return x.getComponentType();
- }
- public void set(ASTNode value) {
- x.setComponentType((Type) value);
- }
- });
-
- x.setComponentType(
- ast.newArrayType(ast.newPrimitiveType(PrimitiveType.INT), 4));
-
- assertTrue(x.getDimensions() == 5);
- assertTrue(x.getElementType().isPrimitiveType());
- }
-
- public void testPackageDeclaration() {
- long previousCount = ast.modificationCount();
- final PackageDeclaration x = ast.newPackageDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.PACKAGE_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
- }
-
- public void testImportDeclaration() {
- long previousCount = ast.modificationCount();
- final ImportDeclaration x = ast.newImportDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.isOnDemand() == false);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.IMPORT_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
-
- previousCount = ast.modificationCount();
- x.setOnDemand(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isOnDemand() == false);
- previousCount = ast.modificationCount();
- x.setOnDemand(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isOnDemand() == true);
- }
-
- public void testCompilationUnit() {
- long previousCount = ast.modificationCount();
- final CompilationUnit x = ast.newCompilationUnit();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getPackage() == null);
- assertTrue(x.imports().size() == 0);
- assertTrue(x.types().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.COMPILATION_UNIT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tClientProperties(x);
-
- genericPropertyTest(x, new Property("Package", false, PackageDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- PackageDeclaration result = targetAst.newPackageDeclaration();
- if (parented) {
- CompilationUnit cu = targetAst.newCompilationUnit();
- cu.setPackage(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getPackage();
- }
- public void set(ASTNode value) {
- x.setPackage((PackageDeclaration) value);
- }
- });
-
- genericPropertyListTest(x, x.imports(), new Property("Imports", true, ImportDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- ImportDeclaration result = targetAst.newImportDeclaration();
- if (parented) {
- CompilationUnit cu = targetAst.newCompilationUnit();
- cu.imports().add(result);
- }
- return result;
- }
- });
-
- genericPropertyListTest(x, x.types(), new Property("Types", true, TypeDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TypeDeclaration result = targetAst.newTypeDeclaration();
- if (parented) {
- CompilationUnit cu = targetAst.newCompilationUnit();
- cu.types().add(result);
- }
- return result;
- }
- });
-
- // check that TypeDeclarations in body are classified correctly
- TypeDeclaration t1 = ast.newTypeDeclaration();
- x.types().add(t1);
- assertTrue(t1.isLocalTypeDeclaration() == false);
- assertTrue(t1.isMemberTypeDeclaration() == false);
- assertTrue(t1.isPackageMemberTypeDeclaration() == true);
-
- }
-
- public void testCompilationUnitLineNumberTable() {
-// TO RUN THIS TEST YOU MUST TEMPORARILY MAKE PUBLIC
-// THE METHOD CompilationUnit.setLineEndTable
-
-// final CompilationUnit x = ast.newCompilationUnit();
-//
-// // table starts off empty
-// for (int i= -10; i < 10; i++) {
-// assertTrue(x.lineNumber(i) == 1);
-// }
-//
-// // supply a simple line table to test
-// String s = "AA\nBBB\nCC\nDDDD\nEEE";
-// assertTrue(s.length() == 18); // cross check
-// int le[] = new int[5];
-// le[0] = s.indexOf('\n');
-// le[1] = s.indexOf('\n', le[0] + 1);
-// le[2] = s.indexOf('\n', le[1] + 1);
-// le[3] = s.indexOf('\n', le[2] + 1);
-// le[4] = s.length() - 1;
-// long previousCount = ast.modificationCount();
-// x.setLineEndTable(le);
-// assertTrue(ast.modificationCount() > previousCount);
-//
-// assertTrue(x.lineNumber(0) == 1);
-// assertTrue(x.lineNumber(1) == 1);
-// assertTrue(x.lineNumber(2) == 1);
-// assertTrue(x.lineNumber(3) == 2);
-// assertTrue(x.lineNumber(4) == 2);
-// assertTrue(x.lineNumber(5) == 2);
-// assertTrue(x.lineNumber(6) == 2);
-// assertTrue(x.lineNumber(7) == 3);
-// assertTrue(x.lineNumber(8) == 3);
-// assertTrue(x.lineNumber(9) == 3);
-// assertTrue(x.lineNumber(10) == 4);
-// assertTrue(x.lineNumber(11) == 4);
-// assertTrue(x.lineNumber(12) == 4);
-// assertTrue(x.lineNumber(13) == 4);
-// assertTrue(x.lineNumber(14) == 4);
-// assertTrue(x.lineNumber(15) == 5);
-// assertTrue(x.lineNumber(16) == 5);
-// assertTrue(x.lineNumber(17) == 5);
-//
-// assertTrue(x.lineNumber(18) == 1);
-// assertTrue(x.lineNumber(100) == 1);
-// assertTrue(x.lineNumber(1000000) == 1);
-// assertTrue(x.lineNumber(-1) == 1);
-// assertTrue(x.lineNumber(-100) == 1);
-// assertTrue(x.lineNumber(-1000000) == 1);
-//
-// // slam table back to none
-// x.setLineEndTable(new int[0]);
-// for (int i= -10; i < 10; i++) {
-// assertTrue(x.lineNumber(i) == 1);
-// }
- }
-
- public void testTypeDeclaration() {
- long previousCount = ast.modificationCount();
- final TypeDeclaration x = ast.newTypeDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof BodyDeclaration);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.isInterface() == false);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getSuperclass() == null);
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.superInterfaces().size() == 0);
- assertTrue(x.bodyDeclarations().size()== 0);
- assertTrue(x.getNodeType() == ASTNode.TYPE_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setInterface(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isInterface() == true);
-
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC
- | Modifier.FINAL | Modifier.STRICTFP;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- tJavadocComment(x);
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("Superclass", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getSuperclass();
- }
- public void set(ASTNode value) {
- x.setSuperclass((Name) value);
- }
- });
-
- genericPropertyListTest(x, x.superInterfaces(),
- new Property("SuperInterfaces", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- });
-
- genericPropertyListTest(x, x.bodyDeclarations(),
- new Property("BodyDeclarations", true, BodyDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TypeDeclaration result = targetAst.newTypeDeclaration();
- if (parented) {
- CompilationUnit cu = targetAst.newCompilationUnit();
- cu.types().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- TypeDeclaration s1 = x.getAST().newTypeDeclaration();
- s1.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- TypeDeclaration s1 = (TypeDeclaration) x.getParent();
- s1.bodyDeclarations().remove(x);
- }
- });
-
- // check special bodyDeclaration methods
- x.bodyDeclarations().clear();
- FieldDeclaration f1 = ast.newFieldDeclaration(ast.newVariableDeclarationFragment());
- FieldDeclaration f2 = ast.newFieldDeclaration(ast.newVariableDeclarationFragment());
- MethodDeclaration m1 = ast.newMethodDeclaration();
- MethodDeclaration m2 = ast.newMethodDeclaration();
- TypeDeclaration t1 = ast.newTypeDeclaration();
- TypeDeclaration t2 = ast.newTypeDeclaration();
-
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(f1);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(f2);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(t1);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(m1);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(m2);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(t2);
- x.bodyDeclarations().add(ast.newInitializer());
-
- List fs = Arrays.asList(x.getFields());
- assertTrue(fs.size() == 2);
- assertTrue(fs.contains(f1));
- assertTrue(fs.contains(f2));
-
- List ms = Arrays.asList(x.getMethods());
- assertTrue(ms.size() == 2);
- assertTrue(ms.contains(m1));
- assertTrue(ms.contains(m2));
-
- List ts = Arrays.asList(x.getTypes());
- assertTrue(ts.size() == 2);
- assertTrue(ts.contains(t1));
- assertTrue(ts.contains(t2));
-
- // check that TypeDeclarations in body are classified correctly
- assertTrue(t1.isLocalTypeDeclaration() == false);
- assertTrue(t1.isMemberTypeDeclaration() == true);
- assertTrue(t1.isPackageMemberTypeDeclaration() == false);
-
- }
-
- public void testSingleVariableDeclaration() {
- long previousCount = ast.modificationCount();
- final SingleVariableDeclaration x = ast.newSingleVariableDeclaration();
- assertTrue(x instanceof VariableDeclaration);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.getExtraDimensions() == 0);
- assertTrue(x.getInitializer() == null);
- assertTrue(x.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL
- | Modifier.TRANSIENT | Modifier.VOLATILE;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 1);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(0);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 0);
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyTest(x, new Property("Initializer", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return an Expression that embeds x
- CatchClause s1 = ast.newCatchClause();
- s1.setException(x);
- return s1;
- }
- public void unwrap() {
- CatchClause s1 = (CatchClause) x.getParent();
- s1.setException(ast.newSingleVariableDeclaration());
- }
- public ASTNode get() {
- return x.getInitializer();
- }
- public void set(ASTNode value) {
- x.setInitializer((Expression) value);
- }
- });
- }
-
- public void testVariableDeclarationFragment() {
- long previousCount = ast.modificationCount();
- final VariableDeclarationFragment x = ast.newVariableDeclarationFragment();
- assertTrue(x instanceof VariableDeclaration);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getExtraDimensions() == 0);
- assertTrue(x.getInitializer() == null);
- assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 1);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(0);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 0);
-
- // check that property cannot be set negative
- try {
- x.setExtraDimensions(-1);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("Initializer", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return an Expression that embeds x
- VariableDeclarationExpression s1 =
- ast.newVariableDeclarationExpression(x);
- return s1;
- }
- public void unwrap() {
- VariableDeclarationExpression s1 =
- (VariableDeclarationExpression) x.getParent();
- s1.fragments().remove(x);
- }
- public ASTNode get() {
- return x.getInitializer();
- }
- public void set(ASTNode value) {
- x.setInitializer((Expression) value);
- }
- });
- }
-
- public void testMethodDeclaration() {
- long previousCount = ast.modificationCount();
- final MethodDeclaration x = ast.newMethodDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof BodyDeclaration);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.isConstructor() == false);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getReturnType().getParent() == x);
- assertTrue(x.getExtraDimensions() == 0);
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.parameters().size() == 0);
- assertTrue(x.thrownExceptions().size() == 0);
- assertTrue(x.getBody() == null);
- assertTrue(x.getNodeType() == ASTNode.METHOD_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setConstructor(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isConstructor() == true);
- assertTrue(x.getName().isDeclaration() == false);
-
- previousCount = ast.modificationCount();
- x.setConstructor(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isConstructor() == false);
-
- previousCount = ast.modificationCount();
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC
- | Modifier.FINAL | Modifier.SYNCHRONIZED| Modifier.NATIVE
- | Modifier.STRICTFP;
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 1);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(0);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 0);
-
- tJavadocComment(x);
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("ReturnType", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getReturnType();
- }
- public void set(ASTNode value) {
- x.setReturnType((Type) value);
- }
- });
-
- genericPropertyListTest(x, x.parameters(),
- new Property("Parameters", true, SingleVariableDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SingleVariableDeclaration result = targetAst.newSingleVariableDeclaration();
- if (parented) {
- targetAst.newCatchClause().setException(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a SingleVariableDeclaration that embeds x
- SingleVariableDeclaration s1 = ast.newSingleVariableDeclaration();
- ClassInstanceCreation s2 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s2.setAnonymousClassDeclaration(a1);
- s1.setInitializer(s2);
- a1.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- AnonymousClassDeclaration a1 = (AnonymousClassDeclaration) x.getParent();
- a1.bodyDeclarations().remove(x);
- }
- });
-
- genericPropertyListTest(x, x.thrownExceptions(),
- new Property("ThrownExceptions", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- });
-
- genericPropertyTest(x, new Property("Body", false, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Block that embeds x
- Block s1 = ast.newBlock();
- TypeDeclaration s2 = ast.newTypeDeclaration();
- s1.statements().add(ast.newTypeDeclarationStatement(s2));
- s2.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- TypeDeclaration s2 = (TypeDeclaration) x.getParent();
- s2.bodyDeclarations().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
- }
-
- public void testInitializer() {
- long previousCount = ast.modificationCount();
- final Initializer x = ast.newInitializer();
- assertTrue(x instanceof BodyDeclaration);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody().statements().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.INITIALIZER);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tJavadocComment(x);
-
- int legal = Modifier.STATIC;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Block that embeds x
- Block s1 = ast.newBlock();
- TypeDeclaration s2 = ast.newTypeDeclaration();
- s1.statements().add(ast.newTypeDeclarationStatement(s2));
- s2.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- TypeDeclaration s2 = (TypeDeclaration) x.getParent();
- s2.bodyDeclarations().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
- }
-
- public void testJavadoc() {
- long previousCount = ast.modificationCount();
- Javadoc x = ast.newJavadoc();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getComment().startsWith("/**")); //$NON-NLS-1$
- assertTrue(x.getComment().endsWith("*/")); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.JAVADOC);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- final String[] samples =
- {
- "/** Hello there */", //$NON-NLS-1$
- "/**\n * Line 1\n * Line 2\n */", //$NON-NLS-1$
- "/***/", //$NON-NLS-1$
- };
- for (int i = 0; i < samples.length; i++) {
- previousCount = ast.modificationCount();
- x.setComment(samples[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(samples[i].equals(x.getComment()));
- }
-
- final String[] badSamples =
- {
- null,
- "", //$NON-NLS-1$
- "/* */", //$NON-NLS-1$
- "/**", //$NON-NLS-1$
- "*/", //$NON-NLS-1$
- };
-
- // check that property cannot be set to clearly illegal things
- for (int i = 0; i < badSamples.length; i++) {
- try {
- x.setComment(badSamples[i]);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
- }
-
- public void testBlock() {
- long previousCount = ast.modificationCount();
- final Block x = ast.newBlock();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.statements().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.BLOCK);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyListTest(x, x.statements(),
- new Property("Statements", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- });
- }
-
- public void testMethodInvocation() {
- long previousCount = ast.modificationCount();
- final MethodInvocation x = ast.newMethodInvocation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getExpression() == null);
- assertTrue(x.arguments().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.METHOD_INVOCATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyListTest(x, x.arguments(),
- new Property("Arguments", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- });
- }
-
- public void testExpressionStatement() {
- long previousCount = ast.modificationCount();
- SimpleName x1 = ast.newSimpleName("foo"); //$NON-NLS-1$
- final ExpressionStatement x = ast.newExpressionStatement(x1);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression() == x1);
- assertTrue(x1.getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.EXPRESSION_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- }
-
- public void testVariableDeclarationStatement() {
- VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
- long previousCount = ast.modificationCount();
- final VariableDeclarationStatement x =
- ast.newVariableDeclarationStatement(x1);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getType() != null);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.fragments().size() == 1);
- assertTrue(x.fragments().get(0) == x1);
- assertTrue(x1.getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- int legal = Modifier.FINAL;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- // check that property cannot be set to illegal value
- try {
- x.setModifiers(Modifier.PUBLIC);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyListTest(x, x.fragments(),
- new Property("VariableSpecifiers", true, VariableDeclarationFragment.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- VariableDeclarationFragment result = targetAst.newVariableDeclarationFragment();
- if (parented) {
- targetAst.newVariableDeclarationExpression(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return VariableDeclarationFragment that embeds x
- VariableDeclarationFragment s1 = ast.newVariableDeclarationFragment();
- ClassInstanceCreation s0 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s0.setAnonymousClassDeclaration(a1);
- s1.setInitializer(s0);
- Initializer s2 = ast.newInitializer();
- a1.bodyDeclarations().add(s2);
- s2.getBody().statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- });
-
-
- }
-
- public void testTypeDeclarationStatement() {
- TypeDeclaration x1 = ast.newTypeDeclaration();
- long previousCount = ast.modificationCount();
- final TypeDeclarationStatement x =
- ast.newTypeDeclarationStatement(x1);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getTypeDeclaration() == x1);
- assertTrue(x1.getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.TYPE_DECLARATION_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // check that TypeDeclaration inside is classified correctly
- assertTrue(x1.isLocalTypeDeclaration() == true);
- assertTrue(x1.isMemberTypeDeclaration() == false);
- assertTrue(x1.isPackageMemberTypeDeclaration() == false);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("TypeDeclaration", true, TypeDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TypeDeclaration result = targetAst.newTypeDeclaration();
- if (parented) {
- targetAst.newTypeDeclarationStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return TypeDeclaration that embeds x
- TypeDeclaration s1 = ast.newTypeDeclaration();
- MethodDeclaration s2 = ast.newMethodDeclaration();
- s1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getTypeDeclaration();
- }
- public void set(ASTNode value) {
- x.setTypeDeclaration((TypeDeclaration) value);
- }
- });
-
- }
-
- public void testVariableDeclarationExpression() {
- VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
- long previousCount = ast.modificationCount();
- final VariableDeclarationExpression x =
- ast.newVariableDeclarationExpression(x1);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getType() != null);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.fragments().size() == 1);
- assertTrue(x.fragments().get(0) == x1);
- assertTrue(x1.getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- int legal = Modifier.FINAL;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- // check that property cannot be set to illegal value
- try {
- x.setModifiers(Modifier.PUBLIC);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyListTest(x, x.fragments(),
- new Property("VariableSpecifiers", true, VariableDeclarationFragment.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- VariableDeclarationFragment result = targetAst.newVariableDeclarationFragment();
- if (parented) {
- targetAst.newVariableDeclarationExpression(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return VariableDeclarationFragment that embeds x
- VariableDeclarationFragment s1 = ast.newVariableDeclarationFragment();
- ClassInstanceCreation s0 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s0.setAnonymousClassDeclaration(a1);
- s1.setInitializer(s0);
- ForStatement s2 = ast.newForStatement();
- s2.initializers().add(x);
- Initializer s3 = ast.newInitializer();
- a1.bodyDeclarations().add(s3);
- s3.getBody().statements().add(s2);
- return s1;
- }
- public void unwrap() {
- ForStatement s2 = (ForStatement) x.getParent();
- s2.initializers().remove(x);
- }
- });
- }
-
- public void testFieldDeclaration() {
- VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
- long previousCount = ast.modificationCount();
- final FieldDeclaration x = ast.newFieldDeclaration(x1);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof BodyDeclaration);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getType() != null);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.fragments().size() == 1);
- assertTrue(x.fragments().get(0) == x1);
- assertTrue(x1.getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.FIELD_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL
- | Modifier.TRANSIENT | Modifier.VOLATILE;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
-
- // check that property cannot be set to illegal value
- try {
- x.setModifiers(Modifier.SYNCHRONIZED);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- tJavadocComment(x);
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyListTest(x, x.fragments(),
- new Property("VariableSpecifiers", true, VariableDeclarationFragment.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- VariableDeclarationFragment result = targetAst.newVariableDeclarationFragment();
- if (parented) {
- targetAst.newVariableDeclarationStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return VariableDeclarationFragment that embeds x
- VariableDeclarationFragment s1 = ast.newVariableDeclarationFragment();
- ClassInstanceCreation s2 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s2.setAnonymousClassDeclaration(a1);
- s1.setInitializer(s2);
- a1.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- AnonymousClassDeclaration a1 = (AnonymousClassDeclaration) x.getParent();
- a1.bodyDeclarations().remove(x);
- }
- });
-
- }
-
- public void testAssignment() {
- long previousCount = ast.modificationCount();
- final Assignment x = ast.newAssignment();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getOperator() == Assignment.Operator.ASSIGN);
- assertTrue(x.getLeftHandSide().getParent() == x);
- assertTrue(x.getRightHandSide().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.ASSIGNMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setOperator(Assignment.Operator.PLUS_ASSIGN);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getOperator() == Assignment.Operator.PLUS_ASSIGN);
- assertTrue(Assignment.Operator.PLUS_ASSIGN
- != Assignment.Operator.ASSIGN);
-
- // check the names of the primitive type codes
- assertTrue(Assignment.Operator.ASSIGN.toString().equals("=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.PLUS_ASSIGN.toString().equals("+=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.MINUS_ASSIGN.toString().equals("-=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.TIMES_ASSIGN.toString().equals("*=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.DIVIDE_ASSIGN.toString().equals("/=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.REMAINDER_ASSIGN.toString().equals("%=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.LEFT_SHIFT_ASSIGN.toString().equals("<<=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN.toString().equals(">>=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN.toString().equals(">>>=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.BIT_AND_ASSIGN.toString().equals("&=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.BIT_OR_ASSIGN.toString().equals("|=")); //$NON-NLS-1$
- assertTrue(Assignment.Operator.BIT_XOR_ASSIGN.toString().equals("^=")); //$NON-NLS-1$
-
- Assignment.Operator[] known = {
- Assignment.Operator.ASSIGN,
- Assignment.Operator.PLUS_ASSIGN,
- Assignment.Operator.MINUS_ASSIGN,
- Assignment.Operator.TIMES_ASSIGN,
- Assignment.Operator.DIVIDE_ASSIGN,
- Assignment.Operator.REMAINDER_ASSIGN,
- Assignment.Operator.LEFT_SHIFT_ASSIGN,
- Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN,
- Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN,
- Assignment.Operator.BIT_AND_ASSIGN,
- Assignment.Operator.BIT_OR_ASSIGN,
- Assignment.Operator.BIT_XOR_ASSIGN,
- };
-
- // check all operators are distinct
- for (int i = 0; i < known.length; i++) {
- for (int j = 0; j < known.length; j++) {
- assertTrue(i == j || !known[i].equals(known[j]));
- }
- }
-
- // check all operators work
- for (int i = 0; i < known.length; i++) {
- previousCount = ast.modificationCount();
- x.setOperator(known[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getOperator().equals(known[i]));
- }
- // ensure null does not work as a primitive type code
- try {
- x.setOperator(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check toOperator lookup of operators by name
- for (int i = 0; i < known.length; i++) {
- String name = known[i].toString();
- assertTrue(Assignment.Operator.toOperator(name).equals(known[i]));
- }
- assertTrue(Assignment.Operator.toOperator("not-an-op") == null); //$NON-NLS-1$
-
- genericPropertyTest(x, new Property("LeftHandSide", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getLeftHandSide();
- }
- public void set(ASTNode value) {
- x.setLeftHandSide((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("RightHandSide", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getRightHandSide();
- }
- public void set(ASTNode value) {
- x.setRightHandSide((Expression) value);
- }
- });
- }
-
- public void testBreakStatement() {
- long previousCount = ast.modificationCount();
- final BreakStatement x = ast.newBreakStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLabel() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.BREAK_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Label", false, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getLabel();
- }
- public void set(ASTNode value) {
- x.setLabel((SimpleName) value);
- }
- });
- }
-
- public void testContinueStatement() {
- long previousCount = ast.modificationCount();
- final ContinueStatement x = ast.newContinueStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLabel() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.CONTINUE_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Label", false, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getLabel();
- }
- public void set(ASTNode value) {
- x.setLabel((SimpleName) value);
- }
- });
- }
-
- public void testIfStatement() {
- long previousCount = ast.modificationCount();
- final IfStatement x = ast.newIfStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getThenStatement().getParent() == x);
- assertTrue(x.getThenStatement() instanceof Block);
- assertTrue(((Block) x.getThenStatement()).statements().isEmpty());
- assertTrue(x.getElseStatement() == null);
- assertTrue(x.getNodeType() == ASTNode.IF_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("ThenStatement", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getThenStatement();
- }
- public void set(ASTNode value) {
- x.setThenStatement((Statement) value);
- }
- });
-
- genericPropertyTest(x, new Property("ElseStatement", false, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getElseStatement();
- }
- public void set(ASTNode value) {
- x.setElseStatement((Statement) value);
- }
- });
- }
-
- public void testWhileStatement() {
- long previousCount = ast.modificationCount();
- final WhileStatement x = ast.newWhileStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody() instanceof Block);
- assertTrue(((Block) x.getBody()).statements().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.WHILE_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Statement) value);
- }
- });
- }
-
- public void testDoStatement() {
- long previousCount = ast.modificationCount();
- final DoStatement x = ast.newDoStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody() instanceof Block);
- assertTrue(((Block) x.getBody()).statements().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.DO_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Statement) value);
- }
- });
- }
-
- public void testTryStatement() {
- long previousCount = ast.modificationCount();
- final TryStatement x = ast.newTryStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody() instanceof Block);
- assertTrue(((Block) x.getBody()).statements().isEmpty());
- assertTrue(x.getFinally() == null);
- assertTrue(x.catchClauses().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.TRY_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Block that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
-
- genericPropertyListTest(x, x.catchClauses(),
- new Property("CatchClauses", true, CatchClause.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- CatchClause result = targetAst.newCatchClause();
- if (parented) {
- TryStatement s1 = targetAst.newTryStatement();
- s1.catchClauses().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return CatchClause that embeds x
- CatchClause s1 = ast.newCatchClause();
- Block s2 = ast.newBlock();
- s1.setBody(s2);
- s2.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- });
-
- genericPropertyTest(x, new Property("Finally", false, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Block that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getFinally();
- }
- public void set(ASTNode value) {
- x.setFinally((Block) value);
- }
- });
- }
-
- public void testCatchClause() {
- long previousCount = ast.modificationCount();
- final CatchClause x = ast.newCatchClause();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody().statements().isEmpty());
- assertTrue(x.getException().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.CATCH_CLAUSE);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Exception", true, SingleVariableDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SingleVariableDeclaration result = targetAst.newSingleVariableDeclaration();
- if (parented) {
- targetAst.newCatchClause().setException(result);
-
- }
- return result;
- }
- public ASTNode wrap() {
- // return SingleVariableDeclaration that embeds x
- SingleVariableDeclaration s1 = ast.newSingleVariableDeclaration();
- ClassInstanceCreation s2 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s2.setAnonymousClassDeclaration(a1);
- s1.setInitializer(s2);
- MethodDeclaration s3 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s3);
- Block s4 = ast.newBlock();
- s3.setBody(s4);
- TryStatement s5 = ast.newTryStatement();
- s4.statements().add(s5);
- s5.catchClauses().add(x);
- return s1;
- }
- public void unwrap() {
- TryStatement s5 = (TryStatement) x.getParent();
- s5.catchClauses().remove(x);
- }
- public ASTNode get() {
- return x.getException();
- }
- public void set(ASTNode value) {
- x.setException((SingleVariableDeclaration) value);
- }
- });
-
- genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Block that embeds x
- Block s1 = ast.newBlock();
- TryStatement s2 = ast.newTryStatement();
- s1.statements().add(s2);
- s2.catchClauses().add(x);
- return s1;
- }
- public void unwrap() {
- TryStatement s2 = (TryStatement) x.getParent();
- s2.catchClauses().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
- }
-
- public void testEmptyStatement() {
- long previousCount = ast.modificationCount();
- final EmptyStatement x = ast.newEmptyStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.EMPTY_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
- }
-
- /**
- * Exercise the leadingComment property.
- *
- * @param x the statement to test
- */
- void tLeadingComment(Statement x) {
-
- // check that null is allowed
- long previousCount = ast.modificationCount();
- x.setLeadingComment(null);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getLeadingComment() == null);
-
- // check that regular comment is allowed
- previousCount = ast.modificationCount();
- x.setLeadingComment("/* X */"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getLeadingComment() == "/* X */"); //$NON-NLS-1$
-
- // check that regular comment with line breaks is allowed
- previousCount = ast.modificationCount();
- x.setLeadingComment("/* X\n *Y\n */"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getLeadingComment() == "/* X\n *Y\n */"); //$NON-NLS-1$
-
- // check that end-of-line comment is allowed
- previousCount = ast.modificationCount();
- x.setLeadingComment("// X\n"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getLeadingComment() == "// X\n"); //$NON-NLS-1$
-
- // check that end-of-line comment without a line break at the end is allowed
- previousCount = ast.modificationCount();
- x.setLeadingComment("// X"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getLeadingComment() == "// X"); //$NON-NLS-1$
-
- // check that end-of-line comment with embedded end of line
- // not allowed
- try {
- x.setLeadingComment("// X\n extra"); //$NON-NLS-1$
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- }
-
- /**
- * Exercise the javadoc property.
- *
- * @param x the body declaration to test
- */
- void tJavadocComment(final BodyDeclaration x) {
- genericPropertyTest(x, new Property("Javadoc", false, Javadoc.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Javadoc result = targetAst.newJavadoc();
- if (parented) {
- targetAst.newInitializer().setJavadoc(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getJavadoc();
- }
- public void set(ASTNode value) {
- x.setJavadoc((Javadoc) value);
- }
- });
- }
-
- /**
- * Exercise the client properties of a node.
- *
- * @param x the node to test
- */
- void tClientProperties(ASTNode x) {
-
- long previousCount = ast.modificationCount();
-
- // a node initially has no properties
- assertTrue(x.properties().size() == 0);
- assertTrue(x.getProperty("1") == null); //$NON-NLS-1$
-
- // clearing an unset property does not add it to list of known ones
- x.setProperty("1", null); //$NON-NLS-1$
- assertTrue(x.getProperty("1") == null); //$NON-NLS-1$
- assertTrue(x.properties().size() == 0);
-
- // setting an unset property does add it to the list of known ones
- x.setProperty("1", "a1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("1") == "a1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().size() == 1);
- Map.Entry[] m = (Map.Entry[]) x.properties().entrySet().toArray(new Map.Entry[1]);
- assertTrue(m[0].getKey() == "1"); //$NON-NLS-1$
- assertTrue(m[0].getValue() == "a1"); //$NON-NLS-1$
-
- // setting an already set property just changes its value
- x.setProperty("1", "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().size() == 1);
- m = (Map.Entry[]) x.properties().entrySet().toArray(new Map.Entry[1]);
- assertTrue(m[0].getKey() == "1"); //$NON-NLS-1$
- assertTrue(m[0].getValue() == "a2"); //$NON-NLS-1$
-
- // clearing a set property removes it from list of known ones
- x.setProperty("1", null); //$NON-NLS-1$
- assertTrue(x.getProperty("1") == null); //$NON-NLS-1$
- assertTrue(x.properties().size() == 0);
-
-
- // ========= test 2 and 3 properties
- x.setProperty("1", "a1"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("2", "b1"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("3", "c1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("1") == "a1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("2") == "b1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("3") == "c1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().size() == 3);
- assertTrue(x.properties().get("1") == "a1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().get("2") == "b1"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().get("3") == "c1"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("1", "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("2", "b2"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("3", "c2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("2") == "b2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().size() == 3);
- assertTrue(x.properties().get("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().get("2") == "b2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().get("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("2", null); //$NON-NLS-1$
- assertTrue(x.getProperty("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.getProperty("2") == null); //$NON-NLS-1$
- assertTrue(x.getProperty("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().size() == 2);
- assertTrue(x.properties().get("1") == "a2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().get("2") == null); //$NON-NLS-1$
- assertTrue(x.properties().get("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$
- x.setProperty("1", null); //$NON-NLS-1$
- assertTrue(x.getProperty("1") == null); //$NON-NLS-1$
- assertTrue(x.getProperty("2") == null); //$NON-NLS-1$
- assertTrue(x.getProperty("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(x.properties().size() == 1);
- assertTrue(x.properties().get("1") == null); //$NON-NLS-1$
- assertTrue(x.properties().get("2") == null); //$NON-NLS-1$
- assertTrue(x.properties().get("3") == "c2"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // none of this is considered to have affected the AST
- assertTrue(ast.modificationCount() == previousCount);
- }
-
- public void testReturnStatement() {
- long previousCount = ast.modificationCount();
- final ReturnStatement x = ast.newReturnStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression() == null);
- assertTrue(x.getNodeType() == ASTNode.RETURN_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
- }
-
- public void testThrowStatement() {
- long previousCount = ast.modificationCount();
- final ThrowStatement x = ast.newThrowStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.THROW_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
- }
-
- public void testAssertStatement() {
- long previousCount = ast.modificationCount();
- final AssertStatement x = ast.newAssertStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getMessage() == null);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.ASSERT_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Message", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getMessage();
- }
- public void set(ASTNode value) {
- x.setMessage((Expression) value);
- }
- });
- }
-
- public void testSwitchStatement() {
- long previousCount = ast.modificationCount();
- final SwitchStatement x = ast.newSwitchStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.statements().isEmpty());
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.SWITCH_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyListTest(x, x.statements(),
- new Property("Statements", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- });
- }
-
- public void testSwitchCase() {
- long previousCount = ast.modificationCount();
- final SwitchCase x = ast.newSwitchCase();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(!x.isDefault());
- assertTrue(x.getNodeType() == ASTNode.SWITCH_CASE);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- SwitchStatement s4 = ast.newSwitchStatement();
- s3.statements().add(s4);
- s4.statements().add(x);
- return s1;
- }
- public void unwrap() {
- SwitchStatement s4 = (SwitchStatement) x.getParent();
- s4.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
- }
-
- public void testSynchronizedStatement() {
- long previousCount = ast.modificationCount();
- final SynchronizedStatement x = ast.newSynchronizedStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getBody().statements().isEmpty());
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.SYNCHRONIZED_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Block that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
- }
-
- public void testLabeledStatement() {
- long previousCount = ast.modificationCount();
- final LabeledStatement x = ast.newLabeledStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLabel().getParent() == x);
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.LABELED_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyTest(x, new Property("Label", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getLabel();
- }
- public void set(ASTNode value) {
- x.setLabel((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Statement) value);
- }
- });
- }
-
-
- /**
- * Returns a subtree of sample of AST nodes. The sample includes
- * one of each kind, but otherwise does not make sense.
- */
- ASTNode oneOfEach(AST target) {
- CompilationUnit cu = target.newCompilationUnit();
- cu.setSourceRange(0, 1000);
- PackageDeclaration pd = target.newPackageDeclaration();
- pd.setSourceRange(0, 5);
- cu.setPackage(pd);
-
- ImportDeclaration im = target.newImportDeclaration();
- im.setSourceRange(6, 5);
- cu.imports().add(im);
-
- TypeDeclaration td = target.newTypeDeclaration();
- im.setSourceRange(11, 900);
- Javadoc javadoc = target.newJavadoc();
- javadoc.setSourceRange(11, 5);
- td.setJavadoc(javadoc);
- cu.types().add(td);
-
- VariableDeclarationFragment variableDeclarationFragment = target.newVariableDeclarationFragment();
- variableDeclarationFragment.setSourceRange(16, 5);
- FieldDeclaration fd =
- target.newFieldDeclaration(variableDeclarationFragment);
- fd.setSourceRange(16, 5);
- td.bodyDeclarations().add(fd);
-
- Initializer in = target.newInitializer();
- in.setSourceRange(21, 5);
- td.bodyDeclarations().add(in);
-
- MethodDeclaration md = target.newMethodDeclaration();
- md.setSourceRange(26, 800);
- SingleVariableDeclaration singleVariableDeclaration = target.newSingleVariableDeclaration();
- singleVariableDeclaration.setSourceRange(30, 5);
- md.parameters().add(singleVariableDeclaration);
- td.bodyDeclarations().add(md);
-
- SimpleName sn1 = target.newSimpleName("one"); //$NON-NLS-1$
- sn1.setSourceRange(35, 5);
- SimpleName sn2 =target.newSimpleName("two"); //$NON-NLS-1$
- sn2.setSourceRange(41, 5);
- QualifiedName qn = target.newQualifiedName(sn1, sn2);
- qn.setSourceRange(35, 11);
-
- SimpleType st = target.newSimpleType(qn);
- st.setSourceRange(35, 11);
- PrimitiveType pt = target.newPrimitiveType(PrimitiveType.INT);
- pt.setSourceRange(41, 5);
- ArrayType at = target.newArrayType(st);
- at.setSourceRange(41, 7);
-
- md.setReturnType(at);
- fd.setType(pt);
-
- Block b = target.newBlock();
- b.setSourceRange(46, 700);
- md.setBody(b);
-
- // all statements (in alphabetic order of statement type)
- AssertStatement assertStatement = target.newAssertStatement();
- assertStatement.setSourceRange(46, 5);
- b.statements().add(assertStatement);
- Block block = target.newBlock();
- block.setSourceRange(51, 5);
- b.statements().add(block);
- BreakStatement breakStatement = target.newBreakStatement();
- breakStatement.setSourceRange(55, 5);
- b.statements().add(breakStatement);
- ContinueStatement continueStatement = target.newContinueStatement();
- continueStatement.setSourceRange(61, 5);
- b.statements().add(continueStatement);
- ConstructorInvocation constructorInvocation = target.newConstructorInvocation();
- constructorInvocation.setSourceRange(65, 5);
- b.statements().add(constructorInvocation);
- DoStatement doStatement = target.newDoStatement();
- doStatement.setSourceRange(70, 5);
- b.statements().add(doStatement);
- EmptyStatement emptyStatement = target.newEmptyStatement();
- emptyStatement.setSourceRange(75, 5);
- b.statements().add(emptyStatement);
- NullLiteral nullLiteral = target.newNullLiteral();
- nullLiteral.setSourceRange(80, 5);
- ExpressionStatement expressionStatement = target.newExpressionStatement(nullLiteral);
- expressionStatement.setSourceRange(80, 5);
- b.statements().add(expressionStatement);
- ForStatement forStatement = target.newForStatement();
- forStatement.setSourceRange(86, 5);
- b.statements().add(forStatement);
- IfStatement ifStatement = target.newIfStatement();
- ifStatement.setSourceRange(90, 5);
- b.statements().add(ifStatement);
- LabeledStatement labeledStatement = target.newLabeledStatement();
- labeledStatement.setSourceRange(95, 5);
- b.statements().add(labeledStatement);
- ReturnStatement returnStatement = target.newReturnStatement();
- returnStatement.setSourceRange(100, 5);
- b.statements().add(returnStatement);
- SuperConstructorInvocation superConstructorInvocation = target.newSuperConstructorInvocation();
- superConstructorInvocation.setSourceRange(105, 5);
- b.statements().add(superConstructorInvocation);
- SwitchStatement ss = target.newSwitchStatement();
- ss.setSourceRange(110, 5);
- SwitchCase switchCase = target.newSwitchCase();
- switchCase.setSourceRange(110, 5);
- ss.statements().add(switchCase);
- b.statements().add(ss);
- SwitchStatement switchStatement = target.newSwitchStatement();
- switchStatement.setSourceRange(115, 5);
- b.statements().add(switchStatement);
- SwitchCase switchCase2 = target.newSwitchCase();
- switchCase2.setSourceRange(120, 5);
- b.statements().add(switchCase2);
- SynchronizedStatement synchronizedStatement = target.newSynchronizedStatement();
- synchronizedStatement.setSourceRange(125, 5);
- b.statements().add(synchronizedStatement);
- ThrowStatement throwStatement = target.newThrowStatement();
- throwStatement.setSourceRange(130, 5);
- b.statements().add(throwStatement);
- TryStatement tr = target.newTryStatement();
- tr.setSourceRange(135, 5);
- CatchClause catchClause = target.newCatchClause();
- catchClause.setSourceRange(135, 5);
- tr.catchClauses().add(catchClause);
- b.statements().add(tr);
-
- TypeDeclaration typeDeclaration = target.newTypeDeclaration();
- typeDeclaration.setSourceRange(140, 5);
- TypeDeclarationStatement typeDeclarationStatement = target.newTypeDeclarationStatement(typeDeclaration);
- typeDeclarationStatement.setSourceRange(140, 6);
- b.statements().add(typeDeclarationStatement);
- VariableDeclarationFragment variableDeclarationFragment2 = target.newVariableDeclarationFragment();
- variableDeclarationFragment2.setSourceRange(150, 5);
- VariableDeclarationStatement variableDeclarationStatement = target.newVariableDeclarationStatement(variableDeclarationFragment2);
- variableDeclarationStatement.setSourceRange(150, 6);
- b.statements().add(variableDeclarationStatement);
- WhileStatement whileStatement = target.newWhileStatement();
- whileStatement.setSourceRange(155, 5);
- b.statements().add(whileStatement);
-
- // all expressions (in alphabetic order of expressions type)
- MethodInvocation inv = target.newMethodInvocation();
- inv.setSourceRange(200, 300);
- ExpressionStatement expressionStatement2 = target.newExpressionStatement(inv);
- expressionStatement2.setSourceRange(400, 5);
- b.statements().add(expressionStatement2);
- List z = inv.arguments();
- ArrayAccess arrayAccess = target.newArrayAccess();
- arrayAccess.setSourceRange(200, 5);
- z.add(arrayAccess);
- ArrayCreation arrayCreation = target.newArrayCreation();
- arrayCreation.setSourceRange(210, 5);
- z.add(arrayCreation);
- ArrayInitializer arrayInitializer = target.newArrayInitializer();
- arrayInitializer.setSourceRange(220, 5);
- z.add(arrayInitializer);
- Assignment assignment = target.newAssignment();
- assignment.setSourceRange(230, 5);
- z.add(assignment);
- BooleanLiteral booleanLiteral = target.newBooleanLiteral(true);
- booleanLiteral.setSourceRange(240, 5);
- z.add(booleanLiteral);
- CastExpression castExpression = target.newCastExpression();
- castExpression.setSourceRange(250, 5);
- z.add(castExpression);
- CharacterLiteral characterLiteral = target.newCharacterLiteral();
- characterLiteral.setSourceRange(260, 5);
- z.add(characterLiteral);
- ClassInstanceCreation cic = target.newClassInstanceCreation();
- cic.setSourceRange(270, 9);
- AnonymousClassDeclaration anonymousClassDeclaration = target.newAnonymousClassDeclaration();
- anonymousClassDeclaration.setSourceRange(270, 5);
- cic.setAnonymousClassDeclaration(anonymousClassDeclaration);
- z.add(cic);
- ConditionalExpression conditionalExpression = target.newConditionalExpression();
- conditionalExpression.setSourceRange(280, 5);
- z.add(conditionalExpression);
- FieldAccess fieldAccess = target.newFieldAccess();
- fieldAccess.setSourceRange(290, 5);
- z.add(fieldAccess);
- InfixExpression infixExpression = target.newInfixExpression();
- infixExpression.setSourceRange(300, 5);
- z.add(infixExpression);
- InstanceofExpression instanceofExpression = target.newInstanceofExpression();
- instanceofExpression.setSourceRange(310, 5);
- z.add(instanceofExpression);
- MethodInvocation methodInvocation = target.newMethodInvocation();
- methodInvocation.setSourceRange(320, 5);
- z.add(methodInvocation);
- Name name = target.newName(new String[]{"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$
- name.setSourceRange(330, 5);
- z.add(name);
- NullLiteral nullLiteral2 = target.newNullLiteral();
- nullLiteral2.setSourceRange(336, 3);
- z.add(nullLiteral2);
- NumberLiteral numberLiteral = target.newNumberLiteral("1024"); //$NON-NLS-1$
- numberLiteral.setSourceRange(340, 5);
- z.add(numberLiteral);
- ParenthesizedExpression parenthesizedExpression = target.newParenthesizedExpression();
- parenthesizedExpression.setSourceRange(350, 5);
- z.add(parenthesizedExpression);
- PostfixExpression postfixExpression = target.newPostfixExpression();
- postfixExpression.setSourceRange(360, 5);
- z.add(postfixExpression);
- PrefixExpression prefixExpression = target.newPrefixExpression();
- prefixExpression.setSourceRange(370, 5);
- z.add(prefixExpression);
- StringLiteral stringLiteral = target.newStringLiteral();
- stringLiteral.setSourceRange(380, 5);
- z.add(stringLiteral);
- SuperFieldAccess superFieldAccess = target.newSuperFieldAccess();
- superFieldAccess.setSourceRange(390, 5);
- z.add(superFieldAccess);
- SuperMethodInvocation superMethodInvocation = target.newSuperMethodInvocation();
- superMethodInvocation.setSourceRange(400, 5);
- z.add(superMethodInvocation);
- ThisExpression thisExpression = target.newThisExpression();
- thisExpression.setSourceRange(410, 6);
- z.add(thisExpression);
- TypeLiteral typeLiteral = target.newTypeLiteral();
- typeLiteral.setSourceRange(420, 5);
- z.add(typeLiteral);
- VariableDeclarationFragment variableDeclarationFragment3 = target.newVariableDeclarationFragment();
- variableDeclarationFragment3.setSourceRange(430, 5);
- VariableDeclarationExpression variableDeclarationExpression = target.newVariableDeclarationExpression(variableDeclarationFragment3);
- variableDeclarationExpression.setSourceRange(430, 5);
- z.add(variableDeclarationExpression);
-
- ASTNode clone = ASTNode.copySubtree(ast, cu);
- assertTrue(cu.subtreeMatch(new CheckPositionsMatcher(), clone));
-
- return cu;
- }
-
- public void testClone() {
- ASTNode x = oneOfEach(ast);
- assertTrue(x.subtreeMatch(new CheckPositionsMatcher(), x));
-
- // same AST clone
- ASTNode y = ASTNode.copySubtree(ast, x);
- assertTrue(x.subtreeMatch(new CheckPositionsMatcher(), y));
- assertTrue(y.subtreeMatch(new CheckPositionsMatcher(), x));
-
- // different AST clone
- ASTNode z = ASTNode.copySubtree(new AST(), x);
- assertTrue(x.subtreeMatch(new CheckPositionsMatcher(), z));
- assertTrue(z.subtreeMatch(new CheckPositionsMatcher(), x));
- }
-
- public void testNullResolve() {
- ASTNode x = oneOfEach(ast);
-
- ASTVisitor v = new ASTVisitor() {
- // NAMES
-
- public boolean visit(SimpleName node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(QualifiedName node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
-
- // TYPES
-
- public boolean visit(SimpleType node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(ArrayType node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(PrimitiveType node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
-
- // EXPRESSIONS
-
- public boolean visit(Assignment node) {
- assertTrue(node.resolveTypeBinding() == null);
- return true;
- }
-
- public boolean visit(ClassInstanceCreation node) {
- assertTrue(node.resolveConstructorBinding() == null);
- return true;
- }
-
- public boolean visit(ConstructorInvocation node) {
- assertTrue(node.resolveConstructorBinding() == null);
- return true;
- }
-
- public boolean visit(SuperConstructorInvocation node) {
- assertTrue(node.resolveConstructorBinding() == null);
- return true;
- }
-
- // MAJOR DECLARATIONS
-
- public boolean visit(PackageDeclaration node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(ImportDeclaration node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(MethodDeclaration node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(TypeDeclaration node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(TypeDeclarationStatement node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(SingleVariableDeclaration node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- public boolean visit(VariableDeclarationFragment node) {
- assertTrue(node.resolveBinding() == null);
- return true;
- }
- };
-
- x.accept(v);
- }
-
- public void testForStatement() {
- long previousCount = ast.modificationCount();
- final ForStatement x = ast.newForStatement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.initializers().isEmpty());
- assertTrue(x.getExpression() == null);
- assertTrue(x.updaters().isEmpty());
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody() instanceof Block);
- assertTrue(((Block) x.getBody()).statements().isEmpty());
- assertTrue(x.getLeadingComment() == null);
- assertTrue(x.getNodeType() == ASTNode.FOR_STATEMENT);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyListTest(x, x.initializers(),
- new Property("Initializers", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- });
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyListTest(x, x.updaters(),
- new Property("Updaters", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- });
-
- genericPropertyTest(x, new Property("Body", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Statement) value);
- }
- });
- }
-
- public void testConstructorInvocation() {
- long previousCount = ast.modificationCount();
- final ConstructorInvocation x = ast.newConstructorInvocation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.arguments().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyListTest(x, x.arguments(),
- new Property("Arguments", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- });
- }
-
- public void testSuperConstructorInvocation() {
- long previousCount = ast.modificationCount();
- final SuperConstructorInvocation x = ast.newSuperConstructorInvocation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Statement);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression() == null);
- assertTrue(x.arguments().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyListTest(x, x.arguments(),
- new Property("Arguments", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ClassInstanceCreation s1 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s1.setAnonymousClassDeclaration(a1);
- MethodDeclaration s2 = ast.newMethodDeclaration();
- a1.bodyDeclarations().add(s2);
- Block s3 = ast.newBlock();
- s2.setBody(s3);
- s3.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s3 = (Block) x.getParent();
- s3.statements().remove(x);
- }
- });
- }
-
- public void testThisExpression() {
- long previousCount = ast.modificationCount();
- final ThisExpression x = ast.newThisExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getQualifier() == null);
- assertTrue(x.getNodeType() == ASTNode.THIS_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
- }
-
- public void testFieldAccess() {
- long previousCount = ast.modificationCount();
- final FieldAccess x = ast.newFieldAccess();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.FIELD_ACCESS);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
- }
-
-
- public void testSuperFieldAccess() {
- long previousCount = ast.modificationCount();
- final SuperFieldAccess x = ast.newSuperFieldAccess();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getQualifier() == null);
- assertTrue(x.getNodeType() == ASTNode.SUPER_FIELD_ACCESS);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
- }
-
- public void testSuperMethodInvocation() {
- long previousCount = ast.modificationCount();
- final SuperMethodInvocation x = ast.newSuperMethodInvocation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getQualifier() == null);
- assertTrue(x.arguments().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyListTest(x, x.arguments(),
- new Property("Arguments", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- });
- }
-
- public void testTypeLiteral() {
- long previousCount = ast.modificationCount();
- final TypeLiteral x = ast.newTypeLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.TYPE_LITERAL);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("a")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
- }
-
- public void testCastExpression() {
- long previousCount = ast.modificationCount();
- final CastExpression x = ast.newCastExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.CAST_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("a")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
- }
-
- public void testPrefixExpression() {
- long previousCount = ast.modificationCount();
- final PrefixExpression x = ast.newPrefixExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getOperand().getParent() == x);
- assertTrue(x.getOperator() != null);
- assertTrue(x.getNodeType() == ASTNode.PREFIX_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // Operator property - mandatory typesafe enumeration
- // check the names of the operators
- assertTrue(PrefixExpression.Operator.INCREMENT.toString().equals("++")); //$NON-NLS-1$
- assertTrue(PrefixExpression.Operator.DECREMENT.toString().equals("--")); //$NON-NLS-1$
- assertTrue(PrefixExpression.Operator.PLUS.toString().equals("+")); //$NON-NLS-1$
- assertTrue(PrefixExpression.Operator.MINUS.toString().equals("-")); //$NON-NLS-1$
- assertTrue(PrefixExpression.Operator.COMPLEMENT.toString().equals("~")); //$NON-NLS-1$
- assertTrue(PrefixExpression.Operator.NOT.toString().equals("!")); //$NON-NLS-1$
-
- PrefixExpression.Operator[] known = {
- PrefixExpression.Operator.INCREMENT,
- PrefixExpression.Operator.DECREMENT,
- PrefixExpression.Operator.PLUS,
- PrefixExpression.Operator.MINUS,
- PrefixExpression.Operator.COMPLEMENT,
- PrefixExpression.Operator.NOT,
- };
-
- // check all operators are distinct
- for (int i = 0; i < known.length; i++) {
- for (int j = 0; j < known.length; j++) {
- assertTrue(i == j || !known[i].equals(known[j]));
- }
- }
-
- // check all operators work
- for (int i = 0; i < known.length; i++) {
- previousCount = ast.modificationCount();
- x.setOperator(known[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getOperator().equals(known[i]));
- }
- // ensure null does not work as an operator
- try {
- x.setOperator(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check toOperator lookup of operator by name
- for (int i = 0; i < known.length; i++) {
- String name = known[i].toString();
- assertTrue(PrefixExpression.Operator.toOperator(name).equals(known[i]));
- }
- assertTrue(PrefixExpression.Operator.toOperator("huh") == null); //$NON-NLS-1$
-
- genericPropertyTest(x, new Property("Operand", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getOperand();
- }
- public void set(ASTNode value) {
- x.setOperand((Expression) value);
- }
- });
- }
-
- public void testPostfixExpression() {
- long previousCount = ast.modificationCount();
- final PostfixExpression x = ast.newPostfixExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getOperand().getParent() == x);
- assertTrue(x.getOperator() != null);
- assertTrue(x.getNodeType() == ASTNode.POSTFIX_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // Operator property - mandatory typesafe enumeration
- // check the names of the operators
- assertTrue(PostfixExpression.Operator.INCREMENT.toString().equals("++")); //$NON-NLS-1$
- assertTrue(PostfixExpression.Operator.DECREMENT.toString().equals("--")); //$NON-NLS-1$
-
- PostfixExpression.Operator[] known = {
- PostfixExpression.Operator.INCREMENT,
- PostfixExpression.Operator.DECREMENT,
- };
-
- // check all operators are distinct
- for (int i = 0; i < known.length; i++) {
- for (int j = 0; j < known.length; j++) {
- assertTrue(i == j || !known[i].equals(known[j]));
- }
- }
-
- // check all operators work
- for (int i = 0; i < known.length; i++) {
- previousCount = ast.modificationCount();
- x.setOperator(known[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getOperator().equals(known[i]));
- }
- // ensure null does not work as an operator
- try {
- x.setOperator(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check toOperator lookup of operator by name
- for (int i = 0; i < known.length; i++) {
- String name = known[i].toString();
- assertTrue(PostfixExpression.Operator.toOperator(name).equals(known[i]));
- }
- assertTrue(PostfixExpression.Operator.toOperator("huh") == null); //$NON-NLS-1$
-
- genericPropertyTest(x, new Property("Operand", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getOperand();
- }
- public void set(ASTNode value) {
- x.setOperand((Expression) value);
- }
- });
- }
-
- public void testInfixExpression() {
- long previousCount = ast.modificationCount();
- final InfixExpression x = ast.newInfixExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeftOperand().getParent() == x);
- assertTrue(x.getOperator() != null);
- assertTrue(x.getRightOperand().getParent() == x);
- assertTrue(x.extendedOperands().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.INFIX_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // Operator property - mandatory typesafe enumeration
- // check the names of the operators
- assertTrue(InfixExpression.Operator.TIMES.toString().equals("*")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.DIVIDE.toString().equals("/")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.REMAINDER.toString().equals("%")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.PLUS.toString().equals("+")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.MINUS.toString().equals("-")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.LEFT_SHIFT.toString().equals("<<")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.RIGHT_SHIFT_SIGNED.toString().equals(">>")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED.toString().equals(">>>")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.LESS.toString().equals("<")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.GREATER.toString().equals(">")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.LESS_EQUALS.toString().equals("<=")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.GREATER_EQUALS.toString().equals(">=")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.EQUALS.toString().equals("==")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.NOT_EQUALS.toString().equals("!=")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.XOR.toString().equals("^")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.OR.toString().equals("|")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.AND.toString().equals("&")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.CONDITIONAL_OR.toString().equals("||")); //$NON-NLS-1$
- assertTrue(InfixExpression.Operator.CONDITIONAL_AND.toString().equals("&&")); //$NON-NLS-1$
-
- InfixExpression.Operator[] known = {
- InfixExpression.Operator.TIMES,
- InfixExpression.Operator.DIVIDE,
- InfixExpression.Operator.REMAINDER,
- InfixExpression.Operator.PLUS,
- InfixExpression.Operator.MINUS,
- InfixExpression.Operator.LEFT_SHIFT,
- InfixExpression.Operator.RIGHT_SHIFT_SIGNED,
- InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED,
- InfixExpression.Operator.LESS,
- InfixExpression.Operator.GREATER,
- InfixExpression.Operator.LESS_EQUALS,
- InfixExpression.Operator.GREATER_EQUALS,
- InfixExpression.Operator.EQUALS,
- InfixExpression.Operator.NOT_EQUALS,
- InfixExpression.Operator.XOR,
- InfixExpression.Operator.OR,
- InfixExpression.Operator.AND,
- InfixExpression.Operator.CONDITIONAL_OR,
- InfixExpression.Operator.CONDITIONAL_AND,
- };
-
- // check all operators are distinct
- for (int i = 0; i < known.length; i++) {
- for (int j = 0; j < known.length; j++) {
- assertTrue(i == j || !known[i].equals(known[j]));
- }
- }
-
- // check all operators work
- for (int i = 0; i < known.length; i++) {
- previousCount = ast.modificationCount();
- x.setOperator(known[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getOperator().equals(known[i]));
- }
- // ensure null does not work as an operator
- try {
- x.setOperator(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check toOperator lookup of operator by name
- for (int i = 0; i < known.length; i++) {
- String name = known[i].toString();
- assertTrue(InfixExpression.Operator.toOperator(name).equals(known[i]));
- }
- assertTrue(InfixExpression.Operator.toOperator("huh") == null); //$NON-NLS-1$
-
- genericPropertyTest(x, new Property("LeftOperand", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getLeftOperand();
- }
- public void set(ASTNode value) {
- x.setLeftOperand((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("RightOperand", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getRightOperand();
- }
- public void set(ASTNode value) {
- x.setRightOperand((Expression) value);
- }
- });
-
- genericPropertyListTest(x, x.extendedOperands(),
- new Property("ExtendedOperands", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- });
- }
-
- public void testInstanceofExpression() {
- long previousCount = ast.modificationCount();
- final InstanceofExpression x = ast.newInstanceofExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getLeftOperand().getParent() == x);
- assertTrue(x.getRightOperand().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.INSTANCEOF_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("LeftOperand", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getLeftOperand();
- }
- public void set(ASTNode value) {
- x.setLeftOperand((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("RightOperand", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Type result = localAst.newSimpleType(localAst.newSimpleName("Object")); //$NON-NLS-1$
- if (parented) {
- localAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getRightOperand();
- }
- public void set(ASTNode value) {
- x.setRightOperand((Type) value);
- }
- });
- }
-
- public void testConditionalExpression() {
- long previousCount = ast.modificationCount();
- final ConditionalExpression x = ast.newConditionalExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getThenExpression().getParent() == x);
- assertTrue(x.getElseExpression().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.CONDITIONAL_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("ThenExpression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getThenExpression();
- }
- public void set(ASTNode value) {
- x.setThenExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("ElseExpression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getElseExpression();
- }
- public void set(ASTNode value) {
- x.setElseExpression((Expression) value);
- }
- });
- }
-
- public void testArrayAccess() {
- long previousCount = ast.modificationCount();
- final ArrayAccess x = ast.newArrayAccess();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getArray().getParent() == x);
- assertTrue(x.getIndex().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.ARRAY_ACCESS);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Array", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getArray();
- }
- public void set(ASTNode value) {
- x.setArray((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Index", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getIndex();
- }
- public void set(ASTNode value) {
- x.setIndex((Expression) value);
- }
- });
- }
-
- public void testArrayInitializer() {
- long previousCount = ast.modificationCount();
- final ArrayInitializer x = ast.newArrayInitializer();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.expressions().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.ARRAY_INITIALIZER);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyListTest(x, x.expressions(),
- new Property("Expressions", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- });
- }
-
- public void testClassInstanceCreation() {
- long previousCount = ast.modificationCount();
- final ClassInstanceCreation x = ast.newClassInstanceCreation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.arguments().isEmpty());
- assertTrue(x.getAnonymousClassDeclaration() == null);
- assertTrue(x.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
-
- genericPropertyListTest(x, x.arguments(),
- new Property("Arguments", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- });
-
- genericPropertyTest(x, new Property("AnonymousClassDeclaration", false, AnonymousClassDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- AnonymousClassDeclaration result = targetAst.newAnonymousClassDeclaration();
- if (parented) {
- targetAst.newClassInstanceCreation().setAnonymousClassDeclaration(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return AnonymousClassDeclaration that embeds x
- AnonymousClassDeclaration s0 = x.getAST().newAnonymousClassDeclaration();
- VariableDeclarationFragment s1 = x.getAST().newVariableDeclarationFragment();
- FieldDeclaration s2 = x.getAST().newFieldDeclaration(s1);
- s0.bodyDeclarations().add(s2);
- s1.setInitializer(x);
- return s0;
- }
- public void unwrap() {
- VariableDeclarationFragment s1 = (VariableDeclarationFragment) x.getParent();
- s1.setInitializer(null);
- }
- public ASTNode get() {
- return x.getAnonymousClassDeclaration();
- }
- public void set(ASTNode value) {
- x.setAnonymousClassDeclaration((AnonymousClassDeclaration) value);
- }
- });
-
- }
-
- public void testAnonymousClassDeclaration() {
- long previousCount = ast.modificationCount();
- final AnonymousClassDeclaration x = ast.newAnonymousClassDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof ASTNode);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.bodyDeclarations().isEmpty());
- assertTrue(x.getNodeType() == ASTNode.ANONYMOUS_CLASS_DECLARATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyListTest(x, x.bodyDeclarations(),
- new Property("BodyDeclarations", true, BodyDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TypeDeclaration result = targetAst.newTypeDeclaration();
- if (parented) {
- CompilationUnit compilationUnit = targetAst.newCompilationUnit();
- compilationUnit.types().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return BodyDeclaration that embeds x
- VariableDeclarationFragment s0 = x.getAST().newVariableDeclarationFragment();
- FieldDeclaration s1 = x.getAST().newFieldDeclaration(s0);
- ClassInstanceCreation s2= x.getAST().newClassInstanceCreation();
- s0.setInitializer(s2);
- s2.setAnonymousClassDeclaration(x);
- return s1;
- }
- public void unwrap() {
- ClassInstanceCreation s2 = (ClassInstanceCreation) x.getParent();
- s2.setAnonymousClassDeclaration(null);
- }
- });
-
- // check that TypeDeclarations in body are classified correctly
- TypeDeclaration t1 = ast.newTypeDeclaration();
- x.bodyDeclarations().add(t1);
- assertTrue(t1.isLocalTypeDeclaration() == false);
- assertTrue(t1.isMemberTypeDeclaration() == true);
- assertTrue(t1.isPackageMemberTypeDeclaration() == false);
- }
-
- public void testArrayCreation() {
- long previousCount = ast.modificationCount();
- final ArrayCreation x = ast.newArrayCreation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.dimensions().isEmpty());
- assertTrue(x.getInitializer() == null);
- assertTrue(x.getNodeType() == ASTNode.ARRAY_CREATION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Type", true, ArrayType.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- ArrayType result = targetAst.newArrayType(
- targetAst.newSimpleType(targetAst.newSimpleName("a"))); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((ArrayType) value);
- }
- });
-
- genericPropertyListTest(x, x.dimensions(),
- new Property("Dimensions", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- });
-
- genericPropertyTest(x, new Property("Initializer", false, ArrayInitializer.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- ArrayInitializer result = targetAst.newArrayInitializer();
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return ArrayInitializer that embeds x
- ArrayInitializer s1 = ast.newArrayInitializer();
- s1.expressions().add(x);
- return s1;
- }
- public void unwrap() {
- ArrayInitializer s1 = (ArrayInitializer) x.getParent();
- s1.expressions().remove(x);
- }
- public ASTNode get() {
- return x.getInitializer();
- }
- public void set(ASTNode value) {
- x.setInitializer((ArrayInitializer) value);
- }
- });
- }
-
- public void testParenthesizedExpression() {
- long previousCount = ast.modificationCount();
- final ParenthesizedExpression x = ast.newParenthesizedExpression();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x instanceof Expression);
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getExpression().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", true, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST localAst, boolean parented) {
- Expression result = localAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- localAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("fie")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
- }
-
- public void testModifiers() {
-
- // check all modifiers match their JVM spec values
- assertTrue(Modifier.ABSTRACT == 0x0400);
- assertTrue(Modifier.FINAL == 0x0010);
- assertTrue(Modifier.NATIVE == 0x0100);
- assertTrue(Modifier.NONE == 0x0000);
- assertTrue(Modifier.PRIVATE == 0x0002);
- assertTrue(Modifier.PROTECTED == 0x0004);
- assertTrue(Modifier.PUBLIC == 0x0001);
- assertTrue(Modifier.STATIC == 0x0008);
- assertTrue(Modifier.STRICTFP == 0x0800);
- assertTrue(Modifier.SYNCHRONIZED == 0x0020);
- assertTrue(Modifier.TRANSIENT == 0x0080);
- assertTrue(Modifier.VOLATILE == 0x0040);
-
- // check that all
- int[] mods =
- {
- Modifier.ABSTRACT,
- Modifier.FINAL,
- Modifier.NATIVE,
- Modifier.PRIVATE,
- Modifier.PROTECTED,
- Modifier.PUBLIC,
- Modifier.STATIC,
- Modifier.STRICTFP,
- Modifier.SYNCHRONIZED,
- Modifier.TRANSIENT,
- Modifier.VOLATILE,
- };
-
- for (int i=0; i< mods.length; i++) {
- int m = mods[i];
- assertTrue(Modifier.isAbstract(m) == (m == Modifier.ABSTRACT));
- assertTrue(Modifier.isFinal(m) == (m == Modifier.FINAL));
- assertTrue(Modifier.isNative(m) == (m == Modifier.NATIVE));
- assertTrue(Modifier.isPrivate(m) == (m == Modifier.PRIVATE));
- assertTrue(Modifier.isProtected(m) == (m == Modifier.PROTECTED));
- assertTrue(Modifier.isPublic(m) == (m == Modifier.PUBLIC));
- assertTrue(Modifier.isStatic(m) == (m == Modifier.STATIC));
- assertTrue(Modifier.isStrictfp(m) == (m == Modifier.STRICTFP));
- assertTrue(Modifier.isSynchronized(m) == (m == Modifier.SYNCHRONIZED));
- assertTrue(Modifier.isTransient(m) == (m == Modifier.TRANSIENT));
- assertTrue(Modifier.isVolatile(m) == (m == Modifier.VOLATILE));
- }
- }
-
- public void testSubtreeBytes() {
-
- ASTNode x = oneOfEach(ast);
-// System.out.println("oneOfEach().subtreeBytes(): " + x.subtreeBytes());
- assertTrue(x.subtreeBytes() > 0);
- }
-
- public void testNodeTypeConstants() {
- // it would be a breaking API change to change the numeric values of
- // public static final ints
- assertTrue(ASTNode.ANONYMOUS_CLASS_DECLARATION == 1);
- assertTrue(ASTNode.ARRAY_ACCESS == 2);
- assertTrue(ASTNode.ARRAY_CREATION == 3);
- assertTrue(ASTNode.ARRAY_INITIALIZER == 4);
- assertTrue(ASTNode.ARRAY_TYPE == 5);
- assertTrue(ASTNode.ASSERT_STATEMENT == 6);
- assertTrue(ASTNode.ASSIGNMENT == 7);
- assertTrue(ASTNode.BLOCK == 8);
- assertTrue(ASTNode.BOOLEAN_LITERAL == 9);
- assertTrue(ASTNode.BREAK_STATEMENT == 10);
- assertTrue(ASTNode.CAST_EXPRESSION == 11);
- assertTrue(ASTNode.CATCH_CLAUSE == 12);
- assertTrue(ASTNode.CHARACTER_LITERAL == 13);
- assertTrue(ASTNode.CLASS_INSTANCE_CREATION == 14);
- assertTrue(ASTNode.COMPILATION_UNIT == 15);
- assertTrue(ASTNode.CONDITIONAL_EXPRESSION == 16);
- assertTrue(ASTNode.CONSTRUCTOR_INVOCATION == 17);
- assertTrue(ASTNode.CONTINUE_STATEMENT == 18);
- assertTrue(ASTNode.DO_STATEMENT == 19);
- assertTrue(ASTNode.EMPTY_STATEMENT == 20);
- assertTrue(ASTNode.EXPRESSION_STATEMENT == 21);
- assertTrue(ASTNode.FIELD_ACCESS == 22);
- assertTrue(ASTNode.FIELD_DECLARATION == 23);
- assertTrue(ASTNode.FOR_STATEMENT == 24);
- assertTrue(ASTNode.IF_STATEMENT == 25);
- assertTrue(ASTNode.IMPORT_DECLARATION == 26);
- assertTrue(ASTNode.INFIX_EXPRESSION == 27);
- assertTrue(ASTNode.INITIALIZER == 28);
- assertTrue(ASTNode.JAVADOC == 29);
- assertTrue(ASTNode.LABELED_STATEMENT == 30);
- assertTrue(ASTNode.METHOD_DECLARATION == 31);
- assertTrue(ASTNode.METHOD_INVOCATION == 32);
- assertTrue(ASTNode.NULL_LITERAL == 33);
- assertTrue(ASTNode.NUMBER_LITERAL == 34);
- assertTrue(ASTNode.PACKAGE_DECLARATION == 35);
- assertTrue(ASTNode.PARENTHESIZED_EXPRESSION == 36);
- assertTrue(ASTNode.POSTFIX_EXPRESSION == 37);
- assertTrue(ASTNode.PREFIX_EXPRESSION == 38);
- assertTrue(ASTNode.PRIMITIVE_TYPE == 39);
- assertTrue(ASTNode.QUALIFIED_NAME == 40);
- assertTrue(ASTNode.RETURN_STATEMENT == 41);
- assertTrue(ASTNode.SIMPLE_NAME == 42);
- assertTrue(ASTNode.SIMPLE_TYPE == 43);
- assertTrue(ASTNode.SINGLE_VARIABLE_DECLARATION == 44);
- assertTrue(ASTNode.STRING_LITERAL == 45);
- assertTrue(ASTNode.SUPER_CONSTRUCTOR_INVOCATION == 46);
- assertTrue(ASTNode.SUPER_FIELD_ACCESS == 47);
- assertTrue(ASTNode.SUPER_METHOD_INVOCATION == 48);
- assertTrue(ASTNode.SWITCH_CASE == 49);
- assertTrue(ASTNode.SWITCH_STATEMENT == 50);
- assertTrue(ASTNode.SYNCHRONIZED_STATEMENT == 51);
- assertTrue(ASTNode.THIS_EXPRESSION == 52);
- assertTrue(ASTNode.THROW_STATEMENT == 53);
- assertTrue(ASTNode.TRY_STATEMENT == 54);
- assertTrue(ASTNode.TYPE_DECLARATION == 55);
- assertTrue(ASTNode.TYPE_DECLARATION_STATEMENT == 56);
- assertTrue(ASTNode.TYPE_LITERAL == 57);
- assertTrue(ASTNode.VARIABLE_DECLARATION_EXPRESSION == 58);
- assertTrue(ASTNode.VARIABLE_DECLARATION_FRAGMENT == 59);
- assertTrue(ASTNode.VARIABLE_DECLARATION_STATEMENT == 60);
- assertTrue(ASTNode.WHILE_STATEMENT == 61);
- assertTrue(ASTNode.INSTANCEOF_EXPRESSION == 62);
-
- // ensure that all constants are distinct, positive, and small
- // (this may seem paranoid, but this test did uncover a stupid bug!)
- int[] all= {
- ASTNode.ANONYMOUS_CLASS_DECLARATION,
- ASTNode.ARRAY_ACCESS,
- ASTNode.ARRAY_CREATION,
- ASTNode.ARRAY_INITIALIZER,
- ASTNode.ARRAY_TYPE,
- ASTNode.ASSERT_STATEMENT,
- ASTNode.ASSIGNMENT,
- ASTNode.BLOCK,
- ASTNode.BOOLEAN_LITERAL,
- ASTNode.BREAK_STATEMENT,
- ASTNode.CAST_EXPRESSION,
- ASTNode.CATCH_CLAUSE,
- ASTNode.CHARACTER_LITERAL,
- ASTNode.CLASS_INSTANCE_CREATION,
- ASTNode.COMPILATION_UNIT,
- ASTNode.CONDITIONAL_EXPRESSION,
- ASTNode.CONSTRUCTOR_INVOCATION,
- ASTNode.CONTINUE_STATEMENT,
- ASTNode.DO_STATEMENT,
- ASTNode.EMPTY_STATEMENT,
- ASTNode.EXPRESSION_STATEMENT,
- ASTNode.FIELD_ACCESS,
- ASTNode.FIELD_DECLARATION,
- ASTNode.FOR_STATEMENT,
- ASTNode.IF_STATEMENT,
- ASTNode.IMPORT_DECLARATION,
- ASTNode.INFIX_EXPRESSION,
- ASTNode.INSTANCEOF_EXPRESSION,
- ASTNode.INITIALIZER,
- ASTNode.JAVADOC,
- ASTNode.LABELED_STATEMENT,
- ASTNode.METHOD_DECLARATION,
- ASTNode.METHOD_INVOCATION,
- ASTNode.NULL_LITERAL,
- ASTNode.NUMBER_LITERAL,
- ASTNode.PACKAGE_DECLARATION,
- ASTNode.PARENTHESIZED_EXPRESSION,
- ASTNode.POSTFIX_EXPRESSION,
- ASTNode.PREFIX_EXPRESSION,
- ASTNode.PRIMITIVE_TYPE,
- ASTNode.QUALIFIED_NAME,
- ASTNode.RETURN_STATEMENT,
- ASTNode.SIMPLE_NAME,
- ASTNode.SIMPLE_TYPE,
- ASTNode.SINGLE_VARIABLE_DECLARATION,
- ASTNode.STRING_LITERAL,
- ASTNode.SUPER_CONSTRUCTOR_INVOCATION,
- ASTNode.SUPER_FIELD_ACCESS,
- ASTNode.SUPER_METHOD_INVOCATION,
- ASTNode.SWITCH_CASE,
- ASTNode.SWITCH_STATEMENT,
- ASTNode.SYNCHRONIZED_STATEMENT,
- ASTNode.THIS_EXPRESSION,
- ASTNode.THROW_STATEMENT,
- ASTNode.TRY_STATEMENT,
- ASTNode.TYPE_DECLARATION,
- ASTNode.TYPE_DECLARATION_STATEMENT,
- ASTNode.TYPE_LITERAL,
- ASTNode.VARIABLE_DECLARATION_EXPRESSION,
- ASTNode.VARIABLE_DECLARATION_FRAGMENT,
- ASTNode.VARIABLE_DECLARATION_STATEMENT,
- ASTNode.WHILE_STATEMENT,
-
- };
- int MIN = 1;
- int MAX = 100;
- Set s = new HashSet();
- for (int i=0; i<all.length; i++) {
- assertTrue(MIN <= all[i] && all[i] <= MAX);
- s.add(new Integer(all[i]));
- }
- assertTrue(s.size() == all.length);
- // ensure that Integers really do compare properly with equals
- assertTrue(new Integer(1).equals(new Integer(1)));
-
- }}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTVisitorTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTVisitorTest.java
deleted file mode 100644
index 9fe54d9..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTVisitorTest.java
+++ /dev/null
@@ -1,1488 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import junit.framework.Test;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.dom.ASTNode;
-
-public class ASTVisitorTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
-
- public static Test suite() {
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTVisitorTest.class.getName());
-
- Class c = ASTVisitorTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTVisitorTest(methods[i].getName()));
- }
- }
- return suite;
- }
-
- AST ast;
- SimpleName N1;
- String N1S;
- SimpleName N2;
- String N2S;
- SimpleName N3;
- String N3S;
- Expression E1;
- String E1S;
- Expression E2;
- String E2S;
- Type T1;
- String T1S;
- Statement S1;
- String S1S;
- Statement S2;
- Block B1;
- String B1S;
- String S2S;
- SingleVariableDeclaration V1;
- String V1S;
- SingleVariableDeclaration V2;
- String V2S;
- VariableDeclarationFragment W1;
- String W1S;
- VariableDeclarationFragment W2;
- String W2S;
- FieldDeclaration FD1;
- String FD1S;
- FieldDeclaration FD2;
- String FD2S;
- PackageDeclaration PD1;
- String PD1S;
- ImportDeclaration ID1;
- String ID1S;
- ImportDeclaration ID2;
- String ID2S;
- TypeDeclaration TD1;
- String TD1S;
- TypeDeclaration TD2;
- String TD2S;
- Javadoc JD1;
- String JD1S;
- Javadoc JD2;
- String JD2S;
- AnonymousClassDeclaration ACD1;
- String ACD1S;
-
- final StringBuffer b = new StringBuffer();
-
- public ASTVisitorTest(String name) {
- super(name);
- }
-
- protected void setUp() {
- ast = new AST();
- N1 = ast.newSimpleName("N"); //$NON-NLS-1$
- N1S = "[(nSNNnS)]"; //$NON-NLS-1$
- N2 = ast.newSimpleName("M"); //$NON-NLS-1$
- N2S = "[(nSMMnS)]"; //$NON-NLS-1$
- N3 = ast.newSimpleName("O"); //$NON-NLS-1$
- N3S = "[(nSOOnS)]"; //$NON-NLS-1$
- E1 = ast.newSimpleName("X"); //$NON-NLS-1$
- E1S = "[(nSXXnS)]"; //$NON-NLS-1$
- E2 = ast.newSimpleName("Y"); //$NON-NLS-1$
- E2S = "[(nSYYnS)]"; //$NON-NLS-1$
- T1 = ast.newSimpleType(ast.newSimpleName("Z")); //$NON-NLS-1$
- T1S = "[(tS[(nSZZnS)]tS)]"; //$NON-NLS-1$
- S1 = ast.newContinueStatement();
- S1S = "[(sCNsCN)]"; //$NON-NLS-1$
- S2 = ast.newBreakStatement();
- S2S = "[(sBRsBR)]"; //$NON-NLS-1$
- B1 = ast.newBlock();
- B1S = "[(sBsB)]"; //$NON-NLS-1$
- V1 = ast.newSingleVariableDeclaration();
- V1.setType(ast.newPrimitiveType(PrimitiveType.INT));
- V1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
- V1S = "[(VD[(tPintinttP)][(nSaanS)]VD)]"; //$NON-NLS-1$
- V2 = ast.newSingleVariableDeclaration();
- V2.setType(ast.newPrimitiveType(PrimitiveType.BYTE));
- V2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- V2S = "[(VD[(tPbytebytetP)][(nSbbnS)]VD)]"; //$NON-NLS-1$
- W1 = ast.newVariableDeclarationFragment();
- W1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
- W1S = "[(VS[(nSaanS)]VS)]"; //$NON-NLS-1$
- W2 = ast.newVariableDeclarationFragment();
- W2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- W2S = "[(VS[(nSbbnS)]VS)]"; //$NON-NLS-1$
- {
- VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
- temp.setName(ast.newSimpleName("f")); //$NON-NLS-1$
- FD1 = ast.newFieldDeclaration(temp);
- FD1.setType(ast.newPrimitiveType(PrimitiveType.INT));
- FD1S = "[(FD[(tPintinttP)][(VS[(nSffnS)]VS)]FD)]"; //$NON-NLS-1$
- }
- {
- VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
- temp.setName(ast.newSimpleName("g")); //$NON-NLS-1$
- FD2 = ast.newFieldDeclaration(temp);
- FD2.setType(ast.newPrimitiveType(PrimitiveType.CHAR));
- FD2S = "[(FD[(tPcharchartP)][(VS[(nSggnS)]VS)]FD)]"; //$NON-NLS-1$
- }
- PD1 = ast.newPackageDeclaration();
- PD1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
- PD1S = "[(PD[(nSppnS)]PD)]"; //$NON-NLS-1$
- ID1 = ast.newImportDeclaration();
- ID1.setName(ast.newSimpleName("i")); //$NON-NLS-1$
- ID1S = "[(ID[(nSiinS)]ID)]"; //$NON-NLS-1$
- ID2 = ast.newImportDeclaration();
- ID2.setName(ast.newSimpleName("j")); //$NON-NLS-1$
- ID2S = "[(ID[(nSjjnS)]ID)]"; //$NON-NLS-1$
- TD1 = ast.newTypeDeclaration();
- TD1.setName(ast.newSimpleName("c")); //$NON-NLS-1$
- TD1S = "[(TD[(nSccnS)]TD)]"; //$NON-NLS-1$
- TD2 = ast.newTypeDeclaration();
- TD2.setName(ast.newSimpleName("d")); //$NON-NLS-1$
- TD2S = "[(TD[(nSddnS)]TD)]"; //$NON-NLS-1$
-
- ACD1 = ast.newAnonymousClassDeclaration();
- ACD1S = "[(ACDACD)]"; //$NON-NLS-1$
-
- JD1 = ast.newJavadoc();
- JD1.setComment("/**X*/"); //$NON-NLS-1$
- JD1S = "[(JD/**X*//**X*/JD)]"; //$NON-NLS-1$
- JD2 = ast.newJavadoc();
- JD2.setComment("/**Y*/"); //$NON-NLS-1$
- JD2S = "[(JD/**Y*//**Y*/JD)]"; //$NON-NLS-1$
-
- }
-
- protected void tearDown() {
- ast = null;
- }
-
- class TestVisitor extends ASTVisitor {
-
- boolean visitTheKids = true;
-
- public boolean isVisitingChildren() {
- return visitTheKids;
- }
-
- public void setVisitingChildren(boolean visitChildren) {
- visitTheKids = visitChildren;
- }
-
- // NAMES
-
- public boolean visit(SimpleName node) {
- b.append("(nS"); //$NON-NLS-1$
- b.append(node.getIdentifier());
- return isVisitingChildren();
- }
- public void endVisit(SimpleName node) {
- b.append(node.getIdentifier());
- b.append("nS)"); //$NON-NLS-1$
- }
- public boolean visit(QualifiedName node) {
- b.append("(nQ"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(QualifiedName node) {
- b.append("nQ)"); //$NON-NLS-1$
- }
-
- // TYPES
-
- public boolean visit(SimpleType node) {
- b.append("(tS"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SimpleType node) {
- b.append("tS)"); //$NON-NLS-1$
- }
- public boolean visit(ArrayType node) {
- b.append("(tA"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ArrayType node) {
- b.append("tA)"); //$NON-NLS-1$
- }
- public boolean visit(PrimitiveType node) {
- b.append("(tP"); //$NON-NLS-1$
- b.append(node.getPrimitiveTypeCode().toString());
- return isVisitingChildren();
- }
- public void endVisit(PrimitiveType node) {
- b.append(node.getPrimitiveTypeCode().toString());
- b.append("tP)"); //$NON-NLS-1$
- }
-
- // EXPRESSIONS and STATEMENTS
-
-
- public boolean visit(ArrayAccess node) {
- b.append("(eAA"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ArrayAccess node) {
- b.append("eAA)"); //$NON-NLS-1$
- }
-
- public boolean visit(ArrayCreation node) {
- b.append("(eAC"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ArrayCreation node) {
- b.append("eAC)"); //$NON-NLS-1$
- }
-
- public boolean visit(ArrayInitializer node) {
- b.append("(eAI"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ArrayInitializer node) {
- b.append("eAI)"); //$NON-NLS-1$
- }
-
- public boolean visit(AssertStatement node) {
- b.append("(sAS"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(AssertStatement node) {
- b.append("sAS)"); //$NON-NLS-1$
- }
-
- public boolean visit(Assignment node) {
- b.append("("); //$NON-NLS-1$
- b.append(node.getOperator().toString());
- return isVisitingChildren();
- }
- public void endVisit(Assignment node) {
- b.append(node.getOperator().toString());
- b.append(")"); //$NON-NLS-1$
- }
-
- public boolean visit(Block node) {
- b.append("(sB"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(Block node) {
- b.append("sB)"); //$NON-NLS-1$
- }
-
- public boolean visit(BooleanLiteral node) {
- b.append("(eBL"); //$NON-NLS-1$
- b.append(node.booleanValue() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
- return isVisitingChildren();
- }
- public void endVisit(BooleanLiteral node) {
- b.append(node.booleanValue() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
- b.append("eBL)"); //$NON-NLS-1$
- }
-
- public boolean visit(BreakStatement node) {
- b.append("(sBR"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(BreakStatement node) {
- b.append("sBR)"); //$NON-NLS-1$
- }
-
- public boolean visit(CastExpression node) {
- b.append("(eCS"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(CastExpression node) {
- b.append("eCS)"); //$NON-NLS-1$
- }
-
- public boolean visit(CatchClause node) {
- b.append("(cc"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(CatchClause node) {
- b.append("cc)"); //$NON-NLS-1$
- }
-
- public boolean visit(CharacterLiteral node) {
- b.append("(eCL"); //$NON-NLS-1$
- b.append(node.getEscapedValue());
- return isVisitingChildren();
- }
- public void endVisit(CharacterLiteral node) {
- b.append(node.getEscapedValue());
- b.append("eCL)"); //$NON-NLS-1$
- }
-
- public boolean visit(ClassInstanceCreation node) {
- b.append("(eCI"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ClassInstanceCreation node) {
- b.append("eCI)"); //$NON-NLS-1$
- }
-
- public boolean visit(AnonymousClassDeclaration node) {
- b.append("(ACD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(AnonymousClassDeclaration node) {
- b.append("ACD)"); //$NON-NLS-1$
- }
-
- public boolean visit(CompilationUnit node) {
- b.append("(CU"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(CompilationUnit node) {
- b.append("CU)"); //$NON-NLS-1$
- }
-
- public boolean visit(ConditionalExpression node) {
- b.append("(eCO"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ConditionalExpression node) {
- b.append("eCO)"); //$NON-NLS-1$
- }
-
- public boolean visit(ConstructorInvocation node) {
- b.append("(sCI"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ConstructorInvocation node) {
- b.append("sCI)"); //$NON-NLS-1$
- }
-
- public boolean visit(ContinueStatement node) {
- b.append("(sCN"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ContinueStatement node) {
- b.append("sCN)"); //$NON-NLS-1$
- }
-
- public boolean visit(DoStatement node) {
- b.append("(sDO"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(DoStatement node) {
- b.append("sDO)"); //$NON-NLS-1$
- }
-
- public boolean visit(EmptyStatement node) {
- b.append("(sEM"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(EmptyStatement node) {
- b.append("sEM)"); //$NON-NLS-1$
- }
-
- public boolean visit(ExpressionStatement node) {
- b.append("(sEX"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ExpressionStatement node) {
- b.append("sEX)"); //$NON-NLS-1$
- }
-
- public boolean visit(FieldAccess node) {
- b.append("(eFA"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(FieldAccess node) {
- b.append("eFA)"); //$NON-NLS-1$
- }
-
- public boolean visit(FieldDeclaration node) {
- b.append("(FD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(FieldDeclaration node) {
- b.append("FD)"); //$NON-NLS-1$
- }
-
- public boolean visit(ForStatement node) {
- b.append("(sFR"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ForStatement node) {
- b.append("sFR)"); //$NON-NLS-1$
- }
-
- public boolean visit(IfStatement node) {
- b.append("(sIF"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(IfStatement node) {
- b.append("sIF)"); //$NON-NLS-1$
- }
-
- public boolean visit(ImportDeclaration node) {
- b.append("(ID"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ImportDeclaration node) {
- b.append("ID)"); //$NON-NLS-1$
- }
-
- public boolean visit(InfixExpression node) {
- b.append("(eIN"); //$NON-NLS-1$
- b.append(node.getOperator().toString());
- return isVisitingChildren();
- }
- public void endVisit(InfixExpression node) {
- b.append(node.getOperator().toString());
- b.append("eIN)"); //$NON-NLS-1$
- }
-
- public boolean visit(InstanceofExpression node) {
- b.append("(eIO"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(InstanceofExpression node) {
- b.append("eIO)"); //$NON-NLS-1$
- }
-
- public boolean visit(Initializer node) {
- b.append("(IN"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(Initializer node) {
- b.append("IN)"); //$NON-NLS-1$
- }
-
- public boolean visit(Javadoc node) {
- b.append("(JD"); //$NON-NLS-1$
- b.append(node.getComment());
- return isVisitingChildren();
- }
- public void endVisit(Javadoc node) {
- b.append(node.getComment());
- b.append("JD)"); //$NON-NLS-1$
- }
-
- public boolean visit(LabeledStatement node) {
- b.append("(sLA"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(LabeledStatement node) {
- b.append("sLA)"); //$NON-NLS-1$
- }
-
- public boolean visit(MethodDeclaration node) {
- b.append("(MD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(MethodDeclaration node) {
- b.append("MD)"); //$NON-NLS-1$
- }
-
- public boolean visit(MethodInvocation node) {
- b.append("(eMI"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(MethodInvocation node) {
- b.append("eMI)"); //$NON-NLS-1$
- }
-
- public boolean visit(NullLiteral node) {
- b.append("(eNL"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(NullLiteral node) {
- b.append("eNL)"); //$NON-NLS-1$
- }
-
- public boolean visit(NumberLiteral node) {
- b.append("(eNU"); //$NON-NLS-1$
- b.append(node.getToken());
- return isVisitingChildren();
- }
- public void endVisit(NumberLiteral node) {
- b.append(node.getToken());
- b.append("eNU)"); //$NON-NLS-1$
- }
-
- public boolean visit(PackageDeclaration node) {
- b.append("(PD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(PackageDeclaration node) {
- b.append("PD)"); //$NON-NLS-1$
- }
-
- public boolean visit(ParenthesizedExpression node) {
- b.append("(ePA"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ParenthesizedExpression node) {
- b.append("ePA)"); //$NON-NLS-1$
- }
-
- public boolean visit(PostfixExpression node) {
- b.append("(ePO"); //$NON-NLS-1$
- b.append(node.getOperator().toString());
- return isVisitingChildren();
- }
- public void endVisit(PostfixExpression node) {
- b.append(node.getOperator().toString());
- b.append("ePO)"); //$NON-NLS-1$
- }
-
- public boolean visit(PrefixExpression node) {
- b.append("(ePR"); //$NON-NLS-1$
- b.append(node.getOperator().toString());
- return isVisitingChildren();
- }
- public void endVisit(PrefixExpression node) {
- b.append(node.getOperator().toString());
- b.append("ePR)"); //$NON-NLS-1$
- }
-
- public boolean visit(ReturnStatement node) {
- b.append("(sRT"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ReturnStatement node) {
- b.append("sRT)"); //$NON-NLS-1$
- }
-
- public boolean visit(SingleVariableDeclaration node) {
- b.append("(VD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SingleVariableDeclaration node) {
- b.append("VD)"); //$NON-NLS-1$
- }
-
- public boolean visit(StringLiteral node) {
- b.append("(eSL"); //$NON-NLS-1$
- b.append(node.getLiteralValue());
- return isVisitingChildren();
- }
- public void endVisit(StringLiteral node) {
- b.append(node.getLiteralValue());
- b.append("eSL)"); //$NON-NLS-1$
- }
-
- public boolean visit(SuperConstructorInvocation node) {
- b.append("(sSC"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SuperConstructorInvocation node) {
- b.append("sSC)"); //$NON-NLS-1$
- }
-
- public boolean visit(SuperFieldAccess node) {
- b.append("(eSF"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SuperFieldAccess node) {
- b.append("eSF)"); //$NON-NLS-1$
- }
-
- public boolean visit(SuperMethodInvocation node) {
- b.append("(eSM"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SuperMethodInvocation node) {
- b.append("eSM)"); //$NON-NLS-1$
- }
-
- public boolean visit(SwitchCase node) {
- b.append("(sSC"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SwitchCase node) {
- b.append("sSC)"); //$NON-NLS-1$
- }
-
- public boolean visit(SwitchStatement node) {
- b.append("(sSW"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SwitchStatement node) {
- b.append("sSW)"); //$NON-NLS-1$
- }
-
- public boolean visit(SynchronizedStatement node) {
- b.append("(sSY"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(SynchronizedStatement node) {
- b.append("sSY)"); //$NON-NLS-1$
- }
-
- public boolean visit(ThisExpression node) {
- b.append("(eTH"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ThisExpression node) {
- b.append("eTH)"); //$NON-NLS-1$
- }
-
- public boolean visit(ThrowStatement node) {
- b.append("(sTR"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(ThrowStatement node) {
- b.append("sTR)"); //$NON-NLS-1$
- }
-
- public boolean visit(TryStatement node) {
- b.append("(sTY"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(TryStatement node) {
- b.append("sTY)"); //$NON-NLS-1$
- }
-
- public boolean visit(TypeDeclaration node) {
- b.append("(TD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(TypeDeclaration node) {
- b.append("TD)"); //$NON-NLS-1$
- }
-
- public boolean visit(TypeDeclarationStatement node) {
- b.append("(sTD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(TypeDeclarationStatement node) {
- b.append("sTD)"); //$NON-NLS-1$
- }
-
- public boolean visit(TypeLiteral node) {
- b.append("(eTL"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(TypeLiteral node) {
- b.append("eTL)"); //$NON-NLS-1$
- }
-
- public boolean visit(VariableDeclarationExpression node) {
- b.append("(eVD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(VariableDeclarationExpression node) {
- b.append("eVD)"); //$NON-NLS-1$
- }
-
- public boolean visit(VariableDeclarationFragment node) {
- b.append("(VS"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(VariableDeclarationFragment node) {
- b.append("VS)"); //$NON-NLS-1$
- }
-
- public boolean visit(VariableDeclarationStatement node) {
- b.append("(sVD"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(VariableDeclarationStatement node) {
- b.append("sVD)"); //$NON-NLS-1$
- }
-
- public boolean visit(WhileStatement node) {
- b.append("(sWH"); //$NON-NLS-1$
- return isVisitingChildren();
- }
- public void endVisit(WhileStatement node) {
- b.append("sWH)"); //$NON-NLS-1$
- }
-
- public void preVisit(ASTNode node) {
- b.append("["); //$NON-NLS-1$
- }
-
- public void postVisit(ASTNode node) {
- b.append("]"); //$NON-NLS-1$
- }
-
- }
- // NAMES
- public void testSimpleName() {
- Name x1 = ast.newName(new String[]{"Z"}); //$NON-NLS-1$
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue("[(nSZZnS)]".equals(result)); //$NON-NLS-1$
- }
-
- public void testQualifiedName() {
- Name x1 = ast.newName(new String[]{"X", "Y"}); //$NON-NLS-1$ //$NON-NLS-2$
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue("[(nQ[(nSXXnS)][(nSYYnS)]nQ)]".equals(result)); //$NON-NLS-1$
- }
-
-
- // TYPES
- public void testPrimitiveType() {
- Type x1 = ast.newPrimitiveType(PrimitiveType.CHAR);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue("[(tPcharchartP)]".equals(result)); //$NON-NLS-1$
- }
-
- public void testSimpleType() {
- Type x1 = ast.newSimpleType(ast.newName(new String[]{"Z"})); //$NON-NLS-1$
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue("[(tS[(nSZZnS)]tS)]".equals(result)); //$NON-NLS-1$
- }
-
- public void testArrayType() {
- Type x0 = ast.newPrimitiveType(PrimitiveType.CHAR);
- Type x1 = ast.newArrayType(x0);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue("[(tA[(tPcharchartP)]tA)]".equals(result)); //$NON-NLS-1$
- }
-
- // EXPRESSIONS and STATEMENTS
-
- public void testArrayAccess() {
- ArrayAccess x1 = ast.newArrayAccess();
- x1.setArray(E1);
- x1.setIndex(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eAA"+E1S+E2S+"eAA)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testArrayCreation() {
- ArrayCreation x1 = ast.newArrayCreation();
- x1.setType(ast.newArrayType(T1));
- x1.dimensions().add(E1);
- x1.dimensions().add(E2);
- x1.setInitializer(ast.newArrayInitializer());
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eAC"+"[(tA"+T1S+"tA)]"+E1S+E2S+"[(eAIeAI)]eAC)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- public void testArrayInitializer() {
- ArrayInitializer x1 = ast.newArrayInitializer();
- x1.expressions().add(E1);
- x1.expressions().add(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eAI"+E1S+E2S+"eAI)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testAssertStatement() {
- AssertStatement x1 = ast.newAssertStatement();
- x1.setExpression(E1);
- x1.setMessage(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sAS"+E1S+E2S+"sAS)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testAssignment() {
- Assignment x1 = ast.newAssignment();
- x1.setLeftHandSide(E1);
- x1.setRightHandSide(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(="+E1S+E2S+"=)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testBlock() {
- Block x1 = ast.newBlock();
- x1.statements().add(S1);
- x1.statements().add(S2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sB"+S1S+S2S+"sB)]")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // check that visiting children can be cut off
- v1.setVisitingChildren(false);
- b.setLength(0);
- x1.accept(v1);
- result = b.toString();
- assertTrue(result.equals("[(sBsB)]")); //$NON-NLS-1$
- }
- public void testBooleanLiteral() {
- BooleanLiteral x1 = ast.newBooleanLiteral(true);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eBLtruetrueeBL)]")); //$NON-NLS-1$
- }
- public void testBreakStatement() {
- BreakStatement x1 = ast.newBreakStatement();
- x1.setLabel(N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sBR"+N1S+"sBR)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testCastExpression() {
- CastExpression x1 = ast.newCastExpression();
- x1.setType(T1);
- x1.setExpression(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eCS"+T1S+E1S+"eCS)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testCatchClause() {
- CatchClause x1 = ast.newCatchClause();
- x1.setException(V1);
- x1.setBody(B1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(cc"+V1S+B1S+"cc)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testCharacterLiteral() {
- CharacterLiteral x1 = ast.newCharacterLiteral();
- x1.setCharValue('q');
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eCL'q''q'eCL)]")); //$NON-NLS-1$
- }
- public void testClassInstanceCreation() {
- ClassInstanceCreation x1 = ast.newClassInstanceCreation();
- x1.setExpression(E1);
- x1.setName(N1);
- x1.setAnonymousClassDeclaration(ACD1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eCI"+E1S+N1S+ACD1S+"eCI)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testAnonymousClassDeclaration() {
- AnonymousClassDeclaration x1 = ast.newAnonymousClassDeclaration();
- x1.bodyDeclarations().add(FD1);
- x1.bodyDeclarations().add(FD2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(ACD"+FD1S+FD2S+"ACD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testCompilationUnit() {
- CompilationUnit x1 = ast.newCompilationUnit();
- x1.setPackage(PD1);
- x1.imports().add(ID1);
- x1.imports().add(ID2);
- x1.types().add(TD1);
- x1.types().add(TD2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(CU"+PD1S+ID1S+ID2S+TD1S+TD2S+"CU)]")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // check that visiting children can be cut off
- v1.setVisitingChildren(false);
- b.setLength(0);
- x1.accept(v1);
- result = b.toString();
- assertTrue(result.equals("[(CUCU)]")); //$NON-NLS-1$
- }
- public void testConditionalExpression() {
- ConditionalExpression x1 = ast.newConditionalExpression();
- x1.setExpression(E1);
- x1.setThenExpression(E2);
- x1.setElseExpression(N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eCO"+E1S+E2S+N1S+"eCO)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testConstructorInvocation() {
- ConstructorInvocation x1 = ast.newConstructorInvocation();
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sCI"+E1S+E2S+"sCI)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testContinueStatement() {
- ContinueStatement x1 = ast.newContinueStatement();
- x1.setLabel((SimpleName) N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sCN"+N1S+"sCN)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testDoStatement() {
- DoStatement x1 = ast.newDoStatement();
- x1.setExpression(E1);
- x1.setBody(S1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sDO"+S1S+E1S+"sDO)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testEmptyStatement() {
- EmptyStatement x1 = ast.newEmptyStatement();
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sEMsEM)]")); //$NON-NLS-1$
- }
- public void testExpressionStatement() {
- ExpressionStatement x1 = ast.newExpressionStatement(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sEX"+E1S+"sEX)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testFieldAccess() {
- FieldAccess x1 = ast.newFieldAccess();
- x1.setExpression(E1);
- x1.setName(N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eFA"+E1S+N1S+"eFA)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testFieldDeclaration() {
- FieldDeclaration x1 = ast.newFieldDeclaration(W1);
- x1.setJavadoc(JD1);
- x1.setType(T1);
- x1.fragments().add(W2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(FD"+JD1S+T1S+W1S+W2S+"FD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testForStatement() {
- ForStatement x1 = ast.newForStatement();
- x1.initializers().add(E1);
- x1.initializers().add(E2);
- x1.setExpression(N1);
- x1.updaters().add(N2);
- x1.updaters().add(N3);
- x1.setBody(S1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sFR"+E1S+E2S+N1S+N2S+N3S+S1S+"sFR)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testIfStatement() {
- IfStatement x1 = ast.newIfStatement();
- x1.setExpression(E1);
- x1.setThenStatement(S1);
- x1.setElseStatement(S2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sIF"+E1S+S1S+S2S+"sIF)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testImportDeclaration() {
- ImportDeclaration x1 = ast.newImportDeclaration();
- x1.setName(N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(ID"+N1S+"ID)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testInfixExpression() {
- InfixExpression x1 = ast.newInfixExpression();
- x1.setOperator(InfixExpression.Operator.PLUS);
- x1.setLeftOperand(E1);
- x1.setRightOperand(E2);
- x1.extendedOperands().add(N1);
- x1.extendedOperands().add(N2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eIN+"+E1S+E2S+N1S+N2S+"+eIN)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testInstanceofExpression() {
- InstanceofExpression x1 = ast.newInstanceofExpression();
- x1.setLeftOperand(E1);
- x1.setRightOperand(T1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eIO"+E1S+T1S+"eIO)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testInitializer() {
- Initializer x1 = ast.newInitializer();
- x1.setJavadoc(JD1);
- x1.setBody(B1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(IN"+JD1S+B1S+"IN)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testJavadoc() {
- Javadoc x1 = ast.newJavadoc();
- x1.setComment("/**?*/"); //$NON-NLS-1$
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue("[(JD/**?*//**?*/JD)]".equals(result)); //$NON-NLS-1$
- }
-
- public void testLabeledStatement() {
- LabeledStatement x1 = ast.newLabeledStatement();
- x1.setLabel(N1);
- x1.setBody(S1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sLA"+N1S+S1S+"sLA)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testMethodDeclaration() {
- MethodDeclaration x1 = ast.newMethodDeclaration();
- x1.setJavadoc(JD1);
- x1.setReturnType(T1);
- x1.setName(N1);
- x1.parameters().add(V1);
- x1.parameters().add(V2);
- x1.thrownExceptions().add(N2);
- x1.thrownExceptions().add(N3);
- x1.setBody(B1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(MD"+JD1S+T1S+N1S+V1S+V2S+N2S+N3S+B1S+"MD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testMethodInvocation() {
- MethodInvocation x1 = ast.newMethodInvocation();
- x1.setExpression(N1);
- x1.setName(N2);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eMI"+N1S+N2S+E1S+E2S+"eMI)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testNullLiteral() {
- NullLiteral x1 = ast.newNullLiteral();
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eNLeNL)]")); //$NON-NLS-1$
- }
- public void testNumberLiteral() {
- NumberLiteral x1 = ast.newNumberLiteral("1.0"); //$NON-NLS-1$
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eNU1.01.0eNU)]")); //$NON-NLS-1$
- }
- public void testPackageDeclaration() {
- PackageDeclaration x1 = ast.newPackageDeclaration();
- x1.setName(N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(PD"+N1S+"PD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testParenthesizedExpression() {
- ParenthesizedExpression x1 = ast.newParenthesizedExpression();
- x1.setExpression(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(ePA"+E1S+"ePA)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testPostfixExpression() {
- PostfixExpression x1 = ast.newPostfixExpression();
- x1.setOperand(E1);
- x1.setOperator(PostfixExpression.Operator.INCREMENT);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(ePO++"+E1S+"++ePO)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testPrefixExpression() {
- PrefixExpression x1 = ast.newPrefixExpression();
- x1.setOperand(E1);
- x1.setOperator(PrefixExpression.Operator.INCREMENT);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(ePR++"+E1S+"++ePR)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testReturnStatement() {
- ReturnStatement x1 = ast.newReturnStatement();
- x1.setExpression(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sRT"+E1S+"sRT)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testStringLiteral() {
- StringLiteral x1 = ast.newStringLiteral();
- x1.setLiteralValue("H"); //$NON-NLS-1$
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eSLHHeSL)]")); //$NON-NLS-1$
- }
- public void testSuperConstructorInvocation() {
- SuperConstructorInvocation x1 = ast.newSuperConstructorInvocation();
- x1.setExpression(N1);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sSC"+N1S+E1S+E2S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testSuperFieldAccess() {
- SuperFieldAccess x1 = ast.newSuperFieldAccess();
- x1.setQualifier(N1);
- x1.setName(N2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eSF"+N1S+N2S+"eSF)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testSuperMethodInvocation() {
- SuperMethodInvocation x1 = ast.newSuperMethodInvocation();
- x1.setQualifier(N1);
- x1.setName(N2);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eSM"+N1S+N2S+E1S+E2S+"eSM)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testSwitchCase() {
- SwitchCase x1 = ast.newSwitchCase();
- x1.setExpression(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sSC"+E1S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testSwitchStatement() {
- SwitchStatement x1 = ast.newSwitchStatement();
- x1.setExpression(E1);
- x1.statements().add(S1);
- x1.statements().add(S2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sSW"+E1S+S1S+S2S+"sSW)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testSynchronizedStatement() {
- SynchronizedStatement x1 = ast.newSynchronizedStatement();
- x1.setExpression(E1);
- x1.setBody(B1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sSY"+E1S+B1S+"sSY)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testThisExpression() {
- ThisExpression x1 = ast.newThisExpression();
- x1.setQualifier(N1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eTH"+N1S+"eTH)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testThrowStatement() {
- ThrowStatement x1 = ast.newThrowStatement();
- x1.setExpression(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sTR"+E1S+"sTR)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testTryStatement() {
- TryStatement x1 = ast.newTryStatement();
- x1.setBody(B1);
- CatchClause c1 = ast.newCatchClause();
- c1.setException(V1);
- c1.setBody(ast.newBlock());
- x1.catchClauses().add(c1);
- CatchClause c2 = ast.newCatchClause();
- c2.setException(V2);
- c2.setBody(ast.newBlock());
- x1.catchClauses().add(c2);
- x1.setFinally(ast.newBlock());
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sTY"+B1S+"[(cc"+V1S+"[(sBsB)]"+"cc)]"+"[(cc"+V2S+"[(sBsB)]"+"cc)]"+"[(sBsB)]"+"sTY)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
- }
- public void testTypeDeclaration() {
- TypeDeclaration x1 = ast.newTypeDeclaration();
- x1.setJavadoc(JD1);
- x1.setName(N1);
- x1.setSuperclass(N2);
- x1.superInterfaces().add(N3);
- x1.superInterfaces().add(ast.newSimpleName("J")); //$NON-NLS-1$
- x1.bodyDeclarations().add(FD1);
- x1.bodyDeclarations().add(FD2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(TD"+JD1S+N1S+N2S+N3S+"[(nSJJnS)]"+FD1S+FD2S+"TD)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- public void testTypeDeclarationStatement() {
- TypeDeclarationStatement x1 = ast.newTypeDeclarationStatement(TD1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sTD"+TD1S+"sTD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testTypeLiteral() {
- TypeLiteral x1 = ast.newTypeLiteral();
- x1.setType(T1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eTL"+T1S+"eTL)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testVariableDeclaration() {
- SingleVariableDeclaration x1 = ast.newSingleVariableDeclaration();
- x1.setType(T1);
- x1.setName(N1);
- x1.setInitializer(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(VD"+T1S+N1S+E1S+"VD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testVariableSpecifier() {
- VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
- x1.setName(N1);
- x1.setInitializer(E1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(VS"+N1S+E1S+"VS)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testVariableDeclarationExpression() {
- VariableDeclarationExpression x1 = ast.newVariableDeclarationExpression(W1);
- x1.setType(T1);
- x1.fragments().add(W2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(eVD"+T1S+W1S+W2S+"eVD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testVariableDeclarationStatement() {
- VariableDeclarationStatement x1 = ast.newVariableDeclarationStatement(W1);
- x1.setType(T1);
- x1.fragments().add(W2);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sVD"+T1S+W1S+W2S+"sVD)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testWhileStatement() {
- WhileStatement x1 = ast.newWhileStatement();
- x1.setExpression(E1);
- x1.setBody(S1);
- TestVisitor v1 = new TestVisitor();
- b.setLength(0);
- x1.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[(sWH"+E1S+S1S+"sWH)]")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testPrePost() {
- SimpleName n1 = ast.newSimpleName("a"); //$NON-NLS-1$
- SimpleName n2 = ast.newSimpleName("b"); //$NON-NLS-1$
- QualifiedName q = ast.newQualifiedName(n1, n2);
- TestVisitor v1 = new TestVisitor() {
- public void preVisit(ASTNode node) {
- b.append("["); //$NON-NLS-1$
- switch (node.getNodeType()) {
- case ASTNode.QUALIFIED_NAME :
- b.append("q"); //$NON-NLS-1$
- break;
- case ASTNode.SIMPLE_NAME :
- b.append(((SimpleName) node).getIdentifier());
- break;
- }
- }
-
- public void postVisit(ASTNode node) {
- switch (node.getNodeType()) {
- case ASTNode.QUALIFIED_NAME :
- b.append("q"); //$NON-NLS-1$
- break;
- case ASTNode.SIMPLE_NAME :
- b.append(((SimpleName) node).getIdentifier());
- break;
- }
- b.append("]"); //$NON-NLS-1$
- }
- };
-
- b.setLength(0);
- q.accept(v1);
- String result = b.toString();
- assertTrue(result.equals("[q(nQ" + "[a(nSaanS)a]" + "[b(nSbbnS)b]" + "nQ)q]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- public void testTraverseAndModify() {
- final TypeDeclaration typeDeclaration = ast.newTypeDeclaration();
- typeDeclaration.setName(N1);
- MethodDeclaration methodDeclaration = ast.newMethodDeclaration();
- methodDeclaration.setName(ast.newSimpleName("M1")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(0, methodDeclaration);
- final MethodDeclaration methodDeclaration2 = ast.newMethodDeclaration();
- methodDeclaration2.setName(ast.newSimpleName("M2")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(1, methodDeclaration2);
- MethodDeclaration methodDeclaration3 = ast.newMethodDeclaration();
- methodDeclaration3.setName(ast.newSimpleName("M3")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(2, methodDeclaration3);
- // insert a new before the current node during a traverse
- TestVisitor v1 = new TestVisitor() {
- public boolean visit(MethodDeclaration node) {
- if (node == methodDeclaration2) {
- MethodDeclaration methodDeclaration4 = ast.newMethodDeclaration();
- methodDeclaration4.setName(ast.newSimpleName("M4")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(0, methodDeclaration4);
- }
- return super.visit(node);
- }
- };
- b.setLength(0);
- typeDeclaration.accept(v1);
- assertEquals("wrong output", "[(TD[(nSNNnS)][(MD[(tPvoidvoidtP)][(nSM1M1nS)]MD)][(MD[(tPvoidvoidtP)][(nSM2M2nS)]MD)][(MD[(tPvoidvoidtP)][(nSM3M3nS)]MD)]TD)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testTraverseAndModify_2() {
- final TypeDeclaration typeDeclaration = ast.newTypeDeclaration();
- typeDeclaration.setName(N1);
- MethodDeclaration methodDeclaration = ast.newMethodDeclaration();
- methodDeclaration.setName(ast.newSimpleName("M1")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(0, methodDeclaration);
- final MethodDeclaration methodDeclaration2 = ast.newMethodDeclaration();
- methodDeclaration2.setName(ast.newSimpleName("M2")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(1, methodDeclaration2);
- MethodDeclaration methodDeclaration3 = ast.newMethodDeclaration();
- methodDeclaration3.setName(ast.newSimpleName("M3")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(2, methodDeclaration3);
- // insert a new after the current node during a traverse
- TestVisitor v1 = new TestVisitor() {
- public boolean visit(MethodDeclaration node) {
- if (node == methodDeclaration2) {
- MethodDeclaration methodDeclaration4 = ast.newMethodDeclaration();
- methodDeclaration4.setName(ast.newSimpleName("M4")); //$NON-NLS-1$
- typeDeclaration.bodyDeclarations().add(3, methodDeclaration4);
- }
- return super.visit(node);
- }
- };
- b.setLength(0);
- typeDeclaration.accept(v1);
- assertEquals("wrong output", "[(TD[(nSNNnS)][(MD[(tPvoidvoidtP)][(nSM1M1nS)]MD)][(MD[(tPvoidvoidtP)][(nSM2M2nS)]MD)][(MD[(tPvoidvoidtP)][(nSM3M3nS)]MD)][(MD[(tPvoidvoidtP)][(nSM4M4nS)]MD)]TD)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testTraverseAndModify_3() {
- final InfixExpression infixExpression = ast.newInfixExpression();
- infixExpression.setLeftOperand(ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(ast.newNumberLiteral("10")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- // insert a new after the current node during a traverse
- TestVisitor v1 = new TestVisitor() {
- public boolean visit(SimpleName node) {
- infixExpression.setRightOperand(ast.newNumberLiteral("22")); //$NON-NLS-1$
- return super.visit(node);
- }
- };
- b.setLength(0);
- infixExpression.accept(v1);
- assertEquals("wrong output", "[(eIN+[(nSiinS)][(eNU2222eNU)]+eIN)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testTraverseAndModify_4() {
- final InfixExpression infixExpression = ast.newInfixExpression();
- infixExpression.setLeftOperand(ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(ast.newNumberLiteral("10")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- // insert a new before the current node during a traverse
- TestVisitor v1 = new TestVisitor() {
- public boolean visit(NumberLiteral node) {
- infixExpression.setLeftOperand(ast.newSimpleName("j")); //$NON-NLS-1$
- return super.visit(node);
- }
- };
- b.setLength(0);
- infixExpression.accept(v1);
- assertEquals("wrong output", "[(eIN+[(nSiinS)][(eNU1010eNU)]+eIN)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BindingsCollectorVisitor.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BindingsCollectorVisitor.java
deleted file mode 100644
index ce3dcd2..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BindingsCollectorVisitor.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.dom;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-
-/**
- * @author oliviert
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-class BindingsCollectorVisitor extends ASTVisitor {
-
- private HashMap hashMap;
- private HashSet set;
-
- BindingsCollectorVisitor() {
- this.hashMap = new HashMap();
- this.set = new HashSet();
- }
-
- private void collectBindings(
- ASTNode node,
- IBinding binding) {
- if (binding != null) {
- hashMap.put(node, binding);
- } else {
- set.add(node);
- }
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(AnonymousClassDeclaration)
- */
- public void endVisit(AnonymousClassDeclaration node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ArrayAccess)
- */
- public void endVisit(ArrayAccess node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ArrayCreation)
- */
- public void endVisit(ArrayCreation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ArrayInitializer)
- */
- public void endVisit(ArrayInitializer node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ArrayType)
- */
- public void endVisit(ArrayType node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(AssertStatement)
- */
- public void endVisit(AssertStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(Assignment)
- */
- public void endVisit(Assignment node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(Block)
- */
- public void endVisit(Block node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(BooleanLiteral)
- */
- public void endVisit(BooleanLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(BreakStatement)
- */
- public void endVisit(BreakStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(CastExpression)
- */
- public void endVisit(CastExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(CatchClause)
- */
- public void endVisit(CatchClause node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(CharacterLiteral)
- */
- public void endVisit(CharacterLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ClassInstanceCreation)
- */
- public void endVisit(ClassInstanceCreation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(CompilationUnit)
- */
- public void endVisit(CompilationUnit node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ConditionalExpression)
- */
- public void endVisit(ConditionalExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ConstructorInvocation)
- */
- public void endVisit(ConstructorInvocation node) {
- IMethodBinding methodBinding = node.resolveConstructorBinding();
- collectBindings(node, methodBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ContinueStatement)
- */
- public void endVisit(ContinueStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(DoStatement)
- */
- public void endVisit(DoStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(EmptyStatement)
- */
- public void endVisit(EmptyStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ExpressionStatement)
- */
- public void endVisit(ExpressionStatement node) {}
-
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(FieldAccess)
- */
- public void endVisit(FieldAccess node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(FieldDeclaration)
- */
- public void endVisit(FieldDeclaration node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ForStatement)
- */
- public void endVisit(ForStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(IfStatement)
- */
- public void endVisit(IfStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ImportDeclaration)
- */
- public void endVisit(ImportDeclaration node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(InfixExpression)
- */
- public void endVisit(InfixExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(Initializer)
- */
- public void endVisit(Initializer node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(InstanceofExpression)
- */
- public void endVisit(InstanceofExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(Javadoc)
- */
- public void endVisit(Javadoc node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(LabeledStatement)
- */
- public void endVisit(LabeledStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(MethodDeclaration)
- */
- public void endVisit(MethodDeclaration node) {
- IMethodBinding methodBinding = node.resolveBinding();
- collectBindings(node, methodBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(MethodInvocation)
- */
- public void endVisit(MethodInvocation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(NullLiteral)
- */
- public void endVisit(NullLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(NumberLiteral)
- */
- public void endVisit(NumberLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(PackageDeclaration)
- */
- public void endVisit(PackageDeclaration node) {
- IPackageBinding packageBinding = node.resolveBinding();
- collectBindings(node, packageBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ParenthesizedExpression)
- */
- public void endVisit(ParenthesizedExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(PostfixExpression)
- */
- public void endVisit(PostfixExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(PrefixExpression)
- */
- public void endVisit(PrefixExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(PrimitiveType)
- */
- public void endVisit(PrimitiveType node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(QualifiedName)
- */
- public void endVisit(QualifiedName node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ReturnStatement)
- */
- public void endVisit(ReturnStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SimpleName)
- */
- public void endVisit(SimpleName node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SimpleType)
- */
- public void endVisit(SimpleType node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SingleVariableDeclaration)
- */
- public void endVisit(SingleVariableDeclaration node) {
- IVariableBinding variableBinding = node.resolveBinding();
- collectBindings(node, variableBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(StringLiteral)
- */
- public void endVisit(StringLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SuperConstructorInvocation)
- */
- public void endVisit(SuperConstructorInvocation node) {
- IMethodBinding methodBinding = node.resolveConstructorBinding();
- collectBindings(node, methodBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SuperFieldAccess)
- */
- public void endVisit(SuperFieldAccess node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SuperMethodInvocation)
- */
- public void endVisit(SuperMethodInvocation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SwitchCase)
- */
- public void endVisit(SwitchCase node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SwitchStatement)
- */
- public void endVisit(SwitchStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(SynchronizedStatement)
- */
- public void endVisit(SynchronizedStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ThisExpression)
- */
- public void endVisit(ThisExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(ThrowStatement)
- */
- public void endVisit(ThrowStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(TryStatement)
- */
- public void endVisit(TryStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(TypeDeclaration)
- */
- public void endVisit(TypeDeclaration node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(TypeDeclarationStatement)
- */
- public void endVisit(TypeDeclarationStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(TypeLiteral)
- */
- public void endVisit(TypeLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(VariableDeclarationExpression)
- */
- public void endVisit(VariableDeclarationExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(VariableDeclarationFragment)
- */
- public void endVisit(VariableDeclarationFragment node) {
- IVariableBinding variableBinding = node.resolveBinding();
- collectBindings(node, variableBinding);
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(VariableDeclarationStatement)
- */
- public void endVisit(VariableDeclarationStatement node) {
- }
-
- /**
- * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(WhileStatement)
- */
- public void endVisit(WhileStatement node) {
- }
-
- /**
- * Returns the hashMap.
- * @return HashMap
- */
- public HashMap getBindingsMap() {
- return hashMap;
- }
-
- /**
- * Returns the set.
- * @return HashSet
- */
- public HashSet getUnresolvedNodesSet() {
- return set;
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
deleted file mode 100644
index 28efef0..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.dom;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.dom.*;
-import org.eclipse.jdt.core.tests.model.AbstractJavaModelTests;
-
-abstract class ConverterTestSetup extends AbstractJavaModelTests {
-
- protected AST ast;
-
- protected ConverterTestSetup(String name) {
- super(name);
- }
-
- protected static String getConverterJCLPath() {
- return AbstractJavaModelTests.EXTERNAL_JAR_DIR_PATH + File.separator + "converterJclMin.jar"; //$NON-NLS-1$
- }
-
- protected static String getConverterJCLSourcePath() {
- return AbstractJavaModelTests.EXTERNAL_JAR_DIR_PATH + File.separator + "converterJclMinsrc.zip"; //$NON-NLS-1$
- }
-
- protected static String getConverterJCLRootSourcePath() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Check locally for the required JCL files, jclMin.jar and jclMinsrc.zip.
- * If not available, copy from the project resources.
- */
- public void setupConverterJCL() throws IOException {
- String separator = java.io.File.separator;
- String resourceJCLDir = getPluginDirectoryPath() + separator + "JCL"; //$NON-NLS-1$
- String localJCLPath =getWorkspaceRoot().getLocation().toFile().getParentFile().getCanonicalPath();
- EXTERNAL_JAR_DIR_PATH = localJCLPath;
- java.io.File jclDir = new java.io.File(localJCLPath);
- java.io.File jclMin =
- new java.io.File(localJCLPath + separator + "converterJclMin.jar"); //$NON-NLS-1$
- java.io.File jclMinsrc = new java.io.File(localJCLPath + separator + "converterJclMinsrc.zip"); //$NON-NLS-1$
- if (!jclDir.exists()) {
- if (!jclDir.mkdir()) {
- //mkdir failed
- throw new IOException("Could not create the directory " + jclDir); //$NON-NLS-1$
- } else {
- //copy the two files to the JCL directory
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + "converterJclMin.jar"); //$NON-NLS-1$
- copy(resourceJCLMin, jclMin);
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + "converterJclMinsrc.zip"); //$NON-NLS-1$
- copy(resourceJCLMinsrc, jclMinsrc);
- }
- } else {
- //check that the two files, jclMin.jar and jclMinsrc.zip are present
- //copy either file that is missing
- if (!jclMin.exists()) {
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + "converterJclMin.jar"); //$NON-NLS-1$
- copy(resourceJCLMin, jclMin);
- }
- if (!jclMinsrc.exists()) {
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + "converterJclMinsrc.zip"); //$NON-NLS-1$
- copy(resourceJCLMinsrc, jclMinsrc);
- }
- }
- }
-
- /**
- * Reset the jar placeholder and delete project.
- */
- public void tearDownSuite() throws Exception {
- ast = null;
- this.deleteProject("Converter"); //$NON-NLS-1$
-
- super.tearDown();
- }
-
- /**
- * Create project and set the jar placeholder.
- */
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- setupConverterJCL();
- ast = new AST();
- setUpJavaProject("Converter"); //$NON-NLS-1$
- // ensure variables are set
- if (JavaCore.getClasspathVariable("ConverterJCL_LIB") == null) { //$NON-NLS-1$
- JavaCore.setClasspathVariables(
- new String[] {"CONVERTER_JCL_LIB", "CONVERTER_JCL_SRC", "CONVERTER_JCL_SRCROOT"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new Path[] {new Path(ConverterTestSetup.getConverterJCLPath()), new Path(ConverterTestSetup.getConverterJCLSourcePath()), new Path(ConverterTestSetup.getConverterJCLRootSourcePath())},
- null);
- }
- }
-
- public ASTNode runConversion(ICompilationUnit unit, boolean resolveBindings) {
- return AST.parseCompilationUnit(unit, resolveBindings);
- }
-
- public ASTNode runConversion(char[] source, String unitName, IJavaProject project) {
- return AST.parseCompilationUnit(source, unitName, project);
- }
-
-
- protected ASTNode getASTNodeToCompare(org.eclipse.jdt.core.dom.CompilationUnit unit) {
- ExpressionStatement statement = (ExpressionStatement) getASTNode(unit, 0, 0, 0);
- return (ASTNode) ((MethodInvocation) statement.getExpression()).arguments().get(0);
- }
-
- protected ASTNode getASTNode(org.eclipse.jdt.core.dom.CompilationUnit unit, int typeIndex, int bodyIndex, int statementIndex) {
- BodyDeclaration bodyDeclaration = (BodyDeclaration)((TypeDeclaration)unit.types().get(typeIndex)).bodyDeclarations().get(bodyIndex);
- if (bodyDeclaration instanceof MethodDeclaration) {
- MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- return (ASTNode) block.statements().get(statementIndex);
- } else if (bodyDeclaration instanceof TypeDeclaration) {
- TypeDeclaration typeDeclaration = (TypeDeclaration) bodyDeclaration;
- return (ASTNode) typeDeclaration.bodyDeclarations().get(statementIndex);
- }
- return null;
- }
-
- protected ASTNode getASTNode(org.eclipse.jdt.core.dom.CompilationUnit unit, int typeIndex, int bodyIndex) {
- return (ASTNode) ((TypeDeclaration)unit.types().get(typeIndex)).bodyDeclarations().get(bodyIndex);
- }
-
- protected ASTNode getASTNode(org.eclipse.jdt.core.dom.CompilationUnit unit, int typeIndex) {
- return (ASTNode) (TypeDeclaration)unit.types().get(typeIndex);
- }
-
- protected void checkSourceRange(ASTNode node, String expectedContents, char[] source) {
- assertNotNull("The node is null", node); //$NON-NLS-1$
- assertTrue("The node(" + node.getClass() + ").getLength() == 0", node.getLength() != 0); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("The node.getStartPosition() == -1", node.getStartPosition() != -1); //$NON-NLS-1$
- int length = node.getLength();
- int start = node.getStartPosition();
- char[] actualContents = new char[length];
- System.arraycopy(source, start, actualContents, 0, length);
- String actualContentsString = new String(actualContents);
- if (containsLineSeparator(actualContentsString)) {
- assertArraysEquals(actualContentsString, expectedContents);
- } else {
- assertTrue("The two strings are not equals\n---\nactualContents = >" + actualContentsString + "<\nexpectedContents = >" + expectedContents + "<\n----", expectedContents.equals(actualContentsString)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- private boolean containsLineSeparator(String s) {
- return s.indexOf("\n") != -1 || s.indexOf("\r") != -1; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void assertArraysEquals(String actualContents, String expectedContents) {
- String[] actualContentsArray = createArrayOfString(actualContents);
- String[] expectedContentsArray = createArrayOfString(expectedContents);
- assertTrue("Different size", actualContentsArray.length == expectedContentsArray.length); //$NON-NLS-1$
- for (int i = 0, max = expectedContentsArray.length; i < max; i++) {
- assertEquals("Different array parts", expectedContentsArray[i], actualContentsArray[i]); //$NON-NLS-1$
- }
- }
-
- private String[] createArrayOfString(String s) {
- StringTokenizer tokenizer = new StringTokenizer(s, "\r\n"); //$NON-NLS-1$
- ArrayList arrayList = new ArrayList();
- while (tokenizer.hasMoreElements()) {
- String nextToken = tokenizer.nextToken();
- if (nextToken.length() != 0) {
- arrayList.add(nextToken);
- }
- }
- return (String[]) arrayList.toArray(new String[arrayList.size()]);
- }
-
- protected boolean isMalformed(ASTNode node) {
- return (node.getFlags() & ASTNode.MALFORMED) != 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunAllTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunAllTests.java
deleted file mode 100644
index f5b481a..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunAllTests.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.*;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class RunAllTests extends TestCase {
-public RunAllTests(String name) {
- super(name);
-}
-public static Class[] getAllTestClasses() {
- return new Class[] {
- org.eclipse.jdt.core.tests.dom.ASTConverterTest.class,
- org.eclipse.jdt.core.tests.dom.ASTConverterTest2.class,
- org.eclipse.jdt.core.tests.dom.ASTTest.class,
- org.eclipse.jdt.core.tests.dom.ASTVisitorTest.class,
- org.eclipse.jdt.core.tests.dom.ASTMatcherTest.class
- };
-}
-public static Test suite() {
- TestSuite ts = new TestSuite(RunAllTests.class.getName());
-
- Class[] testClasses = getAllTestClasses();
- for (int i = 0; i < testClasses.length; i++) {
- Class testClass = testClasses[i];
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- }
- return ts;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
deleted file mode 100644
index 0fd7406..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.dom;
-
-import java.lang.reflect.*;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class RunConverterTests extends TestCase {
-public RunConverterTests(String name) {
- super(name);
-}
-public static Class[] getAllTestClasses() {
- return new Class[] {
- org.eclipse.jdt.core.tests.dom.ASTConverterTest.class,
- org.eclipse.jdt.core.tests.dom.ASTConverterTest2.class
- };
-}
-public static Test suite() {
- TestSuite ts = new TestSuite(RunConverterTests.class.getName());
-
- Class[] testClasses = getAllTestClasses();
- for (int i = 0; i < testClasses.length; i++) {
- Class testClass = testClasses[i];
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- }
- return ts;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
deleted file mode 100644
index ef60c36..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ /dev/null
@@ -1,922 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.*;
-import java.net.URL;
-import java.security.CodeSource;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.core.Util;
-
-public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
-
- /**
- * The java.io.File path to the directory that contains the external jars.
- */
- protected static String EXTERNAL_JAR_DIR_PATH;
-
- /**
- * Delta listener
- */
- protected class DeltaListener implements IElementChangedListener {
- /**
- * Deltas received from the java model. See
- * <code>#startDeltas</code> and
- * <code>#stopDeltas</code>.
- */
- public IJavaElementDelta[] deltas;
-
- public void elementChanged(ElementChangedEvent ev) {
- IJavaElementDelta[] copy= new IJavaElementDelta[deltas.length + 1];
- System.arraycopy(deltas, 0, copy, 0, deltas.length);
- copy[deltas.length]= ev.getDelta();
- deltas= copy;
- }
- }
- protected DeltaListener deltaListener = new DeltaListener();
-
-
-public AbstractJavaModelTests(String name) {
- super(name);
-}
-protected void addJavaNature(String projectName) throws CoreException {
- IProject project = getWorkspaceRoot().getProject(projectName);
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] {JavaCore.NATURE_ID});
- project.setDescription(description, null);
-}
-protected void assertSortedElementsEqual(String message, String expected, IJavaElement[] elements) {
- this.sortElements(elements);
- assertElementsEqual(message, expected, elements);
-}
-
-
-protected void assertResourcesEqual(String message, String expected, Object[] resources) {
- this.sortResources(resources);
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = resources.length; i < length; i++){
- buffer.append(((IResource)resources[i]).getName());
- if (i != length-1)buffer.append("\n");
- }
- if (!expected.equals(buffer.toString())) {
- System.out.println(org.eclipse.jdt.core.tests.util.Util.displayString(buffer.toString(), 2));
- }
- assertEquals(
- message,
- expected,
- buffer.toString()
- );
-}
-protected void assertElementsEqual(String message, String expected, IJavaElement[] elements) {
- StringBuffer buffer = new StringBuffer();
- if (elements != null) {
- for (int i = 0, length = elements.length; i < length; i++){
- buffer.append(elements[i].getElementName());
- if (i != length-1) buffer.append("\n");
- }
- } else {
- buffer.append("<null>");
- }
- if (!expected.equals(buffer.toString())) {
- System.out.println(org.eclipse.jdt.core.tests.util.Util.displayString(buffer.toString(), 2));
- }
- assertEquals(
- message,
- expected,
- buffer.toString()
- );
-}
-/*
- * Asserts that the given actual source (usually coming from a file content) is equal to the expected one.
- * Note that 'expected' is assumed to have the '\n' line separator.
- * The line separators in 'actual' are converted to '\n' before the comparison.
- */
-protected void assertSourceEquals(String message, String expected, String actual) {
- if (actual == null) {
- assertEquals(message, expected, null);
- return;
- }
- assertEquals(message, expected, org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(actual));
-}
-/**
- * Ensures the elements are present after creation.
- */
-public void assertCreation(IJavaElement[] newElements) {
- for (int i = 0; i < newElements.length; i++) {
- IJavaElement newElement = newElements[i];
- assertTrue("Element should be present after creation", newElement.exists());
- }
-}
-/**
- * Ensures the element is present after creation.
- */
-public void assertCreation(IJavaElement newElement) {
- assertCreation(new IJavaElement[] {newElement});
-}
-/**
- * Creates an operation to delete the given elements, asserts
- * the operation is successful, and ensures the elements are no
- * longer present in the model.
- */
-public void assertDeletion(IJavaElement[] elementsToDelete) throws JavaModelException {
- IJavaElement elementToDelete = null;
- for (int i = 0; i < elementsToDelete.length; i++) {
- elementToDelete = elementsToDelete[i];
- assertTrue("Element must be present to be deleted", elementToDelete.exists());
- }
-
- getJavaModel().delete(elementsToDelete, false, null);
-
- for (int i = 0; i < elementsToDelete.length; i++) {
- elementToDelete = elementsToDelete[i];
- assertTrue("Element should not be present after deletion: " + elementToDelete, !elementToDelete.exists());
- }
-}
-protected void assertTypesEqual(String message, String expected, IType[] types) {
- this.sortTypes(types);
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < types.length; i++){
- buffer.append(types[i].getFullyQualifiedName());
- buffer.append("\n");
- }
- if (!expected.equals(buffer.toString())) {
- System.out.println(org.eclipse.jdt.core.tests.util.Util.displayString(buffer.toString(), 2));
- }
- assertEquals(
- message,
- expected,
- buffer.toString()
- );
-}
-/**
- * Attaches a source zip to the given jar package fragment root.
- */
-protected void attachSource(IPackageFragmentRoot root, String sourcePath, String sourceRoot) throws JavaModelException {
- IJavaProject javaProject = root.getJavaProject();
- IClasspathEntry[] entries = (IClasspathEntry[])javaProject.getRawClasspath().clone();
- for (int i = 0; i < entries.length; i++){
- IClasspathEntry entry = entries[i];
- if (entry.getPath().toOSString().toLowerCase().equals(root.getPath().toOSString().toLowerCase())) {
- entries[i] = JavaCore.newLibraryEntry(
- root.getPath(),
- sourcePath == null ? null : new Path(sourcePath),
- sourceRoot == null ? null : new Path(sourceRoot),
- false);
- break;
- }
- }
- javaProject.setRawClasspath(entries, null);
-}
-/**
- * Creates an operation to delete the given element, asserts
- * the operation is successfull, and ensures the element is no
- * longer present in the model.
- */
-public void assertDeletion(IJavaElement elementToDelete) throws JavaModelException {
- assertDeletion(new IJavaElement[] {elementToDelete});
-}
-/**
- * Empties the current deltas.
- */
-public void clearDeltas() {
- this.deltaListener.deltas = new IJavaElementDelta[0];
-}
-/**
- * Copy file from src (path to the original file) to dest (path to the destination file).
- */
-public void copy(File src, File dest) throws IOException {
- // read source bytes
- byte[] srcBytes = this.read(src);
-
- // write bytes to dest
- FileOutputStream out = new FileOutputStream(dest);
- out.write(srcBytes);
- out.close();
-}
-
-/**
- * Copy the given source directory (and all its contents) to the given target directory.
- */
-protected void copyDirectory(File source, File target) throws IOException {
- if (!target.exists()) {
- target.mkdirs();
- }
- File[] files = source.listFiles();
- if (files == null) return;
- for (int i = 0; i < files.length; i++) {
- File sourceChild = files[i];
- String name = sourceChild.getName();
- if (name.equals("CVS")) continue;
- File targetChild = new File(target, name);
- if (sourceChild.isDirectory()) {
- copyDirectory(sourceChild, targetChild);
- } else {
- copy(sourceChild, targetChild);
- }
- }
-}
-
-/*
- * Creates a Java project where prj=src=bin and with JCL_LIB on its classpath.
- */
-protected IJavaProject createJavaProject(String projectName) throws CoreException {
- return this.createJavaProject(projectName, new String[] {""}, new String[] {"JCL_LIB"}, "");
-}
-/*
- * Creates a Java project with the given source folders an output location.
- * Add those on the project's classpath.
- */
-protected IJavaProject createJavaProject(String projectName, String[] sourceFolders, String output) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- null/*no lib*/,
- null/*no project*/,
- null/*no exported project*/,
- output,
- null/*no source outputs*/);
-}
-/*
- * Creates a Java project with the given source folders an output location.
- * Add those on the project's classpath.
- */
-protected IJavaProject createJavaProject(String projectName, String[] sourceFolders, String output, String[] sourceOutputs) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- null/*no lib*/,
- null/*no project*/,
- null/*no exported project*/,
- output,
- sourceOutputs);
-}
-protected IJavaProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String output) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no project*/,
- null/*no exported project*/,
- output,
- null/*no source outputs*/);
-}
-protected IJavaProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String[] projects, String projectOutput) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- projects,
- null/*no exported project*/,
- projectOutput,
- null/*no source outputs*/
- );
-}
-protected IJavaProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String[] projects, boolean[] exportedProject, String projectOutput) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- projects,
- exportedProject,
- projectOutput,
- null/*no source outputs*/
- );
-}
-protected IJavaProject createJavaProject(final String projectName, final String[] sourceFolders, final String[] libraries, final String[] projects, final boolean[] exportedProjects, final String projectOutput, final String[] sourceOutputs) throws CoreException {
- final IJavaProject[] result = new IJavaProject[1];
- IWorkspaceRunnable create = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // create project
- createProject(projectName);
-
- // set java nature
- addJavaNature(projectName);
-
- // create classpath entries
- IProject project = getWorkspaceRoot().getProject(projectName);
- IPath projectPath = project.getFullPath();
- int sourceLength = sourceFolders == null ? 0 : sourceFolders.length;
- int libLength = libraries == null ? 0 : libraries.length;
- int projectLength = projects == null ? 0 : projects.length;
- IClasspathEntry[] entries = new IClasspathEntry[sourceLength+libLength+projectLength];
- for (int i= 0; i < sourceLength; i++) {
- IPath sourcePath = new Path(sourceFolders[i]);
- int segmentCount = sourcePath.segmentCount();
- if (segmentCount > 0) {
- // create folder and its parents
- IContainer container = project;
- for (int j = 0; j < segmentCount; j++) {
- IFolder folder = container.getFolder(new Path(sourcePath.segment(j)));
- if (!folder.exists()) {
- folder.create(true, true, null);
- }
- container = folder;
- }
- }
- IPath outputPath = null;
- if (sourceOutputs != null) {
- // create out folder for source entry
- outputPath = sourceOutputs[i] == null ? null : new Path(sourceOutputs[i]);
- if (outputPath != null && outputPath.segmentCount() > 0) {
- IFolder output = project.getFolder(outputPath);
- if (!output.exists()) {
- output.create(true, true, null);
- }
- }
- }
- // create source entry
- entries[i] =
- JavaCore.newSourceEntry(
- projectPath.append(sourcePath),
- new IPath[0],
- outputPath == null ? null : projectPath.append(outputPath)
- );
- }
- for (int i= 0; i < libLength; i++) {
- String lib = libraries[i];
- if (lib.equals("JCL_LIB")) {
- // ensure JCL variables are set
- if (JavaCore.getClasspathVariable("JCL_LIB") == null) {
- JavaCore.setClasspathVariables(
- new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
- null);
- }
- }
- if (lib.equals(lib.toUpperCase())) { // all upper case is a var
- char[][] vars = CharOperation.splitOn(',', lib.toCharArray());
- entries[sourceLength+i] = JavaCore.newVariableEntry(
- new Path(new String(vars[0])),
- vars.length > 1 ? new Path(new String(vars[1])) : null,
- vars.length > 2 ? new Path(new String(vars[2])) : null);
- } else if (lib.startsWith("org.eclipse.jdt.core.tests.model.")) { // container
- entries[sourceLength+i] = JavaCore.newContainerEntry(new Path(lib));
- } else {
- IPath libPath = new Path(lib);
- if (!libPath.isAbsolute() && libPath.segmentCount() > 0 && libPath.getFileExtension() == null) {
- project.getFolder(libPath).create(true, true, null);
- libPath = projectPath.append(libPath);
- }
- entries[sourceLength+i] = JavaCore.newLibraryEntry(libPath, null, null);
- }
- }
- for (int i= 0; i < projectLength; i++) {
- boolean isExported = exportedProjects != null && exportedProjects.length > i && exportedProjects[i];
- entries[sourceLength+libLength+i] = JavaCore.newProjectEntry(new Path(projects[i]), isExported);
- }
-
- // create project's output folder
- IPath outputPath = new Path(projectOutput);
- if (outputPath.segmentCount() > 0) {
- IFolder output = project.getFolder(outputPath);
- if (!output.exists()) {
- output.create(true, true, null);
- }
- }
-
- // set classpath and output location
- IJavaProject javaProject = JavaCore.create(project);
- javaProject.setRawClasspath(entries, projectPath.append(outputPath), null);
- result[0] = javaProject;
- }
- };
- getWorkspace().run(create, null);
- return result[0];
-}
-/*
- * Create simple project.
- */
-protected IProject createProject(final String projectName) throws CoreException {
- final IProject project = getProject(projectName);
- IWorkspaceRunnable create = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
- };
- getWorkspace().run(create, null);
- return project;
-}
-public void deleteFile(File file) {
- file = file.getAbsoluteFile();
- if (!file.exists())
- return;
- if (file.isDirectory()) {
- String[] files = file.list();
- //file.list() can return null
- if (files != null) {
- for (int i = 0; i < files.length; ++i) {
- deleteFile(new File(file, files[i]));
- }
- }
- }
- boolean success = file.delete();
- int retryCount = 60; // wait 1 minute at most
- while (!success && --retryCount >= 0) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- success = file.delete();
- }
- if (success) return;
- System.err.println("Failed to delete " + file.getPath());
-}
-protected void deleteProject(String projectName) throws CoreException {
- IProject project = this.getProject(projectName);
- if (project.exists() && !project.isOpen()) { // force opening so that project can be deleted without logging (see bug 23629)
- project.open(null);
- }
- deleteResource(project);
-}
-
-/**
- * Batch deletion of projects
- */
-protected void deleteProjects(final String[] projectNames) throws CoreException {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- if (projectNames != null){
- for (int i = 0, max = projectNames.length; i < max; i++){
- if (projectNames[i] != null)
- deleteProject(projectNames[i]);
- }
- }
- }
- },
- null);
-}
-/**
- * Delete this resource.
- */
-public void deleteResource(IResource resource) throws CoreException {
- CoreException lastException = null;
- try {
- resource.delete(true, null);
- } catch (CoreException e) {
- lastException = e;
- }
- int retryCount = 60; // wait 1 minute at most
- while (resource.isAccessible() && --retryCount >= 0) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- try {
- resource.delete(true, null);
- } catch (CoreException e) {
- lastException = e;
- }
- }
- if (!resource.isAccessible()) return;
- System.err.println("Failed to delete " + resource.getFullPath());
- if (lastException != null) {
- throw lastException;
- }
-}
-/**
- * Returns true if this delta is flagged as having changed children.
- */
-protected boolean deltaChildrenChanged(IJavaElementDelta delta) {
- return delta.getKind() == IJavaElementDelta.CHANGED &&
- (delta.getFlags() & IJavaElementDelta.F_CHILDREN) != 0;
-}
-/**
- * Returns true if this delta is flagged as having had a content change
- */
-protected boolean deltaContentChanged(IJavaElementDelta delta) {
- return delta.getKind() == IJavaElementDelta.CHANGED &&
- (delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0;
-}
-/**
- * Returns true if this delta is flagged as having moved from a location
- */
-protected boolean deltaMovedFrom(IJavaElementDelta delta) {
- return delta.getKind() == IJavaElementDelta.ADDED &&
- (delta.getFlags() & IJavaElementDelta.F_MOVED_FROM) != 0;
-}
-/**
- * Returns true if this delta is flagged as having moved to a location
- */
-protected boolean deltaMovedTo(IJavaElementDelta delta) {
- return delta.getKind() == IJavaElementDelta.REMOVED &&
- (delta.getFlags() & IJavaElementDelta.F_MOVED_TO) != 0;
-}
-/**
- * Ensure that the positioned element is in the correct position within the parent.
- */
-public void ensureCorrectPositioning(IParent container, IJavaElement sibling, IJavaElement positioned) throws JavaModelException {
- IJavaElement[] children = ((IParent) container).getChildren();
- if (sibling != null) {
- // find the sibling
- boolean found = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i].equals(sibling)) {
- assertTrue("element should be before sibling", i > 0 && children[i - 1].equals(positioned));
- found = true;
- break;
- }
- }
- assertTrue("Did not find sibling", found);
- }
-}
-/**
- * Returns the specified compilation unit in the given project, root, and
- * package fragment or <code>null</code> if it does not exist.
- */
-public IClassFile getClassFile(String projectName, String rootPath, String packageName, String className) throws JavaModelException {
- IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
- if (pkg == null) {
- return null;
- } else {
- return pkg.getClassFile(className);
- }
-}
-/**
- * Returns the specified compilation unit in the given project, root, and
- * package fragment or <code>null</code> if it does not exist.
- */
-public ICompilationUnit getCompilationUnit(String projectName, String rootPath, String packageName, String cuName) throws JavaModelException {
- IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
- if (pkg == null) {
- return null;
- } else {
- return pkg.getCompilationUnit(cuName);
- }
-}
-protected ICompilationUnit getCompilationUnitFor(IJavaElement element) {
-
- if (element instanceof ICompilationUnit) {
- return (ICompilationUnit)element;
- }
-
- if (element instanceof IMember) {
- return ((IMember)element).getCompilationUnit();
- }
-
- if (element instanceof IPackageDeclaration ||
- element instanceof IImportDeclaration) {
- return (ICompilationUnit)element.getParent();
- }
-
- return null;
-
-}
-/**
- * Returns the last delta for the given element from the cached delta.
- */
-protected IJavaElementDelta getDeltaFor(IJavaElement element) {
- return getDeltaFor(element, false);
-}
-/**
- * Returns the delta for the given element from the cached delta.
- * If the boolean is true returns the first delta found.
- */
-protected IJavaElementDelta getDeltaFor(IJavaElement element, boolean returnFirst) {
- IJavaElementDelta[] deltas = this.deltaListener.deltas;
- if (deltas == null) return null;
- IJavaElementDelta result = null;
- for (int i = 0; i < deltas.length; i++) {
- IJavaElementDelta delta = searchForDelta(element, (IJavaElementDelta) this.deltaListener.deltas[i]);
- if (delta != null) {
- if (returnFirst) {
- return delta;
- } else {
- result = delta;
- }
- }
- }
- return result;
-}
-/**
- * Returns the IPath to the external java class library (e.g. jclMin.jar)
- */
-protected IPath getExternalJCLPath() {
- return new Path(getExternalJCLPathString());
-}
-/**
- * Returns the java.io path to the external java class library (e.g. jclMin.jar)
- */
-protected String getExternalJCLPathString() {
- return EXTERNAL_JAR_DIR_PATH + File.separator + "jclMin.jar";
-}
-/**
- * Returns the IPath to the root source of the external java class library (e.g. "src")
- */
-protected IPath getExternalJCLRootSourcePath() {
- return Path.EMPTY;
-}
-/**
- * Returns the IPath to the source of the external java class library (e.g. jclMinsrc.zip)
- */
-protected IPath getExternalJCLSourcePath() {
- return new Path(EXTERNAL_JAR_DIR_PATH + File.separator + "jclMinsrc.zip");
-}
-/**
- * Returns the Java Model this test suite is running on.
- */
-public IJavaModel getJavaModel() {
- return JavaCore.create(getWorkspaceRoot());
-}
-/**
- * Returns the Java Project with the given name in this test
- * suite's model. This is a convenience method.
- */
-public IJavaProject getJavaProject(String name) {
- IProject project = getProject(name);
- return JavaCore.create(project);
-}
-/**
- * Returns the specified package fragment in the given project and root, or
- * <code>null</code> if it does not exist.
- * The rootPath must be specified as a project relative path. The empty
- * path refers to the default package fragment.
- */
-public IPackageFragment getPackageFragment(String projectName, String rootPath, String packageName) throws JavaModelException {
- IPackageFragmentRoot root= getPackageFragmentRoot(projectName, rootPath);
- if (root == null) {
- return null;
- } else {
- return root.getPackageFragment(packageName);
- }
-}
-/**
- * Returns the specified package fragment root in the given project, or
- * <code>null</code> if it does not exist.
- * If relative, the rootPath must be specified as a project relative path.
- * The empty path refers to the package fragment root that is the project
- * folder iteslf.
- * If absolute, the rootPath refers to either an external jar, or a resource
- * internal to the workspace
- */
-public IPackageFragmentRoot getPackageFragmentRoot(
- String projectName,
- String rootPath)
- throws JavaModelException {
-
- IJavaProject project = getJavaProject(projectName);
- if (project == null) {
- return null;
- }
- IPath path = new Path(rootPath);
- if (path.isAbsolute()) {
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = workspaceRoot.findMember(path);
- IPackageFragmentRoot root;
- if (resource == null) {
- // external jar
- root = project.getPackageFragmentRoot(rootPath);
- } else {
- // resource in the workspace
- root = project.getPackageFragmentRoot(resource);
- }
- if (root.exists()) {
- return root;
- }
- } else {
- IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
- if (roots == null || roots.length == 0) {
- return null;
- }
- for (int i = 0; i < roots.length; i++) {
- IPackageFragmentRoot root = roots[i];
- if (!root.isExternal()
- && root.getUnderlyingResource().getProjectRelativePath().equals(path)) {
- return root;
- }
- }
- }
- return null;
-}
-protected IProject getProject(String project) {
- return getWorkspaceRoot().getProject(project);
-}
-/**
- * Returns the OS path to the directory that contains this plugin.
- */
-protected String getPluginDirectoryPath() {
- CodeSource javaCoreCodeSource = JavaCore.class.getProtectionDomain().getCodeSource();
- if (javaCoreCodeSource != null) {
- URL javaCoreUrl = javaCoreCodeSource.getLocation();
- String javaCorePath = javaCoreUrl.getFile();
- int index = javaCorePath.indexOf(JavaCore.PLUGIN_ID);
- if (index != -1) {
- String pluginsPath = javaCorePath.substring(0, index);
- File pluginsFile = new File(pluginsPath);
- String[] list = pluginsFile.list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.startsWith( "org.eclipse.jdt.core.tests.model");
- }
- });
- if (list != null && list.length > 0) {
- return pluginsPath + list[0];
- }
- }
- }
- return null;
-}
-public String getSourceWorkspacePath() {
- return getPluginDirectoryPath() + java.io.File.separator + "workspace";
-}
-/**
- * Returns the IWorkspace this test suite is running on.
- */
-public IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
-}
-public IWorkspaceRoot getWorkspaceRoot() {
- return getWorkspace().getRoot();
-}
-
-public byte[] read(java.io.File file) throws java.io.IOException {
- int fileLength;
- byte[] fileBytes = new byte[fileLength = (int) file.length()];
- java.io.FileInputStream stream = new java.io.FileInputStream(file);
- int bytesRead = 0;
- int lastReadSize = 0;
- while ((lastReadSize != -1) && (bytesRead != fileLength)) {
- lastReadSize = stream.read(fileBytes, bytesRead, fileLength - bytesRead);
- bytesRead += lastReadSize;
- }
- stream.close();
- return fileBytes;
-}
-protected void removeJavaNature(String projectName) throws CoreException {
- IProject project = this.getProject(projectName);
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] {});
- project.setDescription(description, null);
-}
-/**
- * Returns a delta for the given element in the delta tree
- */
-protected IJavaElementDelta searchForDelta(IJavaElement element, IJavaElementDelta delta) {
-
- if (delta == null) {
- return null;
- } else {
- if (delta.getElement().equals(element)) {
- return delta;
- } else {
- for (int i= 0; i < delta.getAffectedChildren().length; i++) {
- IJavaElementDelta child= searchForDelta(element, delta.getAffectedChildren()[i]);
- if (child != null) {
- return child;
- }
- }
- return null;
- }
- }
-}
-/**
- * Sets the class path of the Java project.
- */
-public void setClasspath(IJavaProject javaProject, IClasspathEntry[] classpath) {
- try {
- javaProject.setRawClasspath(classpath, null);
- } catch (JavaModelException e) {
- assertTrue("failed to set classpath", false);
- }
-}
-/**
- * Check locally for the required JCL files, jclMin.jar and jclMinsrc.zip.
- * If not available, copy from the project resources.
- */
-public void setupExternalJCL() throws IOException {
- if (EXTERNAL_JAR_DIR_PATH != null) return;
-
- String separator = java.io.File.separator;
- String resourceJCLDir = getPluginDirectoryPath() + separator + "JCL";
- String localJCLPath = getWorkspaceRoot().getLocation().toFile().getParentFile().getCanonicalPath();
- EXTERNAL_JAR_DIR_PATH = localJCLPath;
- java.io.File jclDir = new java.io.File(localJCLPath);
- java.io.File jclMin =
- new java.io.File(localJCLPath + separator + "jclMin.jar");
- java.io.File jclMinsrc = new java.io.File(localJCLPath + separator + "jclMinsrc.zip");
- if (!jclDir.exists()) {
- if (!jclDir.mkdir()) {
- //mkdir failed
- throw new IOException("Could not create the directory " + jclDir);
- } else {
- //copy the two files to the JCL directory
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + "jclMin.jar");
- copy(resourceJCLMin, jclMin);
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + "jclMinsrc.zip");
- copy(resourceJCLMinsrc, jclMinsrc);
- }
- } else {
- //check that the two files, jclMin.jar and jclMinsrc.zip are present
- //copy either file that is missing
- if (!jclMin.exists()) {
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + "jclMin.jar");
- copy(resourceJCLMin, jclMin);
- }
- if (!jclMinsrc.exists()) {
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + "jclMinsrc.zip");
- copy(resourceJCLMinsrc, jclMinsrc);
- }
- }
-}
-protected IJavaProject setUpJavaProject(final String projectName) throws CoreException, IOException {
- // copy files in project from source workspace to target workspace
- String sourceWorkspacePath = getSourceWorkspacePath();
- String targetWorkspacePath = getWorkspaceRoot().getLocation().toFile().getCanonicalPath();
- copyDirectory(new File(sourceWorkspacePath, projectName), new File(targetWorkspacePath, projectName));
-
- // ensure variables are set
- if (JavaCore.getClasspathVariable("JCL_LIB") == null) {
- JavaCore.setClasspathVariables(
- new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
- null);
- }
-
- // create project
- final IProject project = getWorkspaceRoot().getProject(projectName);
- IWorkspaceRunnable populate = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
- };
- getWorkspace().run(populate, null);
- return JavaCore.create(project);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- setupExternalJCL();
-
- // ensure autobuilding is turned off
- IWorkspaceDescription description = getWorkspace().getDescription();
- if (description.isAutoBuilding()) {
- description.setAutoBuilding(false);
- getWorkspace().setDescription(description);
- }
-}
-protected void sortElements(IJavaElement[] elements) {
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- IJavaElement elementA = (IJavaElement)a;
- IJavaElement elementB = (IJavaElement)b;
- return elementA.getElementName().compareTo(elementB.getElementName());
- }
- };
- Util.sort(elements, comparer);
-}
-protected void sortResources(Object[] resources) {
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- IResource resourceA = (IResource)a;
- IResource resourceB = (IResource)b;
- return resourceA.getName().compareTo(resourceB.getName());
- }
- };
- Util.sort(resources, comparer);
-}
-protected void sortTypes(IType[] types) {
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- IType typeA = (IType)a;
- IType typeB = (IType)b;
- return typeA.getFullyQualifiedName().compareTo(typeB.getFullyQualifiedName());
- }
- };
- Util.sort(types, comparer);
-}
-/**
- * Starts listening to element deltas, and queues them in fgDeltas.
- */
-public void startDeltas() {
- clearDeltas();
- JavaCore.addElementChangedListener(this.deltaListener);
-}
-/**
- * Stops listening to element deltas, and clears the current deltas.
- */
-public void stopDeltas() {
- JavaCore.removeElementChangedListener(this.deltaListener);
- clearDeltas();
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
deleted file mode 100644
index 1bdc7b8..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Run all java model tests.
- */
-public class AllJavaModelTests extends TestCase {
-public AllJavaModelTests(String name) {
- super(name);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite(AllJavaModelTests.class.getName());
- // Enter each test here, grouping the tests that are related
-
- // creation of method
- suite.addTest(CreateMembersTests.suite());
-
- // Java Naming convention tests
- suite.addTest(JavaConventionTests.suite());
-
- // Project & Root API unit tests
- suite.addTest(JavaProjectTests.suite());
-
- // Compilation unit tests
- suite.addTest(CompilationUnitTests.suite());
-
- // Source attachment tests
- suite.addTest(AttachSourceTests.suite());
-
- //Create type source tests
- suite.addTest(CreateTypeSourceExamplesTests.suite());
-
- //Create method source tests
- suite.addTest(CreateMethodSourceExamplesTests.suite());
-
- // Java search tests
- suite.addTest(JavaSearchTests.suite());
- suite.addTest(JavaSearchMultipleProjectsTests.suite());
- suite.addTest(WorkingCopySearchTests.suite());
- suite.addTest(SearchTests.suite());
-
- // Working copy tests
- suite.addTest(WorkingCopyTests.suite());
- suite.addTest(WorkingCopyNotInClasspathTests.suite());
- suite.addTest(HierarchyOnWorkingCopiesTests.suite());
-
- // test IJavaModel
- suite.addTest(JavaModelTests.suite());
-
- // tests to check the encoding
- suite.addTest(EncodingTests.suite());
-
- // test class name with special names like names containing '$'
- suite.addTest(ClassNameTests.suite());
-
- // IBuffer tests
- suite.addTest(BufferTests.suite());
-
- // Name lookup tests
- suite.addTest(NameLookupTests2.suite());
-
- // Classpath and output location tests
- suite.addTest(ClasspathTests.suite());
-
- // Delta tests
- suite.addTest(JavaElementDeltaTests.suite());
- suite.addTest(ExternalJarDeltaTests.suite());
-
- // Java element existence tests
- suite.addTest(ExistenceTests.suite());
-
- // Support for "open on" feature tests
- suite.addTest(ResolveTests.suite());
-
- // Support for completion tests
- suite.addTest(CompletionTests.suite());
- suite.addTest(CompletionTests2.suite());
- suite.addTest(SnippetCompletionTests.suite());
-
- // Prefix and suffix tests
- suite.addTest(NamingConventionTests.suite());
-
- // Code correction tests
- suite.addTest(CodeCorrectionTests.suite());
-
- // Options tests
- suite.addTest(OptionTests.suite());
-
- // Type hierarchy tests
- suite.addTest(TypeHierarchyTests.suite());
- suite.addTest(TypeHierarchyNotificationTests.suite());
- suite.addTest(TypeHierarchySerializationTests.suite());
-
- // Resolve type tests
- suite.addTest(TypeResolveTests.suite());
-
- // Reconciler tests
- suite.addTest(ReconcilerTests.suite());
-
- // Copy and move operation tests
- suite.addTest(CopyMoveElementsTests.suite());
- suite.addTest(CopyMoveResourcesTests.suite());
-
- // Rename tests
- suite.addTest(RenameTests.suite());
-
- // Exclusion patterns tests
- suite.addTest(ExclusionPatternsTests.suite());
-
- // Signature tests
- suite.addTest(SignatureTests.suite());
-
- // Variable initializers and container initializers tests
- suite.addTest(ClasspathInitializerTests.suite());
-
- // Java Model Factory tests
- suite.addTest(FactoryTests.suite());
-
- // Java Element persistence tests
- suite.addTest(MementoTests.suite());
-
- // Java Element sorting tests
- suite.addTest(SortCompilationUnitElementsTests.suite());
-
- // Package fragment root manipulation tests
- suite.addTest(RootManipulationsTests.suite());
-
- return suite;
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java
deleted file mode 100644
index fb2a5b4..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
-import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
-import org.eclipse.jdt.internal.core.Util;
-
-/**
- * TO DO:
- * - source attachment on external jar.
- * - don't use assertTrue where assertEquals should be used
- * - don't hardcode positions
-*/
-public class AttachSourceTests extends ModifyingResourceTests {
-
- private IPackageFragmentRoot pkgFragmentRoot;
-
-public AttachSourceTests(String name) {
- super(name);
-}
-public static Test suite() {
- return new Suite(AttachSourceTests.class);
-}
-public ASTNode runConversion(IClassFile classFile, boolean resolveBindings) {
- return AST.parseCompilationUnit(classFile, resolveBindings);
-}
-protected void setUp() throws Exception {
- super.setUp();
- this.attachSource(this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", "");
-}
-/**
- * Create project and set the jar placeholder.
- */
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- IJavaProject project = setUpJavaProject("AttachSourceTests");
- this.pkgFragmentRoot = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/attach.jar"));
-}
-protected void tearDown() throws Exception {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot[] roots = project.getAllPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- IPackageFragmentRoot root = roots[i];
- if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
- this.attachSource(root, null, null); // detach source
- }
- }
- super.tearDown();
-}
-
-/**
- * Reset the jar placeholder and delete project.
- */
-public void tearDownSuite() throws Exception {
- this.deleteProject("AttachSourceTests");
- super.tearDown();
-}
-
-/**
- * Test AST.parseCompilationUnit(IClassFile, boolean).
- */
-public void testASTParsing() throws JavaModelException {
- this.attachSource(this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", "");
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- ASTNode node = runConversion(classFile, true);
- assertNotNull("No node", node);
- this.attachSource(this.pkgFragmentRoot, null, null);
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code should no longer exist for A", cf.getSource() == null);
- try {
- node = runConversion(classFile, true);
- assertTrue("Should not be here", false);
- } catch(IllegalArgumentException e) {
- assertTrue(true);
- }
-}
-/**
- * Test AST.parseCompilationUnit(IClassFile, boolean).
- * Test for http://bugs.eclipse.org/bugs/show_bug.cgi?id=30471
- */
-public void testASTParsing2() throws JavaModelException {
- this.attachSource(this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", "");
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- ASTNode node = runConversion(classFile, false);
- assertNotNull("No node", node);
- this.attachSource(this.pkgFragmentRoot, null, null);
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code should no longer exist for A", cf.getSource() == null);
- try {
- node = runConversion(classFile, false);
- assertTrue("Should not be here", false);
- } catch(IllegalArgumentException e) {
- assertTrue(true);
- }
-}
-/**
- * Changing the source attachment file should update the java model.
- * (regression test for bug 23292 Must restart Eclipse after debug of source in .zip is updated)
- */
-public void testChangeSourceAttachmentFile() throws CoreException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IMethod method = cf.getType().getMethod("foo", new String[] {});
-
- // check initial source
- assertSourceEquals(
- "unexpected initial source for foo()",
- "public void foo() {\n" +
- " }",
- method.getSource());
-
- // replace source attachment file
- this.swapFiles("AttachSourceTests/attachsrc.zip", "AttachSourceTests/attachsrc.new.zip");
- assertSourceEquals(
- "unexpected source for foo() after replacement",
- "public void foo() {\n" +
- " System.out.println(\"foo\");\n" +
- " }",
- method.getSource());
-
- // delete source attachment file
- this.deleteFile("AttachSourceTests/attachsrc.zip");
- assertSourceEquals(
- "unexpected source for foo() after deletion",
- null,
- method.getSource());
-
- // add source attachment file back
- this.moveFile("AttachSourceTests/attachsrc.new.zip", "AttachSourceTests/attachsrc.zip");
- assertSourceEquals(
- "unexpected source for foo() after addition",
- "public void foo() {\n" +
- " }",
- method.getSource());
-}
-/**
- * Ensure that a class file with an attached source can retrieve its children given a source index.
- */
-public void testClassFileGetElementAt() throws JavaModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IJavaElement elt = null;
-
- elt = cf.getElementAt(15);
- assertTrue("should have found \"A\"",
- elt != null &&
- elt.getElementType() == IJavaElement.TYPE &&
- elt.getElementName().equals("A"));
-
- elt = cf.getElementAt(53);
- assertTrue("should have found \"public A()\"",
- elt != null &&
- elt.getElementType() == IJavaElement.METHOD &&
- elt.getElementName().equals("A"));
-
- elt = cf.getElementAt(72);
- assertTrue("should have found \"public void foo()\"",
- elt != null &&
- elt.getElementType() == IJavaElement.METHOD &&
- elt.getElementName().equals("foo"));
-}
-/**
- * Retrieves the source code for "A.class", which is
- * the entire CU for "A.java".
- */
-public void testClassRetrieval() throws JavaModelException {
- IClassFile objectCF = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code does not exist for the entire attached compilation unit", objectCF.getSource() != null);
-}
-/**
- * Removes the source attachment from the jar.
- */
-public void testDetachSource() throws JavaModelException {
- this.attachSource(this.pkgFragmentRoot, null, null);
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code should no longer exist for A", cf.getSource() == null);
- assertTrue("name range should no longer exist for A", cf.getType().getNameRange().getOffset() == -1);
- assertTrue("source range should no longer exist for A", cf.getType().getSourceRange().getOffset() == -1);
- assertTrue("Source attachment path should be null", null == this.pkgFragmentRoot.getSourceAttachmentPath());
- assertTrue("Source attachment root path should be null", null ==this.pkgFragmentRoot.getSourceAttachmentRootPath());
-}
-/**
- * Ensures that name ranges exists for BinaryMembers that have
- * mapped source.
- */
-public void testGetNameRange() throws JavaModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IMethod method = cf.getType().getMethod("foo", null);
- assertTrue("method name range not correct", method.getNameRange().getOffset() != -1 && method.getNameRange().getLength() != 0);
-
- IClassFile objectCF = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- ISourceRange range= objectCF.getType().getNameRange();
- int start, end;
- start= range.getOffset();
- end= start + range.getLength() - 1;
-
- assertTrue("source code does not exist for the entire attached compilation unit", start != -1 && end != -1);
- String source= objectCF.getSource().substring(start, end + 1);
- assertSourceEquals("name should be 'A'", "A", source);
-}
-/**
- * Retrieves the source attachment paths for jar root.
- */
-public void testGetSourceAttachmentPath() throws JavaModelException {
- IPath saPath= this.pkgFragmentRoot.getSourceAttachmentPath();
- assertEquals("Source attachment path not correct for root " + this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", saPath.toString());
- assertEquals("Source attachment root path should be empty", new Path(""), this.pkgFragmentRoot.getSourceAttachmentRootPath());
-}
-/**
- * Ensures that a source range exists for the class file that has
- * mapped source.
- */
-public void testGetSourceRange() throws JavaModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("Class file source range not correct", cf.getSourceRange().getOffset() == 0 && cf.getSourceRange().getLength() != 0);
-}
-/**
- * Ensures that a source range exists for the (inner) class file that has
- * mapped source.
- */
-public void testGetSourceRangeInnerClass() throws JavaModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A$Inner.class");
- assertTrue("Inner Class file source range not correct", cf.getSourceRange().getOffset() == 0 && cf.getSourceRange().getLength() != 0);
-}
-/**
- * Ensures that a source folder can be attached to a lib folder.
- */
-public void testLibFolder() throws JavaModelException {
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/AttachSourceTests/lib");
- this.attachSource(root, "/AttachSourceTests/srcLib", "");
-
- IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}",
- cf.getSource());
-}
-/**
- * Retrieves the source code for methods of class A.
- */
-public void testMethodRetrieval() throws JavaModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IMethod[] methods = cf.getType().getMethods();
- for (int i = 0; i < methods.length; i++) {
- IMethod method = methods[i];
- assertTrue("source code does not exist for the method " + method, method.getSource() != null);
- assertTrue("method name range not correct", method.getNameRange().getOffset() != -1 && method.getNameRange().getLength() != 0);
- }
-}
-/**
- * Closes the jar, to ensure when it is re-opened the source
- * attachment still exists.
- */
-public void testPersistence() throws JavaModelException {
- this.pkgFragmentRoot.close();
- testClassRetrieval();
- testMethodRetrieval();
-}
-/**
- * Attaches a source zip to a jar. The source zip has
- * a nested root structure and exists as a resource. Tests that
- * the attachment is persisted as a server property for the jar.
- */
-public void testRootPath() throws JavaModelException {
- IJavaProject project = getJavaProject("AttachSourceTests");
- IFile jar = (IFile) project.getProject().findMember("attach2.jar");
- IFile srcZip=(IFile) project.getProject().findMember("attach2src.zip");
- JarPackageFragmentRoot root = (JarPackageFragmentRoot) project.getPackageFragmentRoot(jar);
- root.attachSource(srcZip.getFullPath(), new Path("src/nested"), null);
-
- IClassFile cf = root.getPackageFragment("x.y").getClassFile("B.class");
- assertTrue("source code does not exist for the entire attached compilation unit", cf.getSource() != null);
- root.close();
- cf = root.getPackageFragment("x.y").getClassFile("B.class");
- assertTrue("source code does not exist for the entire attached compilation unit", cf.getSource() != null);
-
- IPath rootSAPath= root.getSourceAttachmentRootPath();
- assertEquals("Unexpected source attachment root path for " + root.getPath(), "src/nested", rootSAPath.toString());
-
- IPath saPath= root.getSourceAttachmentPath();
- assertEquals("Unexpected source attachment path for " + root.getPath(), "/AttachSourceTests/attach2src.zip", saPath.toString());
-
- root.close();
-}
-/**
- * Attaches a source zip to a jar specifying an invalid root path.
- * Ensures that the root path is just used as a hint, and that the source is still retrieved.
- */
-public void testRootPath2() throws JavaModelException {
- IJavaProject project = getJavaProject("AttachSourceTests");
- IFile jar = (IFile) project.getProject().findMember("attach2.jar");
- IFile srcZip=(IFile) project.getProject().findMember("attach2src.zip");
- JarPackageFragmentRoot root = (JarPackageFragmentRoot) project.getPackageFragmentRoot(jar);
- root.attachSource(srcZip.getFullPath(), new Path(""), null);
-
- IClassFile cf = root.getPackageFragment("x.y").getClassFile("B.class");
- assertTrue("source code does not exist for the entire attached compilation unit", cf.getSource() != null);
- root.close();
-}
-/**
- * Attaches a sa source folder can be attached to a lib folder specifying an invalid root path.
- * Ensures that the root path is just used as a hint, and that the source is still retrieved.
- */
-public void testRootPath3() throws JavaModelException {
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/AttachSourceTests/lib");
- this.attachSource(root, "/AttachSourceTests/srcLib", "invalid");
-
- IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}",
- cf.getSource());
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath4() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", "invalid");
-
- IClassFile cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath5() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/update.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", "invalid");
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath6() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/update.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath7() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/full.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that contains the source folders
- */
-public void testRootPath8() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/full.jar"));
- this.attachSource(root, "/AttachSourceTests/fullsrc.zip", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that contains the source folders
- */
-public void testRootPath9() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/full.jar"));
- this.attachSource(root, "/AttachSourceTests/fullsrc.zip", "invalid");
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that is itself
- */
-public void testRootPath10() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test2.jar"));
- this.attachSource(root, "/AttachSourceTests/test2.jar", null);
-
- IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p;\n" +
- "\n" +
- "public class X {\n" +
- "\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- "}",
- cf.getSource());
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=35965
- */
-public void testRootPath11() throws JavaModelException {
- IJavaProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test4.jar"));
- this.attachSource(root, "/AttachSourceTests/test4_src.zip", null);
-
- IClassFile cf = root.getPackageFragment("P1").getClassFile("D.class");
- assertSourceEquals(
- "Unexpected source for class file P1.D",
- "package P1;\n" +
- "\n" +
- "public class D {}",
- cf.getSource());
-
- cf = root.getPackageFragment("P1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file P1.p2.A",
- "package P1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- assertTrue("Not a binary root", root.getKind() == IPackageFragmentRoot.K_BINARY);
- assertEquals("wrong jdk level", ClassFileConstants.JDK1_2, Util.getJdkLevel(root.getResource()));
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/BufferTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/BufferTests.java
deleted file mode 100644
index f56dd9d..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/BufferTests.java
+++ /dev/null
@@ -1,514 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jdt.core.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class BufferTests extends ModifyingResourceTests implements IBufferChangedListener {
- protected BufferChangedEvent event= null;
-public BufferTests(String name) {
- super(name);
-}
-/**
- * Cache the event
- */
-public void bufferChanged(BufferChangedEvent bufferChangedEvent) {
- this.event= bufferChangedEvent;
-}
-protected IBuffer createBuffer(String path, String content) throws CoreException {
- this.createFile(path, content);
- ICompilationUnit cu = this.getCompilationUnit(path);
- IBuffer buffer = cu.getBuffer();
- buffer.addBufferChangedListener(this);
- this.event = null;
- return buffer;
-}
-protected void deleteBuffer(IBuffer buffer) throws CoreException {
- buffer.removeBufferChangedListener(this);
- IResource resource = buffer.getUnderlyingResource();
- if (resource != null) {
- deleteResource(resource);
- }
-}
-/**
- * @see RegressionTestSuite#setUpSuite()
- */
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/x/y");
- } catch (CoreException e) {
- e.printStackTrace();
- }
-}
-
-/**
- * @see TestCase#tearDownSuite()
- */
-public void tearDownSuite() throws Exception {
- super.tearDownSuite();
- this.deleteProject("P");
-}
-
-
-public static Test suite() {
- TestSuite suite = new Suite(BufferTests.class.getName());
-
- suite.addTest(new BufferTests("testAppend"));
- suite.addTest(new BufferTests("testAppendReadOnly"));
- suite.addTest(new BufferTests("testClose"));
- suite.addTest(new BufferTests("testGetChar"));
- suite.addTest(new BufferTests("testGetLength"));
- suite.addTest(new BufferTests("testGetText"));
- suite.addTest(new BufferTests("testGetUnderlyingResource"));
- suite.addTest(new BufferTests("testInsertBeginning"));
- suite.addTest(new BufferTests("testInsertMiddle"));
- suite.addTest(new BufferTests("testInsertEnd"));
- suite.addTest(new BufferTests("testReplaceBeginning"));
- suite.addTest(new BufferTests("testReplaceMiddle"));
- suite.addTest(new BufferTests("testReplaceEnd"));
- suite.addTest(new BufferTests("testDeleteBeginning"));
- suite.addTest(new BufferTests("testDeleteMiddle"));
- suite.addTest(new BufferTests("testDeleteEnd"));
-
- suite.addTest(new BufferTests("testCreateImport"));
-
- return suite;
-}
-/**
- * Tests appending to a buffer.
- */
-public void testAppend() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- int oldLength= buffer.getLength();
- buffer.append("\nclass B {}");
- assertBufferEvent(oldLength, 0, "\nclass B {}");
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "public class A {\n" +
- "}\n" +
- "class B {}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests appending to a read-only buffer.
- */
-public void testAppendReadOnly() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- buffer.getUnderlyingResource().setReadOnly(true);
- buffer.append("\nclass B {}");
- assertTrue("unexpected event", this.event == null);
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "public class A {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should not have unsaved changes", !buffer.hasUnsavedChanges());
- } finally {
- buffer.getUnderlyingResource().setReadOnly(false);
- this.deleteBuffer(buffer);
- }
-}
-public void testClose() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- buffer.close();
- assertBufferEvent(0, 0, null);
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-
-
-/**
- * Tests getting the underlying resource of a buffer.
- */
-public void testGetUnderlyingResource() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- ICompilationUnit copy = null;
- try {
- IFile file = this.getFile("P/x/y/A.java");
- assertEquals("Unexpected underlying resource", file, buffer.getUnderlyingResource());
-
- copy = (ICompilationUnit)this.getCompilationUnit("P/x/y/A.java").getWorkingCopy();
- assertEquals("Unexpected underlying resource 2", null, copy.getBuffer().getUnderlyingResource());
- } finally {
- this.deleteBuffer(buffer);
- if (copy != null) {
- copy.destroy();
- }
- }
-}
-/**
- * Tests deleting text at the beginning of a buffer.
- */
-public void testDeleteBeginning() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- buffer.replace(0, 13, "");
- assertBufferEvent(0, 13, null);
- assertSourceEquals(
- "unexpected buffer contents",
- "public class A {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests deleting text in the middle of a buffer.
- */
-public void testDeleteMiddle() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- // delete "public "
- buffer.replace(13, 7, "");
- assertBufferEvent(13, 7, null);
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "class A {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests deleting text at the end of a buffer.
- */
-public void testDeleteEnd() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- // delete "public class A {\n}"
- buffer.replace(13, 18, "");
- assertBufferEvent(13, 18, null);
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests the buffer char retrieval via source position
- */
-public void testGetChar() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- assertEquals("Unexpected char at position 17", 'i', buffer.getChar(17));
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests the buffer getLength()
- */
-public void testGetLength() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- assertEquals("Unexpected length", 31, buffer.getLength());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests the buffer text retrieval via source position
- */
-public void testGetText() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- assertSourceEquals("Unexpected text (1)", "p", buffer.getText(0, 1));
- assertSourceEquals("Unexpected text (2)", "public", buffer.getText(13, 6));
- assertSourceEquals("Unexpected text (3)", "", buffer.getText(10, 0));
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests inserting text at the beginning of a buffer.
- */
-public void testInsertBeginning() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- buffer.replace(0, 0, "/* copyright mycompany */\n");
- assertBufferEvent(0, 0, "/* copyright mycompany */\n");
- assertSourceEquals(
- "unexpected buffer contents",
- "/* copyright mycompany */\n" +
- "package x.y;\n" +
- "public class A {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests replacing text at the beginning of a buffer.
- */
-public void testReplaceBeginning() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- buffer.replace(0, 13, "package other;\n");
- assertBufferEvent(0, 13, "package other;\n");
- assertSourceEquals(
- "unexpected buffer contents",
- "package other;\n" +
- "public class A {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests replacing text in the middle of a buffer.
- */
-public void testReplaceMiddle() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- // replace "public class A" after the \n of package statement
- buffer.replace(13, 14, "public class B");
- assertBufferEvent(13, 14, "public class B");
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "public class B {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests replacing text at the end of a buffer.
- */
-public void testReplaceEnd() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- // replace "}" at the end of cu with "}\n"
- int end = buffer.getLength();
- buffer.replace(end-1, 1, "}\n");
- assertBufferEvent(end-1, 1, "}\n");
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "public class A {\n" +
- "}\n",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests inserting text in the middle of a buffer.
- */
-public void testInsertMiddle() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- // insert after the \n of package statement
- buffer.replace(13, 0, "/* class comment */\n");
- assertBufferEvent(13, 0, "/* class comment */\n");
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "/* class comment */\n" +
- "public class A {\n" +
- "}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-/**
- * Tests inserting text at the end of a buffer.
- */
-public void testInsertEnd() throws CoreException {
- IBuffer buffer = this.createBuffer(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- try {
- // insert after the \n of package statement
- int end = buffer.getLength();
- buffer.replace(end, 0, "\nclass B {}");
- assertBufferEvent(end, 0, "\nclass B {}");
- assertSourceEquals(
- "unexpected buffer contents",
- "package x.y;\n" +
- "public class A {\n" +
- "}\n" +
- "class B {}",
- buffer.getContents()
- );
- assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
-}
-
-/**
- * Tests replacing text within a buffer using a create import
- * (regression test for PR #1G7A0WI).
- */
-public void testCreateImport() throws CoreException {
- IFile file = this.createFile(
- "P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}"
- );
- ICompilationUnit copy = null;
- IBuffer buffer = null;
- try {
- copy = (ICompilationUnit)this.getCompilationUnit("P/x/y/A.java").getWorkingCopy();
- buffer = copy.getBuffer();
- buffer.addBufferChangedListener(this);
- copy.createImport("java.io.IOException", null, null);
- assertBufferEvent(13, 0, "import java.io.IOException;" + "\n"); // A.java has a \n line delimiter
- } finally {
- if (buffer != null) {
- buffer.removeBufferChangedListener(this);
- }
- if (copy != null) {
- copy.destroy();
- }
- deleteResource(file);
- }
-}
-/**
- * Verify the buffer changed event.
- * The given text must contain '\n' line separators.
- */
-protected void assertBufferEvent(int offset, int length, String text) {
- assertTrue("event should not be null", this.event != null);
- assertEquals("unexpected offset", offset, this.event.getOffset());
- assertEquals("unexpected length", length, this.event.getLength());
- if (text == null) {
- assertTrue("text should be null", this.event.getText() == null);
- } else {
- assertSourceEquals("unexpected text", text, this.event.getText());
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java
deleted file mode 100644
index d6601a4..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java
+++ /dev/null
@@ -1,957 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-/**
- * Test retrieving types by their name.
- */
-public class ClassNameTests extends ModifyingResourceTests {
-
-
- public ClassNameTests(String name) {
- super(name);
- }
-
- /**
- * Tests that a type in a jar with a name ending with $ can be retrieved.
- */
- public void testClassNameWithDollar() throws JavaModelException, CoreException {
- try {
- byte[] tab = new byte[372];
- tab[0]=80;
- tab[1]=75;
- tab[2]=3;
- tab[3]=4;
- tab[4]=20;
- tab[5]=0;
- tab[6]=8;
- tab[7]=0;
- tab[8]=8;
- tab[9]=0;
- tab[10]=-63;
- tab[11]=88;
- tab[12]=-102;
- tab[13]=44;
- tab[14]=0;
- tab[15]=0;
- tab[16]=0;
- tab[17]=0;
- tab[18]=0;
- tab[19]=0;
- tab[20]=0;
- tab[21]=0;
- tab[22]=0;
- tab[23]=0;
- tab[24]=0;
- tab[25]=0;
- tab[26]=11;
- tab[27]=0;
- tab[28]=0;
- tab[29]=0;
- tab[30]=112;
- tab[31]=49;
- tab[32]=47;
- tab[33]=65;
- tab[34]=36;
- tab[35]=46;
- tab[36]=99;
- tab[37]=108;
- tab[38]=97;
- tab[39]=115;
- tab[40]=115;
- tab[41]=93;
- tab[42]=78;
- tab[43]=-63;
- tab[44]=74;
- tab[45]=-61;
- tab[46]=64;
- tab[47]=16;
- tab[48]=125;
- tab[49]=-45;
- tab[50]=77;
- tab[51]=-78;
- tab[52]=53;
- tab[53]=86;
- tab[54]=91;
- tab[55]=99;
- tab[56]=127;
- tab[57]=64;
- tab[58]=-24;
- tab[59]=-95;
- tab[60]=21;
- tab[61]=106;
- tab[62]=-16;
- tab[63]=-84;
- tab[64]=8;
- tab[65]=-91;
- tab[66]=-48;
- tab[67]=83;
- tab[68]=48;
- tab[69]=-121;
- tab[70]=74;
- tab[71]=-17;
- tab[72]=-101;
- tab[73]=-72;
- tab[74]=-42;
- tab[75]=45;
- tab[76]=49;
- tab[77]=43;
- tab[78]=49;
- tab[79]=-11;
- tab[80]=-69;
- tab[81]=-12;
- tab[82]=84;
- tab[83]=-16;
- tab[84]=-32;
- tab[85]=7;
- tab[86]=-8;
- tab[87]=81;
- tab[88]=-30;
- tab[89]=108;
- tab[90]=12;
- tab[91]=42;
- tab[92]=-50;
- tab[93]=-31;
- tab[94]=61;
- tab[95]=102;
- tab[96]=-26;
- tab[97]=-67;
- tab[98]=121;
- tab[99]=-13;
- tab[100]=-15;
- tab[101]=-7;
- tab[102]=-10;
- tab[103]=14;
- tab[104]=-127;
- tab[105]=41;
- tab[106]=-122;
- tab[107]=4;
- tab[108]=-1;
- tab[109]=-15;
- tab[110]=60;
- tab[111]=-98;
- tab[112]=-115;
- tab[113]=36;
- tab[114]=-120;
- tab[115]=48;
- tab[116]=-40;
- tab[117]=-88;
- tab[118]=103;
- tab[119]=21;
- tab[120]=23;
- tab[121]=-86;
- tab[122]=92;
- tab[123]=-57;
- tab[124]=105;
- tab[125]=-74;
- tab[126]=-47;
- tab[127]=121;
- tab[128]=45;
- tab[129]=33;
- tab[130]=8;
- tab[131]=-63;
- tab[132]=-91;
- tab[133]=41;
- tab[134]=77;
- tab[135]=125;
- tab[136]=69;
- tab[137]=16;
- tab[138]=-29;
- tab[139]=-55;
- tab[140]=-118;
- tab[141]=-32;
- tab[142]=-51;
- tab[143]=-19;
- tab[144]=-83;
- tab[145]=-18;
- tab[146]=-63;
- tab[147]=71;
- tab[148]=16;
- tab[149]=-62;
- tab[150]=67;
- tab[151]=-105;
- tab[152]=-48;
- tab[153]=79;
- tab[154]=76;
- tab[155]=-87;
- tab[156]=-81;
- tab[157]=-73;
- tab[158]=15;
- tab[159]=-103;
- tab[160]=-82;
- tab[161]=110;
- tab[162]=84;
- tab[163]=86;
- tab[164]=104;
- tab[165]=66;
- tab[166]=-108;
- tab[167]=-40;
- tab[168]=92;
- tab[169]=21;
- tab[170]=43;
- tab[171]=85;
- tab[172]=25;
- tab[173]=-41;
- tab[174]=-73;
- tab[175]=67;
- tab[176]=-81;
- tab[177]=-66;
- tab[178]=55;
- tab[179]=79;
- tab[180]=4;
- tab[181]=-103;
- tab[182]=52;
- tab[183]=121;
- tab[184]=23;
- tab[185]=124;
- tab[186]=-18;
- tab[187]=-50;
- tab[188]=90;
- tab[189]=-62;
- tab[190]=112;
- tab[191]=60;
- tab[192]=73;
- tab[193]=126;
- tab[194]=99;
- tab[195]=-105;
- tab[196]=117;
- tab[197]=101;
- tab[198]=-54;
- tab[199]=-75;
- tab[200]=91;
- tab[201]=46;
- tab[202]=-46;
- tab[203]=-76;
- tab[204]=-117;
- tab[205]=1;
- tab[206]=33;
- tab[207]=92;
- tab[208]=-38;
- tab[209]=109;
- tab[210]=-107;
- tab[211]=-21;
- tab[212]=-123;
- tab[213]=113;
- tab[214]=55;
- tab[215]=-28;
- tab[216]=108;
- tab[217]=116;
- tab[218]=-26;
- tab[219]=-60;
- tab[220]=56;
- tab[221]=65;
- tab[222]=-121;
- tab[223]=-61;
- tab[224]=93;
- tab[225]=117;
- tab[226]=64;
- tab[227]=-18;
- tab[228]=23;
- tab[229]=70;
- tab[230]=-55;
- tab[231]=93;
- tab[232]=-52;
- tab[233]=76;
- tab[234]=-52;
- tab[235]=-2;
- tab[236]=-23;
- tab[237]=14;
- tab[238]=123;
- tab[239]=-81;
- tab[240]=-51;
- tab[241]=58;
- tab[242]=100;
- tab[243]=12;
- tab[244]=-102;
- tab[245]=-95;
- tab[246]=-64;
- tab[247]=62;
- tab[248]=99;
- tab[249]=-17;
- tab[250]=91;
- tab[251]=-64;
- tab[252]=124;
- tab[253]=-64;
- tab[254]=76;
- tab[255]=56;
- tab[256]=68;
- tab[257]=-65;
- tab[258]=53;
- tab[259]=79;
- tab[260]=91;
- tab[261]=-77;
- tab[262]=-120;
- tab[263]=-114;
- tab[264]=94;
- tab[265]=-2;
- tab[266]=89;
- tab[267]=-125;
- tab[268]=63;
- tab[269]=86;
- tab[270]=-15;
- tab[271]=99;
- tab[272]=-115;
- tab[273]=26;
- tab[274]=-43;
- tab[275]=-15;
- tab[276]=23;
- tab[277]=80;
- tab[278]=75;
- tab[279]=7;
- tab[280]=8;
- tab[281]=122;
- tab[282]=-92;
- tab[283]=103;
- tab[284]=15;
- tab[285]=-20;
- tab[286]=0;
- tab[287]=0;
- tab[288]=0;
- tab[289]=78;
- tab[290]=1;
- tab[291]=0;
- tab[292]=0;
- tab[293]=80;
- tab[294]=75;
- tab[295]=1;
- tab[296]=2;
- tab[297]=20;
- tab[298]=0;
- tab[299]=20;
- tab[300]=0;
- tab[301]=8;
- tab[302]=0;
- tab[303]=8;
- tab[304]=0;
- tab[305]=-63;
- tab[306]=88;
- tab[307]=-102;
- tab[308]=44;
- tab[309]=122;
- tab[310]=-92;
- tab[311]=103;
- tab[312]=15;
- tab[313]=-20;
- tab[314]=0;
- tab[315]=0;
- tab[316]=0;
- tab[317]=78;
- tab[318]=1;
- tab[319]=0;
- tab[320]=0;
- tab[321]=11;
- tab[322]=0;
- tab[323]=0;
- tab[324]=0;
- tab[325]=0;
- tab[326]=0;
- tab[327]=0;
- tab[328]=0;
- tab[329]=0;
- tab[330]=0;
- tab[331]=0;
- tab[332]=0;
- tab[333]=0;
- tab[334]=0;
- tab[335]=0;
- tab[336]=0;
- tab[337]=0;
- tab[338]=0;
- tab[339]=112;
- tab[340]=49;
- tab[341]=47;
- tab[342]=65;
- tab[343]=36;
- tab[344]=46;
- tab[345]=99;
- tab[346]=108;
- tab[347]=97;
- tab[348]=115;
- tab[349]=115;
- tab[350]=80;
- tab[351]=75;
- tab[352]=5;
- tab[353]=6;
- tab[354]=0;
- tab[355]=0;
- tab[356]=0;
- tab[357]=0;
- tab[358]=1;
- tab[359]=0;
- tab[360]=1;
- tab[361]=0;
- tab[362]=57;
- tab[363]=0;
- tab[364]=0;
- tab[365]=0;
- tab[366]=37;
- tab[367]=1;
- tab[368]=0;
- tab[369]=0;
- tab[370]=0;
- tab[371]=0;
- IJavaProject javaProject = createJavaProject("P", new String[] {"src"}, "bin");
- IFile jarFile = createFile("P/lib.jar", tab);
- javaProject.setRawClasspath(new IClasspathEntry[] {JavaCore.newLibraryEntry(jarFile.getFullPath(), null, null, false)}, new NullProgressMonitor());
- javaProject.findType("p1.A$");
- } catch (CoreException e) {
- e.printStackTrace();
- assertTrue(false);
- } finally {
- deleteProject("P");
- }
- }
- /**
- * Tests that a member type can be retrived using a dot qualified name.
- */
- public void testFindTypeWithDot() throws JavaModelException, CoreException {
- try {
- IJavaProject javaProject = createJavaProject("P", new String[] {""}, "");
- this.createFolder("/P/p");
- this.createFile(
- "/P/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- " public class Y {\n" +
- " }\n" +
- "}"
- );
- IType type = javaProject.findType("p.X.Y");
- assertEquals(
- "Unexpected type found",
- "class Y [in X [in X.java [in p [in [project root] [in P]]]]]",
- type == null ? "null" : type.toString()
- );
- } finally {
- deleteProject("P");
- }
- }
-
- /**
- * Tests that a type in a jar with a name ending with $ can be retrieved.
- */
- public void testSearchTypeNameInJars() throws JavaModelException, CoreException {
- try {
- byte[] tab = new byte[478];
- tab[0]=80;
- tab[1]=75;
- tab[2]=3;
- tab[3]=4;
- tab[4]=20;
- tab[5]=0;
- tab[6]=8;
- tab[7]=0;
- tab[8]=8;
- tab[9]=0;
- tab[10]=19;
- tab[11]=87;
- tab[12]=-95;
- tab[13]=44;
- tab[14]=0;
- tab[15]=0;
- tab[16]=0;
- tab[17]=0;
- tab[18]=0;
- tab[19]=0;
- tab[20]=0;
- tab[21]=0;
- tab[22]=0;
- tab[23]=0;
- tab[24]=0;
- tab[25]=0;
- tab[26]=9;
- tab[27]=0;
- tab[28]=0;
- tab[29]=0;
- tab[30]=112;
- tab[31]=49;
- tab[32]=47;
- tab[33]=112;
- tab[34]=50;
- tab[35]=47;
- tab[36]=112;
- tab[37]=51;
- tab[38]=47;
- tab[39]=3;
- tab[40]=0;
- tab[41]=80;
- tab[42]=75;
- tab[43]=7;
- tab[44]=8;
- tab[45]=0;
- tab[46]=0;
- tab[47]=0;
- tab[48]=0;
- tab[49]=2;
- tab[50]=0;
- tab[51]=0;
- tab[52]=0;
- tab[53]=0;
- tab[54]=0;
- tab[55]=0;
- tab[56]=0;
- tab[57]=80;
- tab[58]=75;
- tab[59]=3;
- tab[60]=4;
- tab[61]=20;
- tab[62]=0;
- tab[63]=8;
- tab[64]=0;
- tab[65]=8;
- tab[66]=0;
- tab[67]=19;
- tab[68]=87;
- tab[69]=-95;
- tab[70]=44;
- tab[71]=0;
- tab[72]=0;
- tab[73]=0;
- tab[74]=0;
- tab[75]=0;
- tab[76]=0;
- tab[77]=0;
- tab[78]=0;
- tab[79]=0;
- tab[80]=0;
- tab[81]=0;
- tab[82]=0;
- tab[83]=16;
- tab[84]=0;
- tab[85]=0;
- tab[86]=0;
- tab[87]=112;
- tab[88]=49;
- tab[89]=47;
- tab[90]=112;
- tab[91]=50;
- tab[92]=47;
- tab[93]=112;
- tab[94]=51;
- tab[95]=47;
- tab[96]=88;
- tab[97]=46;
- tab[98]=99;
- tab[99]=108;
- tab[100]=97;
- tab[101]=115;
- tab[102]=115;
- tab[103]=93;
- tab[104]=79;
- tab[105]=-53;
- tab[106]=78;
- tab[107]=-61;
- tab[108]=64;
- tab[109]=12;
- tab[110]=28;
- tab[111]=55;
- tab[112]=-81;
- tab[113]=-110;
- tab[114]=6;
- tab[115]=8;
- tab[116]=-3;
- tab[117]=3;
- tab[118]=110;
- tab[119]=60;
- tab[120]=-44;
- tab[121]=-82;
- tab[122]=10;
- tab[123]=71;
- tab[124]=16;
- tab[125]=23;
- tab[126]=36;
- tab[127]=78;
- tab[128]=81;
- tab[129]=57;
- tab[130]=20;
- tab[131]=69;
- tab[132]=-67;
- tab[133]=110;
- tab[134]=-62;
- tab[135]=-74;
- tab[136]=108;
- tab[137]=-107;
- tab[138]=102;
- tab[139]=-93;
- tab[140]=52;
- tab[141]=-27;
- tab[142]=-65;
- tab[143]=56;
- tab[144]=33;
- tab[145]=113;
- tab[146]=-32;
- tab[147]=3;
- tab[148]=-8;
- tab[149]=40;
- tab[150]=-124;
- tab[151]=55;
- tab[152]=-115;
- tab[153]=0;
- tab[154]=117;
- tab[155]=37;
- tab[156]=-49;
- tab[157]=-56;
- tab[158]=-10;
- tab[159]=-116;
- tab[160]=-19;
- tab[161]=-3;
- tab[162]=-6;
- tab[163]=-2;
- tab[164]=-8;
- tab[165]=-124;
- tab[166]=-125;
- tab[167]=17;
- tab[168]=78;
- tab[169]=8;
- tab[170]=97;
- tab[171]=53;
- tab[172]=17;
- tab[173]=-43;
- tab[174]=-107;
- tab[175]=-88;
- tab[176]=-82;
- tab[177]=-59;
- tab[178]=60;
- tab[179]=0;
- tab[180]=17;
- tab[181]=-30;
- tab[182]=-107;
- tab[183]=124;
- tab[184]=-107;
- tab[185]=-94;
- tab[186]=-112;
- tab[187]=-27;
- tab[188]=82;
- tab[189]=60;
- tab[190]=102;
- tab[191]=43;
- tab[192]=-107;
- tab[193]=55;
- tab[194]=1;
- tab[195]=28;
- tab[196]=-126;
- tab[197]=127;
- tab[198]=-85;
- tab[199]=75;
- tab[200]=-35;
- tab[201]=-36;
- tab[202]=17;
- tab[203]=-100;
- tab[204]=-77;
- tab[205]=-13;
- tab[206]=-108;
- tab[207]=-32;
- tab[208]=-34;
- tab[209]=-101;
- tab[210]=103;
- tab[211]=21;
- tab[212]=-63;
- tab[213]=-125;
- tab[214]=31;
- tab[215]=-62;
- tab[216]=69;
- tab[217]=-97;
- tab[218]=112;
- tab[219]=-100;
- tab[220]=-24;
- tab[221]=82;
- tab[222]=77;
- tab[223]=-73;
- tab[224]=-21;
- tab[225]=76;
- tab[226]=-43;
- tab[227]=79;
- tab[228]=50;
- tab[229]=43;
- tab[230]=20;
- tab[231]=97;
- tab[232]=-104;
- tab[233]=-104;
- tab[234]=92;
- tab[235]=22;
- tab[236]=-87;
- tab[237]=-84;
- tab[238]=-75;
- tab[239]=-51;
- tab[240]=-69;
- tab[241]=-94;
- tab[242]=-37;
- tab[243]=-68;
- tab[244]=-24;
- tab[245]=13;
- tab[246]=33;
- tab[247]=74;
- tab[248]=-2;
- tab[249]=-106;
- tab[250]=-34;
- tab[251]=-16;
- tab[252]=-52;
- tab[253]=-123;
- tab[254]=49;
- tab[255]=124;
- tab[256]=-56;
- tab[257]=-52;
- tab[258]=108;
- tab[259]=-21;
- tab[260]=92;
- tab[261]=61;
- tab[262]=104;
- tab[263]=43;
- tab[264]=-12;
- tab[265]=-25;
- tab[266]=99;
- tab[267]=123;
- tab[268]=7;
- tab[269]=78;
- tab[270]=-47;
- tab[271]=-29;
- tab[272]=5;
- tab[273]=-10;
- tab[274]=-11;
- tab[275]=64;
- tab[276]=118;
- tab[277]=31;
- tab[278]=99;
- tab[279]=-64;
- tab[280]=-103;
- tab[281]=96;
- tab[282]=38;
- tab[283]=102;
- tab[284]=-17;
- tab[285]=-30;
- tab[286]=29;
- tab[287]=7;
- tab[288]=111;
- tab[289]=109;
- tab[290]=59;
- tab[291]=100;
- tab[292]=-12;
- tab[293]=-37;
- tab[294]=-94;
- tab[295]=-125;
- tab[296]=1;
- tab[297]=99;
- tab[298]=-76;
- tab[299]=19;
- tab[300]=48;
- tab[301]=31;
- tab[302]=-74;
- tab[303]=3;
- tab[304]=-114;
- tab[305]=126;
- tab[306]=-51;
- tab[307]=-105;
- tab[308]=28;
- tab[309]=-74;
- tab[310]=71;
- tab[311]=-5;
- tab[312]=70;
- tab[313]=-9;
- tab[314]=-97;
- tab[315]=-111;
- tab[316]=58;
- tab[317]=35;
- tab[318]=-1;
- tab[319]=-83;
- tab[320]=85;
- tab[321]=-59;
- tab[322]=63;
- tab[323]=80;
- tab[324]=75;
- tab[325]=7;
- tab[326]=8;
- tab[327]=-99;
- tab[328]=105;
- tab[329]=77;
- tab[330]=-38;
- tab[331]=-36;
- tab[332]=0;
- tab[333]=0;
- tab[334]=0;
- tab[335]=53;
- tab[336]=1;
- tab[337]=0;
- tab[338]=0;
- tab[339]=80;
- tab[340]=75;
- tab[341]=1;
- tab[342]=2;
- tab[343]=20;
- tab[344]=0;
- tab[345]=20;
- tab[346]=0;
- tab[347]=8;
- tab[348]=0;
- tab[349]=8;
- tab[350]=0;
- tab[351]=19;
- tab[352]=87;
- tab[353]=-95;
- tab[354]=44;
- tab[355]=0;
- tab[356]=0;
- tab[357]=0;
- tab[358]=0;
- tab[359]=2;
- tab[360]=0;
- tab[361]=0;
- tab[362]=0;
- tab[363]=0;
- tab[364]=0;
- tab[365]=0;
- tab[366]=0;
- tab[367]=9;
- tab[368]=0;
- tab[369]=0;
- tab[370]=0;
- tab[371]=0;
- tab[372]=0;
- tab[373]=0;
- tab[374]=0;
- tab[375]=0;
- tab[376]=0;
- tab[377]=0;
- tab[378]=0;
- tab[379]=0;
- tab[380]=0;
- tab[381]=0;
- tab[382]=0;
- tab[383]=0;
- tab[384]=0;
- tab[385]=112;
- tab[386]=49;
- tab[387]=47;
- tab[388]=112;
- tab[389]=50;
- tab[390]=47;
- tab[391]=112;
- tab[392]=51;
- tab[393]=47;
- tab[394]=80;
- tab[395]=75;
- tab[396]=1;
- tab[397]=2;
- tab[398]=20;
- tab[399]=0;
- tab[400]=20;
- tab[401]=0;
- tab[402]=8;
- tab[403]=0;
- tab[404]=8;
- tab[405]=0;
- tab[406]=19;
- tab[407]=87;
- tab[408]=-95;
- tab[409]=44;
- tab[410]=-99;
- tab[411]=105;
- tab[412]=77;
- tab[413]=-38;
- tab[414]=-36;
- tab[415]=0;
- tab[416]=0;
- tab[417]=0;
- tab[418]=53;
- tab[419]=1;
- tab[420]=0;
- tab[421]=0;
- tab[422]=16;
- tab[423]=0;
- tab[424]=0;
- tab[425]=0;
- tab[426]=0;
- tab[427]=0;
- tab[428]=0;
- tab[429]=0;
- tab[430]=0;
- tab[431]=0;
- tab[432]=0;
- tab[433]=0;
- tab[434]=0;
- tab[435]=0;
- tab[436]=57;
- tab[437]=0;
- tab[438]=0;
- tab[439]=0;
- tab[440]=112;
- tab[441]=49;
- tab[442]=47;
- tab[443]=112;
- tab[444]=50;
- tab[445]=47;
- tab[446]=112;
- tab[447]=51;
- tab[448]=47;
- tab[449]=88;
- tab[450]=46;
- tab[451]=99;
- tab[452]=108;
- tab[453]=97;
- tab[454]=115;
- tab[455]=115;
- tab[456]=80;
- tab[457]=75;
- tab[458]=5;
- tab[459]=6;
- tab[460]=0;
- tab[461]=0;
- tab[462]=0;
- tab[463]=0;
- tab[464]=2;
- tab[465]=0;
- tab[466]=2;
- tab[467]=0;
- tab[468]=117;
- tab[469]=0;
- tab[470]=0;
- tab[471]=0;
- tab[472]=83;
- tab[473]=1;
- tab[474]=0;
- tab[475]=0;
- tab[476]=0;
- tab[477]=0;
- IJavaProject javaProject = createJavaProject("P1", new String[] {"src"}, "bin");
- IFile jarFile = createFile("P1/lib.jar", tab);
- javaProject.setRawClasspath(new IClasspathEntry[] {JavaCore.newLibraryEntry(jarFile.getFullPath(), null, null, false)}, new NullProgressMonitor());
- assertNotNull(javaProject.findType("p1.p2.p3.X"));
- } catch(JavaModelException e) {
- e.printStackTrace();
- assertTrue(false);
- } catch (CoreException e) {
- e.printStackTrace();
- assertTrue(false);
- } finally {
- deleteProject("P1");
- }
- }
-
- public static Test suite() {
- TestSuite suite = new Suite(ClassNameTests.class.getName());
- suite.addTest(new ClassNameTests("testClassNameWithDollar"));
- suite.addTest(new ClassNameTests("testFindTypeWithDot"));
- suite.addTest(new ClassNameTests("testSearchTypeNameInJars"));
- return suite;
- }
-
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java
deleted file mode 100644
index a5e368a..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java
+++ /dev/null
@@ -1,505 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.JavaProject;
-
-import junit.framework.Test;
-
-/*
- * Test variable initializers and container initializers.
- */
-public class ClasspathInitializerTests extends ModifyingResourceTests {
-
-public static class DefaultVariableInitializer implements VariablesInitializer.ITestInitializer {
- Map variableValues;
-
- /*
- * values is [<var name>, <var value>]*
- */
- public DefaultVariableInitializer(String[] values) throws JavaModelException {
- variableValues = new HashMap();
- for (int i = 0; i < values.length; i+=2) {
- variableValues.put(values[i], new Path(values[i+1]));
- }
- }
-
- public void initialize(String variable) throws JavaModelException {
- if (variableValues == null) return;
- JavaCore.setClasspathVariable(
- variable,
- (IPath)variableValues.get(variable),
- null);
- }
-}
-
-public static class DefaultContainerInitializer implements ContainerInitializer.ITestInitializer {
-
- Map containerValues;
- CoreException exception;
-
- /*
- * values is [<project name>, <lib path>[,<lib path>]* ]*
- */
- public DefaultContainerInitializer(String[] values) throws JavaModelException {
- containerValues = new HashMap();
- for (int i = 0; i < values.length; i+=2) {
- final String projectName = values[i];
- final char[][] libPaths = CharOperation.splitOn(',', values[i+1].toCharArray());
- containerValues.put(
- projectName,
- new IClasspathContainer() {
- public IClasspathEntry[] getClasspathEntries() {
- int length = libPaths.length;
- IClasspathEntry[] entries = new IClasspathEntry[length];
- for (int j = 0; j < length; j++) {
- entries[j] = JavaCore.newLibraryEntry(new Path(new String(libPaths[j])), null, null);
- }
- return entries;
- }
- public String getDescription() {
- return "Test container";
- }
- public int getKind() {
- return IClasspathContainer.K_APPLICATION;
- }
- public IPath getPath() {
- return new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER");
- }
- }
- );
- }
- }
- public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
- if (containerValues == null) return;
- try {
- JavaCore.setClasspathContainer(
- containerPath,
- new IJavaProject[] {project},
- new IClasspathContainer[] {(IClasspathContainer)containerValues.get(project.getElementName())},
- null);
- } catch (CoreException e) {
- this.exception = e;
- throw e;
- }
- }
-}
-// Simple container initializer, which keeps setting container to null
-// (30920 - stackoverflow when setting container to null)
-public class NullContainerInitializer implements ContainerInitializer.ITestInitializer {
- public boolean hasRun = false;
- public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
- hasRun = true;
- JavaCore.setClasspathContainer(
- containerPath,
- new IJavaProject[] {project},
- new IClasspathContainer[] { null },
- null);
- }
-}
-
-public ClasspathInitializerTests(String name) {
- super(name);
-}
-
-public void testContainerInitializer1() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}));
- IJavaProject p2 = this.createJavaProject(
- "P2",
- new String[] {},
- new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
- "");
- IPackageFragmentRoot root = p2.getPackageFragmentRoot(this.getFile("/P1/lib.jar"));
- assertTrue("/P1/lib.jar should exist", root.exists());
- } finally {
- stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-public void testContainerInitializer2() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}));
- IJavaProject p2 = this.createJavaProject(
- "P2",
- new String[] {},
- new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
- "");
-
- // simulate state on startup (flush containers, and preserve their previous values)
- JavaModelManager.PreviousSessionContainers = JavaModelManager.Containers;
- JavaModelManager.Containers = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)p2);
- p2.close();
-
- startDeltas();
- p2.getResolvedClasspath(true);
-
- assertDeltas(
- "Unexpected delta on startup",
- ""
- );
- } finally {
- stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-public void testContainerInitializer3() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}));
- IJavaProject p2 = this.createJavaProject(
- "P2",
- new String[] {},
- new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
- "");
-
- // change value of TEST_CONTAINER
- this.createFile("/P1/lib2.jar", "");
- ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib2.jar"}));
-
- // simulate state on startup (flush containers, and preserve their previous values)
- JavaModelManager.PreviousSessionContainers = JavaModelManager.Containers;
- JavaModelManager.Containers = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)p2);
- p2.close();
-
- startDeltas();
- p2.getResolvedClasspath(true);
-
- assertDeltas(
- "Unexpected delta on startup",
- "P2[*]: {CHILDREN}\n" +
- " /P1/lib.jar[*]: {REMOVED FROM CLASSPATH}\n" +
- " /P1/lib2.jar[*]: {ADDED TO CLASSPATH}"
- );
- } finally {
- stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/* Ensure that initializer is not callled when resource tree is locked.
- * (regression test for bug 29585 Core Exception as resource tree is locked initializing classpath container)
- */
-public void testContainerInitializer4() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- DefaultContainerInitializer initializer = new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"});
- ContainerInitializer.setInitializer(initializer);
- IJavaProject p2 = this.createJavaProject(
- "P2",
- new String[] {""},
- new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
- "");
-
- // simulate state on startup (flush containers, and preserve their previous values)
- JavaModelManager.PreviousSessionContainers = JavaModelManager.Containers;
- JavaModelManager.Containers = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)p2);
- p2.close();
-
- startDeltas();
- this.createFile("/P2/X.java", "public class X {}");
-
- assertEquals("Should not get exception", null, initializer.exception);
-
- assertDeltas(
- "Unexpected delta on startup",
- "P2[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}"
- );
- } finally {
- stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * 30920 - Stack overflow when container resolved to null
- */
-public void testContainerInitializer5() throws CoreException {
- try {
- NullContainerInitializer nullInitializer = new NullContainerInitializer();
- ContainerInitializer.setInitializer(nullInitializer);
- IJavaProject p1 = this.createJavaProject(
- "P1",
- new String[] {""},
- new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
- "");
-
- // simulate state on startup (flush containers, and preserve their previous values)
- JavaModelManager.PreviousSessionContainers = JavaModelManager.Containers;
- JavaModelManager.Containers = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)p1);
- p1.close();
-
- startDeltas();
-
- // will trigger classpath resolution (with null container value)
- this.createFile("/P1/X.java", "public class X {}");
- assertDeltas(
- "Unexpected delta on startup",
- "P1[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}"
- );
- assertTrue("initializer did not run", nullInitializer.hasRun);
-
- // next cp resolution request will rerun the initializer
- nullInitializer.hasRun = false; // reset
- p1.getResolvedClasspath(true);
- assertTrue("initializer did not run", nullInitializer.hasRun); // initializer should have run again (since keep setting to null)
-
- // assigning new (non-null) value to container
- this.createFile("/P1/lib.jar", "");
- ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"}));
- p1.getResolvedClasspath(true);
- assertDeltas(
- "Unexpected delta after setting container",
- "P1[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}\n" +
- "\n" +
- "P1[*]: {CONTENT}\n" +
- " ResourceDelta(/P1/lib.jar)[+]"
- );
-
- } catch (StackOverflowError e) {
- e.printStackTrace();
- assertTrue("stack overflow assigning container", false);
- } finally {
- stopDeltas();
- this.deleteProject("P1");
- }
-}
-public static Test suite() {
- return new Suite(ClasspathInitializerTests.class);
-}
-protected void tearDown() throws Exception {
- // Cleanup caches
- JavaModelManager.Containers = new HashMap(5);
- JavaModelManager.Variables = new HashMap(5);
-
- super.tearDown();
-}
-
-public void testVariableInitializer1() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P1/lib.jar"}));
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB"}, "");
- IPackageFragmentRoot root = p2.getPackageFragmentRoot(this.getFile("/P1/lib.jar"));
- assertTrue("/P1/lib.jar should exist", root.exists());
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- VariablesInitializer.reset();
- }
-}
-public void testVariableInitializer2() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- this.createFile("/P1/src.zip", "");
- VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {
- "TEST_LIB", "/P1/lib.jar",
- "TEST_SRC", "/P1/src.zip",
- "TEST_ROOT", "src",
- }));
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}, "");
- IPackageFragmentRoot root = p2.getPackageFragmentRoot(this.getFile("/P1/lib.jar"));
- assertEquals("Unexpected source attachment path", "/P1/src.zip", root.getSourceAttachmentPath().toString());
- assertEquals("Unexpected source attachment root path", "src", root.getSourceAttachmentRootPath().toString());
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- VariablesInitializer.reset();
- }
-}
-public void testVariableInitializer3() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- this.createFile("/P1/src.zip", "");
- VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {
- "TEST_LIB", "/P1/lib.jar",
- "TEST_SRC", "/P1/src.zip",
- "TEST_ROOT", "src",
- }));
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}, "");
-
- // simulate state on startup (flush variables, and preserve their previous values)
- JavaModelManager.PreviousSessionVariables = JavaModelManager.Variables;
- JavaModelManager.Variables = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)p2);
- p2.close();
-
- startDeltas();
- //JavaModelManager.CP_RESOLVE_VERBOSE=true;
- p2.getResolvedClasspath(true);
-
- assertDeltas(
- "Unexpected delta on startup",
- ""
- );
- } finally {
- //JavaModelManager.CP_RESOLVE_VERBOSE=false;
- stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- VariablesInitializer.reset();
- }
-}
-public void testVariableInitializer4() throws CoreException {
- try {
- final StringBuffer buffer = new StringBuffer();
- VariablesInitializer.setInitializer(new VariablesInitializer.ITestInitializer() {
- public void initialize(String variable) throws JavaModelException {
- buffer.append("Initializing " + variable + "\n");
- IPath path = new Path(variable.toLowerCase());
- buffer.append("Setting variable " + variable + " to " + path + "\n");
- JavaCore.setClasspathVariable(variable, path, null);
- }
- });
- this.createJavaProject("P", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}, "");
- assertEquals(
- "Initializing TEST_LIB\n" +
- "Setting variable TEST_LIB to test_lib\n",
- buffer.toString());
- } finally {
- this.deleteProject("P");
- VariablesInitializer.reset();
- }
-}
-public void testVariableInitializer5() throws CoreException {
- try {
- final StringBuffer buffer = new StringBuffer();
- VariablesInitializer.setInitializer(new VariablesInitializer.ITestInitializer() {
- public void initialize(String variable) throws JavaModelException {
- buffer.append("Initializing " + variable + "\n");
- IPath path = new Path(variable.toLowerCase());
- JavaCore.getClasspathVariable("TEST_SRC");
- buffer.append("Setting variable " + variable + " to " + path + "\n");
- JavaCore.setClasspathVariable(variable, path, null);
- }
- });
- this.createJavaProject("P", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}, "");
- assertEquals(
- "Initializing TEST_LIB\n" +
- "Initializing TEST_SRC\n" +
- "Setting variable TEST_SRC to test_src\n" +
- "Setting variable TEST_LIB to test_lib\n",
- buffer.toString());
- } finally {
- this.deleteProject("P");
- VariablesInitializer.reset();
- }
-}
-/*
- * Ensures that if the initializer doesn't initialize a variable, it can be
- * initialized later on.
- */
-public void testVariableInitializer6() throws CoreException {
- try {
- final StringBuffer buffer = new StringBuffer();
- VariablesInitializer.setInitializer(new VariablesInitializer.ITestInitializer() {
- public void initialize(String variable) throws JavaModelException {
- // do nothing
- buffer.append("Ignoring request to initialize");
- }
- });
- IPath path = JavaCore.getClasspathVariable("TEST_SRC");
- assertEquals(
- "Unexpected value of TEST_SRC after initializer was called",
- null,
- path);
- IPath varValue = new Path("src.zip");
- JavaCore.setClasspathVariable("TEST_SRC", varValue, null);
- path = JavaCore.getClasspathVariable("TEST_SRC");
- assertEquals(
- "Unexpected value of TEST_SRC after setting it",
- varValue,
- path);
- } finally {
- VariablesInitializer.reset();
- }
-}
-public void testVariableInitializer7() throws CoreException {
- try {
- this.createProject("P1");
- this.createFile("/P1/lib.jar", "");
- this.createFile("/P1/src.zip", "");
- VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {
- "TEST_LIB", "/P1/lib.jar",
- "TEST_SRC", "/P1/src.zip",
- "TEST_ROOT", "src",
- }));
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, new String[] {"TEST_LIB,TEST_SRC,TEST_ROOT"}, "");
-
- // change value of TEST_LIB
- this.createFile("/P1/lib2.jar", "");
- VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {
- "TEST_LIB", "/P1/lib2.jar",
- "TEST_SRC", "/P1/src.zip",
- "TEST_ROOT", "src",
- }));
-
- // simulate state on startup (flush variables, and preserve their previous values)
- JavaModelManager.PreviousSessionVariables = JavaModelManager.Variables;
- JavaModelManager.Variables = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)p2);
- p2.close();
-
- startDeltas();
- //JavaModelManager.CP_RESOLVE_VERBOSE=true;
- p2.getResolvedClasspath(true);
-
- assertDeltas(
- "Unexpected delta on startup",
- "P2[*]: {CHILDREN}\n" +
- " /P1/lib.jar[*]: {REMOVED FROM CLASSPATH}\n" +
- " /P1/lib2.jar[*]: {ADDED TO CLASSPATH}"
- );
- } finally {
- //JavaModelManager.CP_RESOLVE_VERBOSE=false;
- stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- VariablesInitializer.reset();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
deleted file mode 100644
index 5863431..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
+++ /dev/null
@@ -1,2413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.JavaProject;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class ClasspathTests extends ModifyingResourceTests {
-
- public class TestContainer implements IClasspathContainer {
- IPath path;
- IClasspathEntry[] entries;
- TestContainer(IPath path, IClasspathEntry[] entries){
- this.path = path;
- this.entries = entries;
- }
- public IPath getPath() { return this.path; }
- public IClasspathEntry[] getClasspathEntries() { return this.entries; }
- public String getDescription() { return this.path.toString(); }
- public int getKind() { return 0; }
- };
-
-public ClasspathTests(String name) {
- super(name);
-}
-protected void assertCycleMarkers(IJavaProject project, IJavaProject[] p, int[] expectedCycleParticipants) throws CoreException {
- StringBuffer expected = new StringBuffer("{");
- int expectedCount = 0;
- StringBuffer computed = new StringBuffer("{");
- int computedCount = 0;
- for (int j = 0; j < p.length; j++){
- int markerCount = this.numberOfCycleMarkers(p[j]);
- if (markerCount > 0){
- if (computedCount++ > 0) computed.append(", ");
- computed.append(p[j].getElementName());
- //computed.append(" (" + markerCount + ")");
- }
- markerCount = expectedCycleParticipants[j];
- if (markerCount > 0){
- if (expectedCount++ > 0) expected.append(", ");
- expected.append(p[j].getElementName());
- //expected.append(" (" + markerCount + ")");
- }
- }
- expected.append("}");
- computed.append("}");
- assertEquals("Invalid cycle detection after setting classpath for: "+project.getElementName(), expected.toString(), computed.toString());
-}
-protected void assertMarkers(String message, String expectedMarkers, IJavaProject project) throws CoreException {
- IMarker[] markers = project.getProject().findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
- this.sortMarkers(markers);
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = markers.length; i < length; i++) {
- IMarker marker = markers[i];
- buffer.append(marker.getAttribute(IMarker.MESSAGE));
- if (i != length-1) {
- buffer.append("\n");
- }
- }
- String actual = buffer.toString();
- if (!expectedMarkers.equals(actual)) {
- System.out.println(Util.displayString(actual, 2));
- }
- assertEquals(message, expectedMarkers, actual);
-}
-protected File createFile(File parent, String name, String content) throws IOException {
- File file = new File(parent, name);
- FileOutputStream out = new FileOutputStream(file);
- out.write(content.getBytes());
- out.close();
- /*
- * Need to change the time stamp to realize that the file has been modified
- */
- file.setLastModified(System.currentTimeMillis() + 2000);
- return file;
-}
-protected File createFolder(File parent, String name) throws IOException {
- File file = new File(parent, name);
- file.mkdirs();
- return file;
-}
-protected int numberOfCycleMarkers(IJavaProject javaProject) throws CoreException {
- IMarker[] markers = javaProject.getProject().findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
- int result = 0;
- for (int i = 0, length = markers.length; i < length; i++) {
- IMarker marker = markers[i];
- String cycleAttr = (String)marker.getAttribute(IJavaModelMarker.CYCLE_DETECTED);
- if (cycleAttr != null && cycleAttr.equals("true")){ //$NON-NLS-1$
- result++;
- }
- }
- return result;
-}
-
-protected void sortMarkers(IMarker[] markers) {
- org.eclipse.jdt.internal.core.Util.Comparer comparer = new org.eclipse.jdt.internal.core.Util.Comparer() {
- public int compare(Object a, Object b) {
- IMarker markerA = (IMarker)a;
- IMarker markerB = (IMarker)b;
- return markerA.getAttribute(IMarker.MESSAGE, "").compareTo(markerB.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- };
- org.eclipse.jdt.internal.core.Util.sort(markers, comparer);
-}
-public static Test suite() {
-
- if (false){
- TestSuite suite = new Suite(ClasspathTests.class.getName());
- suite.addTest(new ClasspathTests("testNoCycleDetection2"));
- return suite;
- }
- return new Suite(ClasspathTests.class);
-}
-/**
- * Add an entry to the classpath for a non-existent root. Then create
- * the root and ensure that it comes alive.
- */
-public void testClasspathAddRoot() throws CoreException {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP= project.getRawClasspath();
-
- try {
- IClasspathEntry newEntry= JavaCore.newSourceEntry(project.getProject().getFullPath().append("extra"));
-
- IClasspathEntry[] newCP= new IClasspathEntry[originalCP.length + 1];
- System.arraycopy(originalCP, 0 , newCP, 0, originalCP.length);
- newCP[originalCP.length]= newEntry;
-
- project.setRawClasspath(newCP, null);
-
-
- // now create the actual resource for the root and populate it
- project.getProject().getFolder("extra").create(false, true, null);
-
- IPackageFragmentRoot newRoot= getPackageFragmentRoot("P", "extra");
- assertTrue("New root should now be visible", newRoot != null);
- } finally {
- // cleanup
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that the reordering external resources in the classpath
- * generates the correct deltas.
- */
-public void testClasspathChangeExternalResources() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
-
- IClasspathEntry[] newEntries = new IClasspathEntry[2];
- newEntries[0] = JavaCore.newLibraryEntry(getExternalJCLPath(), null, null, false);
- newEntries[1] = JavaCore.newLibraryEntry(getExternalJCLSourcePath(), null, null, false);
- setClasspath(proj, newEntries);
- startDeltas();
- IClasspathEntry[] swappedEntries = new IClasspathEntry[2];
- swappedEntries[0] = newEntries[1];
- swappedEntries[1] = newEntries[0];
- setClasspath(proj, swappedEntries);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " " + getExternalJCLPath().toString() + "[*]: {REORDERED}\n" +
- " " + getExternalJCLSourcePath().toString() + "[*]: {REORDERED}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Test classpath corruption (23977)
- */
-public void testClasspathCorruption() throws CoreException {
- try {
- JavaProject p1 = (JavaProject)this.createJavaProject("P1", new String[]{""}, new String[]{}, new String[]{}, "");
- this.createJavaProject("P2", new String[]{""}, new String[]{}, new String[]{}, "");
- this.createFile("P2/foo.txt", "not a project");
- String newCPContent =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n"
- +"<classpath> \n"
- +" <classpathentry kind=\"src\" path=\"\"/> \n"
- +" <classpathentry kind=\"src\" path=\"/P2/foo.txt\"/> \n" // corruption here: target isn't a project
- +" <classpathentry kind=\"output\" path=\"\"/> \n"
- +"</classpath> \n";
-
- IFile fileRsc = p1.getProject().getFile(JavaProject.CLASSPATH_FILENAME);
- fileRsc.setContents(new ByteArrayInputStream(newCPContent.getBytes()), true, false, null);
-/*
- File file = p1.getProject().getFile(JavaProject.CLASSPATH_FILENAME).getLocation().toFile();
- if (file.exists()){
- char[] classpath = Util.getFileCharContent(file, "UTF-8");
- System.out.println(new String(classpath));
- }
-*/
- p1.close();
- JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(p1.getProject(), true/*create if missing*/);
- perProjectInfo.classpath = null;
- perProjectInfo.lastResolvedClasspath = null;
-
- // shouldn't fail
- p1.getExpandedClasspath(true, true);
-
- // if could reach that far, then all is fine
-
- } catch(ClassCastException e){
- assertTrue("internal ClassCastException on corrupted classpath file", false);
- } finally {
- // cleanup
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-
-/**
- * Ensures that the setting the classpath with a library entry
- * changes the kind of the root from K_SOURCE to K_BINARY.
- */
-public void testClasspathCreateLibraryEntry() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile("P/src/X.java", "public class X {}");
- this.createFile("P/src/X.class", "");
-
- IFolder rootFolder = proj.getProject().getFolder(new Path("src"));
- IPackageFragmentRoot root = proj.getPackageFragmentRoot(rootFolder);
-
- assertEquals(
- "Unexpected root kind 1",
- IPackageFragmentRoot.K_SOURCE,
- root.getKind());
- IPackageFragment pkg = root.getPackageFragment("");
- assertEquals(
- "Unexpected numbers of compilation units",
- 1,
- pkg.getCompilationUnits().length);
- assertEquals(
- "Unexpected numbers of .class files",
- 0,
- pkg.getClassFiles().length);
-
- this.setClasspath(
- proj,
- new IClasspathEntry[] {
- JavaCore.newLibraryEntry(rootFolder.getFullPath(), null, null, false)
- });
- assertEquals(
- "Unexpected root kind 2",
- IPackageFragmentRoot.K_BINARY,
- root.getKind());
- assertEquals(
- "Unexpected numbers of compilation units",
- 0,
- pkg.getCompilationUnits().length);
- assertEquals(
- "Unexpected numbers of .class files",
- 1,
- pkg.getClassFiles().length);
-
- //ensure that the new kind has been persisted in the classpath file
- proj.close();
- assertEquals(
- "Unexpected root kind 3",
- IPackageFragmentRoot.K_BINARY,
- root.getKind());
-
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that the setting the classpath with a new library entry for a
- * local jar works and generates the correct deltas.
- */
-public void testClasspathCreateLocalJarLibraryEntry() throws CoreException {
- IJavaProject proj = this.createJavaProject("P", new String[] {""}, "");
- IPackageFragmentRoot root = getPackageFragmentRoot("P", "");
- IClasspathEntry newEntry= JavaCore.newLibraryEntry(getExternalJCLPath(), null, null, false);
- IClasspathEntry[] newEntries= new IClasspathEntry[]{newEntry};
- IPackageFragmentRoot newRoot= proj.getPackageFragmentRoot(getExternalJCLPathString());
-
- startDeltas();
-
- setClasspath(proj,newEntries);
-
- try {
- assertTrue(
- "should be one delta with 2 grand-children - removed & added",
- this.deltaListener.deltas.length == 1 &&
- this.deltaListener.deltas[0].getAffectedChildren().length == 1 &&
- this.deltaListener.deltas[0].getAffectedChildren()[0].getAffectedChildren().length == 2);
- IJavaElementDelta d= null;
- assertTrue("root should be removed from classpath",(d= getDeltaFor(root, true)) != null &&
- (d.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0);
-
-
- assertTrue("root should be added to classpath", (d= getDeltaFor(newRoot, true)) != null &&
- (d.getFlags() & IJavaElementDelta.F_ADDED_TO_CLASSPATH) > 0);
- } finally {
- stopDeltas();
-
- this.deleteProject("P");
- }
-}
-
-/**
- * Tests the cross project classpath setting
- */
-public void testClasspathCrossProject() throws CoreException {
- IJavaProject project = this.createJavaProject("P1", new String[] {""}, "");
- this.createJavaProject("P2", new String[] {}, "");
- try {
- startDeltas();
- IPackageFragmentRoot oldRoot= getPackageFragmentRoot("P1", "");
- IClasspathEntry projectEntry= JavaCore.newProjectEntry(new Path("/P2"), false);
- IClasspathEntry[] newClasspath= new IClasspathEntry[]{projectEntry};
- project.setRawClasspath(newClasspath, null);
- project.getAllPackageFragmentRoots();
- IJavaElementDelta removedDelta= getDeltaFor(oldRoot, true);
- assertTrue("Deltas not correct for crossproject classpath setting",
- this.deltaListener.deltas.length == 1 &&
- this.deltaListener.deltas[0].getAffectedChildren().length == 1 &&
- removedDelta.getElement().equals(oldRoot) &&
- removedDelta.getKind() == IJavaElementDelta.CHANGED &&
- (removedDelta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0
- );
- } finally {
- stopDeltas();
- this.deleteProjects(new String[] {"P1", "P2"});
- }
-}
-/**
- * Delete a root and ensure the classpath is not updated (i.e. entry isn't removed).
- */
-public void testClasspathDeleteNestedRoot() throws CoreException {
- IJavaProject project = this.createJavaProject("P", new String[] {"nested/src"}, new String[] {getExternalJCLPathString()}, "bin");
- IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src");
- IClasspathEntry[] originalCP= project.getRawClasspath();
-
- // delete the root
- deleteResource(root.getUnderlyingResource());
-
- IClasspathEntry[] newCP= project.getRawClasspath();
-
- try {
- // should still be an entry for the "src" folder
- assertTrue("classpath should not have been updated",
- newCP.length == 2 &&
- newCP[0].equals(originalCP[0]) &&
- newCP[1].equals(originalCP[1]));
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Test classpath diamond (23979)
- */
-public void testClasspathDiamond() throws CoreException {
- try {
- this.createJavaProject("P1", new String[]{""}, "");
- this.createJavaProject("P2", new String[]{""}, new String[]{}, new String[]{"/P1"}, "");
- this.createJavaProject("P3", new String[]{""}, new String[]{}, new String[]{"/P1", "/P2"}, "");
- IJavaProject p4 = this.createJavaProject("P4", new String[]{""}, new String[]{}, new String[]{"/P2", "/P3"}, "");
-
- assertTrue("Should not detect cycle", !p4.hasClasspathCycle(null));
-
- } finally {
- // cleanup
- this.deleteProjects(new String[] {"P1", "P2", "P3", "P4"});
- }
-}
-
-/**
- * Delete a nested root's parent folder and ensure the classpath is
- * not updated (i.e. entry isn't removed).
- */
-public void testClasspathDeleteNestedRootParent() throws CoreException {
- IJavaProject project = this.createJavaProject("P", new String[] {"nested/src"}, new String[] {getExternalJCLPathString()}, "bin");
- IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src");
- IClasspathEntry[] originalCP= project.getRawClasspath();
-
- // delete the root's parent folder
- IFolder folder= (IFolder)root.getUnderlyingResource().getParent();
- deleteResource(folder);
-
- IClasspathEntry[] newCP= project.getRawClasspath();
-
- try {
-
- // should still be an entry for the "src" folder
- assertTrue("classpath should not have been updated",
- newCP.length == 2 &&
- newCP[0].equals(originalCP[0]) &&
- newCP[1].equals(originalCP[1]));
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Test that a classpath entry for an external jar is externalized
- * properly.
- */
-public void testClasspathExternalize() throws CoreException {
- try {
- IJavaProject project= this.createJavaProject("P", new String[] {}, new String[] {getExternalJCLPathString()}, "");
- IClasspathEntry[] classpath= project.getRawClasspath();
- IClasspathEntry jar= null;
- for (int i= 0; i < classpath.length; i++) {
- if (classpath[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
- jar= classpath[i];
- break;
- }
- }
- project.close();
- project.open(null);
-
- classpath= project.getRawClasspath();
- for (int i= 0; i < classpath.length; i++) {
- if (classpath[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
- assertTrue("Paths must be the same", classpath[i].getPath().equals(jar.getPath()));
- break;
- }
- }
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Move a root and ensure the classpath is not updated (i.e. entry not renamed).
- */
-public void testClasspathMoveNestedRoot() throws CoreException {
- IJavaProject project = this.createJavaProject("P", new String[] {"nested/src"}, new String[] {getExternalJCLPathString()}, "bin");
- IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src");
- IClasspathEntry[] originalCP= project.getRawClasspath();
-
- // delete the root
- IFolder folder= (IFolder)root.getUnderlyingResource();
- IPath originalPath= folder.getFullPath();
- IPath newPath= originalPath.removeLastSegments(1);
- newPath= newPath.append(new Path("newsrc"));
-
- startDeltas();
-
- folder.move(newPath, true, null);
-
- IClasspathEntry[] newCP= project.getRawClasspath();
-
- IPackageFragmentRoot newRoot= project.getPackageFragmentRoot(project.getProject().getFolder("nested").getFolder("newsrc"));
-
- try {
- // entry for the "src" folder wasn't replaced
- assertTrue("classpath not automatically updated", newCP.length == 2 &&
- newCP[1].equals(originalCP[1]) &&
- newCP[0].equals(originalCP[0]));
-
- IJavaElementDelta rootDelta = getDeltaFor(root, true);
- IJavaElementDelta projectDelta = getDeltaFor(newRoot.getParent(), true);
- assertTrue("should get delta for moved root", rootDelta != null &&
- rootDelta.getKind() == IJavaElementDelta.REMOVED &&
- rootDelta.getFlags() == 0);
- assertTrue("should get delta indicating content changed for project", this.deltaContentChanged(projectDelta));
-
- } finally {
- stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/**
- * Move a parent of a nested root and ensure the classpath is not updated (i.e. entry not renamed).
- */
-public void testClasspathMoveNestedRootParent() throws CoreException {
- try {
- IJavaProject project =this.createJavaProject("P", new String[] {"nested/src"}, new String[] {getExternalJCLPathString()}, "bin");
- IPackageFragmentRoot root= getPackageFragmentRoot("P", "nested/src");
- IClasspathEntry[] originalCP= project.getRawClasspath();
-
- // delete the root
- IFolder folder= (IFolder)root.getUnderlyingResource().getParent();
- IPath originalPath= folder.getFullPath();
- IPath newPath= originalPath.removeLastSegments(1);
- newPath= newPath.append(new Path("newsrc"));
- folder.move(newPath, true, null);
-
- IClasspathEntry[] newCP= project.getRawClasspath();
-
- // entry for the "src" folder wasn't replaced
- // entry for the "src" folder should not be replaced
- assertTrue("classpath should not automatically be updated", newCP.length == 2 &&
- newCP[1].equals(originalCP[1]) &&
- newCP[0].equals(originalCP[0]));
-
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Tests that nothing occurs when setting to the same classpath
- */
-public void testClasspathNoChanges() throws CoreException {
- try {
- IJavaProject p = this.createJavaProject("P", new String[] {""}, "");
- IClasspathEntry[] oldClasspath= p.getRawClasspath();
- startDeltas();
- p.setRawClasspath(oldClasspath, null);
-
-
-// try {
-// java.io.File file = p.getProject().getFile(JavaProject.CLASSPATH_FILENAME).getLocation().toFile();
-// if (file.exists()){
-// char[] classpath = org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(file, "UTF-8");
-// System.out.println(new String(classpath));
-// }
-// } catch(java.io.IOException e){
-// }
-
- StringBuffer buffer = new StringBuffer(10);
- for (int i = 0; i < this.deltaListener.deltas.length; i++){
- buffer.append(this.deltaListener.deltas[i].toString()).append('\n');
- }
- assertEquals("No deltas should be generated for the same classpath", "", buffer.toString());
- } finally {
- stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that the setting the classpath with a reordered classpath generates
- * the correct deltas.
- */
-public void testClasspathReordering() throws CoreException {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, new String[] {getExternalJCLPathString()}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
- IPackageFragmentRoot root = getPackageFragmentRoot("P", "src");
- try {
- IClasspathEntry[] newEntries = new IClasspathEntry[originalCP.length];
- int index = originalCP.length - 1;
- for (int i = 0; i < originalCP.length; i++) {
- newEntries[index] = originalCP[i];
- index--;
- }
- startDeltas();
- setClasspath(proj, newEntries);
- assertTrue("should be one delta - two roots reordered", this.deltaListener.deltas.length == 1);
- IJavaElementDelta d = null;
- assertTrue("root should be reordered in the classpath", (d = getDeltaFor(root, true)) != null
- && (d.getFlags() & IJavaElementDelta.F_REORDER) > 0);
- } finally {
- stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/**
- * Should detect duplicate entries on the classpath
- */
-public void testClasspathValidation01() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = newCP[0];
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should have detected duplicate entries on the classpath",
- "Build path contains duplicate entry: P/src",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Should detect nested source folders on the classpath
- */
-public void testClasspathValidation02() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should have detected nested source folders on the classpath",
- "Cannot nest 'P/src' inside 'P'. To enable the nesting exclude 'src/' from 'P'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Should detect library folder nested inside source folder on the classpath
- */
-public void testClasspathValidation03() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newLibraryEntry(new Path("/P/src/lib"), null, null);
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should have detected library folder nested inside source folder on the classpath",
- "Cannot nest 'P/src/lib' inside 'P/src'. To enable the nesting exclude 'lib/' from 'P/src'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-public void testClasspathValidation04() throws CoreException {
-
- IJavaProject[] p = null;
- try {
-
- p = new IJavaProject[]{
- this.createJavaProject("P0", new String[] {"src0"}, "bin0"),
- this.createJavaProject("P1", new String[] {"src1"}, "bin1"),
- };
-
- JavaCore.setClasspathVariable("var", new Path("/P1"), null);
-
- IClasspathEntry[] newClasspath = new IClasspathEntry[]{
- JavaCore.newSourceEntry(new Path("/P0/src0")),
- JavaCore.newVariableEntry(new Path("var/src1"), null, null),
- };
-
- // validate classpath
- IJavaModelStatus status = JavaConventions.validateClasspath(p[0], newClasspath, p[0].getOutputLocation());
- assertEquals(
- "should not detect external source folder through a variable on the classpath",
- "OK",
- status.getMessage());
-
- } finally {
- this.deleteProjects(new String[] {"P0", "P1"});
- }
-}
-
-public void testClasspathValidation05() throws CoreException {
-
- IJavaProject[] p = null;
- try {
-
- p = new IJavaProject[]{
- this.createJavaProject("P0", new String[] {"src0", "src1"}, "bin0"),
- this.createJavaProject("P1", new String[] {"src1"}, "bin1"),
- };
-
- JavaCore.setClasspathContainer(
- new Path("container/default"),
- new IJavaProject[]{ p[0] },
- new IClasspathContainer[] {
- new TestContainer(new Path("container/default"),
- new IClasspathEntry[]{
- JavaCore.newSourceEntry(new Path("/P0/src0")),
- JavaCore.newVariableEntry(new Path("var/src1"), null, null) })
- },
- null);
-
- IClasspathEntry[] newClasspath = new IClasspathEntry[]{
- JavaCore.newSourceEntry(new Path("/P0/src1")),
- JavaCore.newContainerEntry(new Path("container/default")),
- };
-
- // validate classpath
- IJavaModelStatus status = JavaConventions.validateClasspath(p[0], newClasspath, p[0].getOutputLocation());
- assertEquals(
- "should not have detected external source folder through a container on the classpath",
- "OK",
- status.getMessage());
-
- // validate classpath entry
- status = JavaConventions.validateClasspathEntry(p[0], newClasspath[1], true);
- assertEquals(
- "should have detected external source folder through a container on the classpath",
- "Invalid classpath container: container/default",
- status.getMessage());
-
- } finally {
- this.deleteProjects(new String[] {"P0", "P1"});
- }
-}
-
-public void testClasspathValidation06() throws CoreException {
-
- IJavaProject[] p = null;
- try {
-
- p = new IJavaProject[]{
- this.createJavaProject("P0", new String[] {"src"}, "src"),
- };
-
- // validate classpath entry
- IClasspathEntry[] newClasspath = new IClasspathEntry[]{
- JavaCore.newSourceEntry(new Path("/P0")),
- JavaCore.newSourceEntry(new Path("/P0/src")),
- };
-
- IJavaModelStatus status = JavaConventions.validateClasspath(p[0], newClasspath, p[0].getOutputLocation());
- assertEquals(
- "should have detected nested source folder",
- "Cannot nest 'P0/src' inside 'P0'. To enable the nesting exclude 'src/' from 'P0'.",
- status.getMessage());
- } finally {
- this.deleteProject("P0");
- }
-}
-/**
- * Should allow nested source folders on the classpath as long as the outer
- * folder excludes the inner one.
- */
-public void testClasspathValidation07() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("src/")});
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should have allowed nested source folders with exclusion on the classpath",
- "OK",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should allow a nested binary folder in a source folder on the classpath as
- * long as the outer folder excludes the inner one.
- */
-public void testClasspathValidation08() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, new String[] {"lib"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("lib/")});
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should have allowed nested lib folders with exclusion on the classpath",
- "OK",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow a nested source folder in the project's output folder.
- */
-public void testClasspathValidation09() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/bin/src"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should not allow nested source folder in putput folder",
- "Cannot nest 'P/bin/src' inside output folder 'P/bin'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow a nested output folder in a source folder on the classpath.
- */
-public void testClasspathValidation10() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, originalCP, new Path("/P/src/bin"));
-
- assertEquals(
- "should not allow nested output folder in source folder",
- "Cannot nest output folder 'P/src/bin' inside 'P/src'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should allow a nested library folder in the project's output folder if the project's output is not used.
-*/
-public void testClasspathValidation11() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newLibraryEntry(new Path("/P/lib"), null, null);
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should allow nested library folder in output folder",
- "OK",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow a nested source folder in an output folder.
- */
-public void testClasspathValidation12() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin1");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] =
- JavaCore.newSourceEntry(
- new Path("/P/bin2/src"),
- new IPath[] {},
- new Path("/P/bin2"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should not allow nested source folder in output folder",
- "Cannot nest 'P/bin2/src' inside output folder 'P/bin2'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow a nested output folder in a source folder on the classpath.
- */
-public void testClasspathValidation13() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin1");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] =
- JavaCore.newSourceEntry(
- new Path("/P/src"),
- new IPath[] {},
- new Path("/P/src/bin2"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should not allow nested output folder in source folder",
- "Cannot nest output folder 'P/src/bin2' inside 'P/src'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should allow a nested output folder in a source folder that coincidate with the project.
- */
-public void testClasspathValidation14() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] =
- JavaCore.newSourceEntry(
- new Path("/P"),
- new IPath[] {},
- new Path("/P/bin"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should allow nested output folder in source folder which is project",
- "OK",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow nested source folders on the classpath if exclusion filter has no trailing slash.
- */
-public void testClasspathValidation15() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"), new IPath[] {new Path("**/src")});
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "End exclusion filter 'src' with / to fully exclude 'P/src'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should allow custom output folder to be nested in default output folder if default output is not used.
- * (regression test for bug 28596 Default output folder cause of validation error even if not used)
- */
-public void testClasspathValidation16() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"), new IPath[0], new Path("/P/bin"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "OK",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow source folder to be nested in default output folder if default output is used.
- */
-public void testClasspathValidation17() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src1"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/bin/src2"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Cannot nest 'P/bin/src2' inside output folder 'P/bin'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should not allow custom output folder to be external to project.
- * (regression test for bug 29079 Buildpath validation: No check that output folder is inside project)
- */
-public void testClasspathValidation18() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], new Path("/S/bin"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Path '/S/bin' must denote location inside project P",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Should detect source folder nested inside library folder on the classpath
- */
-public void testClasspathValidation19() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, new String[] {"lib"}, "bin");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/lib/src"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "should have detected library folder nested inside source folder on the classpath",
- "Cannot nest 'P/lib/src' inside library 'P/lib'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Should not allow custom output folder if project preference disallow them
- */
-public void testClasspathValidation20() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], new Path("/S/bin"));
-
- Map options = new Hashtable(5);
- options.put(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, JavaCore.DISABLED);
- proj.setOptions(options);
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Multiple output locations are disabled, cannot associate entry: 'P/src' with a specific output.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Should not allow exclusion patterns if project preference disallow them
- */
-public void testClasspathValidation21() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[]{new Path("**/src")}, null);
-
- Map options = new Hashtable(5);
- options.put(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaCore.DISABLED);
- proj.setOptions(options);
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Exclusion patterns are disabled, cannot exclude from entry: 'P/src'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * 33207 - Reject output folder that coincidate with distinct source folder
- */
-public void testClasspathValidation22() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], new Path("/P/src2"));
- newCP[originalCP.length+1] = JavaCore.newSourceEntry(new Path("/P/src2"), new IPath[0], new Path("/P/src"));
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Source folder 'P/src' cannot output to distinct source folder 'P/src2'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * 33207 - Reject output folder that coincidate with distinct source folder
- * but 36465 - Unable to create multiple source folders when not using bin for output
- * default output scenarii is still tolerated
- */
-public void testClasspathValidation23() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/"), new IPath[]{new Path("src/")}, null);
- newCP[originalCP.length+1] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], null);
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "OK",
- status.getMessage());
-// assertEquals(
-// "Source folder 'P/src' cannot output to distinct source folder 'P/'.",
-// status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Ensure one cannot nest source entry inside default output folder
- */
-public void testClasspathValidation24() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], null);
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Cannot nest 'P/src' inside output folder 'P'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Reject output folder that coincidate with library folder
- */
-public void testClasspathValidation25() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], new Path("/P/lib2"));
- newCP[originalCP.length+1] = JavaCore.newLibraryEntry(new Path("/P/lib2"), null, null);
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Source folder 'P/src' cannot output to library 'P/lib2'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Reject output folder that coincidate with library folder
- * default output scenarii
- */
-public void testClasspathValidation26() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
- IClasspathEntry[] originalCP = proj.getRawClasspath();
-
- IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
- System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
- newCP[originalCP.length] = JavaCore.newLibraryEntry(new Path("/P/"), null, null);
- newCP[originalCP.length+1] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], null);
-
- IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
-
- assertEquals(
- "Cannot nest 'P/src' inside library 'P/'.",
- status.getMessage());
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Checks diagnosis for incompatible binary versions
- */
-public void testClasspathValidation27() throws CoreException {
- try {
- IJavaProject proj1 = this.createJavaProject("P1", new String[] {}, "");
- proj1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4);
-
- IJavaProject proj2 = this.createJavaProject("P2", new String[] {}, "");
- proj2.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1);
- proj2.setOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.WARNING);
-
- IJavaModelStatus status = JavaConventions.validateClasspathEntry(proj2, JavaCore.newProjectEntry(new Path("/P1")), false);
- assertEquals(
- "Incompatible .class files version in required binaries. Project 'P2' is targeting a 1.1 runtime, but is compiled against 'P1' which requires a 1.4 runtime.",
- status.getMessage());
- } finally {
- this.deleteProjects(new String[]{"P1", "P2"});
- }
-}
-
-/**
- * Setting the classpath with two entries specifying the same path
- * should fail.
- */
-public void testClasspathWithDuplicateEntries() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] cp= project.getRawClasspath();
- IClasspathEntry[] newCp= new IClasspathEntry[cp.length *2];
- System.arraycopy(cp, 0, newCp, 0, cp.length);
- System.arraycopy(cp, 0, newCp, cp.length, cp.length);
- try {
- project.setRawClasspath(newCp, null);
- } catch (JavaModelException jme) {
- return;
- }
- assertTrue("Setting the classpath with two entries specifying the same path should fail", false);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Adding an entry to the classpath for a library that does not exist
- * should not break the model. The classpath should contain the
- * entry, but the root should not appear in the children.
- */
-public void testClasspathWithNonExistentLibraryEntry() throws CoreException {
- try {
- IJavaProject project= this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalPath= project.getRawClasspath();
- IPackageFragmentRoot[] originalRoots= project.getPackageFragmentRoots();
-
- IClasspathEntry[] newPath= new IClasspathEntry[originalPath.length + 1];
- System.arraycopy(originalPath, 0, newPath, 0, originalPath.length);
-
- IClasspathEntry newEntry= JavaCore.newLibraryEntry(new Path("c:/nothing/nozip.jar"), null, null, false);
- newPath[originalPath.length]= newEntry;
-
- project.setRawClasspath(newPath, null);
-
- IClasspathEntry[] getPath= project.getRawClasspath();
- assertTrue("should be the same length", getPath.length == newPath.length);
- for (int i= 0; i < getPath.length; i++) {
- assertTrue("entries should be the same", getPath[i].equals(newPath[i]));
- }
-
- IPackageFragmentRoot[] newRoots= project.getPackageFragmentRoots();
- assertTrue("Should be the same number of roots", originalRoots.length == newRoots.length);
- for (int i= 0; i < newRoots.length; i++) {
- assertTrue("roots should be the same", originalRoots[i].equals(newRoots[i]));
- }
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Adding an entry to the classpath for a project that does not exist
- * should not break the model. The classpath should contain the
- * entry, but the root should not appear in the children.
- */
-public void testClasspathWithNonExistentProjectEntry() throws CoreException {
- try {
- IJavaProject project= this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalPath= project.getRawClasspath();
- IPackageFragmentRoot[] originalRoots= project.getPackageFragmentRoots();
-
- IClasspathEntry[] newPath= new IClasspathEntry[originalPath.length + 1];
- System.arraycopy(originalPath, 0, newPath, 0, originalPath.length);
-
- IClasspathEntry newEntry= JavaCore.newProjectEntry(new Path("/NoProject"), false);
- newPath[originalPath.length]= newEntry;
-
- project.setRawClasspath(newPath, null);
-
- IClasspathEntry[] getPath= project.getRawClasspath();
- assertTrue("should be the same length", getPath.length == newPath.length);
- for (int i= 0; i < getPath.length; i++) {
- assertTrue("entries should be the same", getPath[i].equals(newPath[i]));
- }
-
- IPackageFragmentRoot[] newRoots= project.getPackageFragmentRoots();
- assertTrue("Should be the same number of roots", originalRoots.length == newRoots.length);
- for (int i= 0; i < newRoots.length; i++) {
- assertTrue("roots should be the same", originalRoots[i].equals(newRoots[i]));
- }
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Adding an entry to the classpath for a folder that does not exist
- * should not break the model. The classpath should contain the
- * entry, but the root should not appear in the children.
- */
-public void testClasspathWithNonExistentSourceEntry() throws CoreException {
- try {
- IJavaProject project= this.createJavaProject("P", new String[] {"src"}, "bin");
- IClasspathEntry[] originalPath= project.getRawClasspath();
- IPackageFragmentRoot[] originalRoots= project.getPackageFragmentRoots();
-
- IClasspathEntry[] newPath= new IClasspathEntry[originalPath.length + 1];
- System.arraycopy(originalPath, 0, newPath, 0, originalPath.length);
-
- IClasspathEntry newEntry= JavaCore.newSourceEntry(new Path("/P/moreSource"));
- newPath[originalPath.length]= newEntry;
-
- project.setRawClasspath(newPath, null);
-
- IClasspathEntry[] getPath= project.getRawClasspath();
- assertTrue("should be the same length", getPath.length == newPath.length);
- for (int i= 0; i < getPath.length; i++) {
- assertTrue("entries should be the same", getPath[i].equals(newPath[i]));
- }
-
- IPackageFragmentRoot[] newRoots= project.getPackageFragmentRoots();
- assertTrue("Should be the same number of roots", originalRoots.length == newRoots.length);
- for (int i= 0; i < newRoots.length; i++) {
- assertTrue("roots should be the same", originalRoots[i].equals(newRoots[i]));
- }
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Ensure that cycle are properly reported.
- */
-public void testCycleReport() throws CoreException {
-
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {""}, "");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {""}, "");
- IJavaProject p3 = this.createJavaProject("P3", new String[] {""}, new String[] {}, new String[] {"/P2"}, "");
-
- // Ensure no cycle reported
- IJavaProject[] projects = { p1, p2, p3 };
- int cycleMarkerCount = 0;
- for (int i = 0; i < projects.length; i++){
- cycleMarkerCount += this.numberOfCycleMarkers(projects[i]);
- }
- assertTrue("Should have no cycle markers", cycleMarkerCount == 0);
-
- // Add cycle
- IClasspathEntry[] originalP1CP= p1.getRawClasspath();
- IClasspathEntry[] originalP2CP= p2.getRawClasspath();
-
- // Add P1 as a prerequesite of P2
- int length = originalP2CP.length;
- IClasspathEntry[] newCP= new IClasspathEntry[length + 1];
- System.arraycopy(originalP2CP, 0 , newCP, 0, length);
- newCP[length]= JavaCore.newProjectEntry(p1.getProject().getFullPath(), false);
- p2.setRawClasspath(newCP, null);
-
- // Add P3 as a prerequesite of P1
- length = originalP1CP.length;
- newCP= new IClasspathEntry[length + 1];
- System.arraycopy(originalP1CP, 0 , newCP, 0, length);
- newCP[length]= JavaCore.newProjectEntry(p3.getProject().getFullPath(), false);
- p1.setRawClasspath(newCP, null);
-
- // Ensure a cycle is reported on one of the projects
- // Ensure no cycle reported
- cycleMarkerCount = 0;
- for (int i = 0; i < projects.length; i++){
- cycleMarkerCount += this.numberOfCycleMarkers(projects[i]);
- }
- assertTrue("Should have 3 projects involved in a classpath cycle", cycleMarkerCount == 3);
-
- } finally {
- // cleanup
- this.deleteProjects(new String[] {"P1", "P2", "P3"});
- }
-}
-/**
- * Ensures that the default classpath and output locations are correct.
- * The default classpath should be the root of the project.
- * The default output location should be the root of the project.
- */
-public void testDefaultClasspathAndOutputLocation() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "bin");
- IClasspathEntry[] classpath = project.getRawClasspath();
- assertTrue("Incorrect default classpath; to many entries", classpath.length == 1);
- assertTrue("Incorrect default classpath: " + classpath[0], classpath[0].getPath().equals(project.getUnderlyingResource().getFullPath()));
- IPath output = project.getOutputLocation();
- assertTrue("Incorrect default output location: " + output.toOSString(), output.equals(project.getUnderlyingResource().getFullPath().append("bin")));
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Setting the classpath to empty should result in no entries,
- * and a delta with removed roots.
- */
-public void testEmptyClasspath() throws CoreException {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
- try {
- startDeltas();
- setClasspath(project, new IClasspathEntry[] {});
- IClasspathEntry[] cp= project.getRawClasspath();
- assertTrue("classpath should have no entries", cp.length == 0);
-
- // ensure the deltas are correct
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Exporting a container should make it visible to its dependent project.
- * (regression test for bug 21749 Exported libraries and source folders)
- */
-public void testExportContainer() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {""}, "");
-
- // create container
- JavaCore.setClasspathContainer(
- new Path("container/default"),
- new IJavaProject[]{ p1 },
- new IClasspathContainer[] {
- new TestContainer(
- new Path("container/default"),
- new IClasspathEntry[] {
- JavaCore.newLibraryEntry(getExternalJCLPath(), null, null)
- })
- },
- null);
-
- // set P1's classpath with this container
- IClasspathEntry container = JavaCore.newContainerEntry(new Path("container/default"), true);
- p1.setRawClasspath(new IClasspathEntry[] {container}, new Path("/P1"), null);
-
- // create dependent project P2
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, new String[] {}, new String[] {"/P1"}, "");
- IClasspathEntry[] classpath = ((JavaProject)p2).getExpandedClasspath(true);
-
- // ensure container is exported to P2
- assertEquals("Unexpected number of classpath entries", 2, classpath.length);
- assertEquals("Unexpected first entry", "/P1", classpath[0].getPath().toString());
- assertEquals("Unexpected second entry", getExternalJCLPathString(), classpath[1].getPath().toOSString());
- } finally {
- this.deleteProjects(new String[] {"P1", "P2"});
- }
-}
-/**
- * Test IJavaProject.hasClasspathCycle(IClasspathEntry[]).
- */
-public void testHasClasspathCycle() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {""}, "");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {""}, "");
- this.createJavaProject("P3", new String[] {""}, new String[] {}, new String[] {"/P1"}, "");
-
- IClasspathEntry[] originalP1CP= p1.getRawClasspath();
- IClasspathEntry[] originalP2CP= p2.getRawClasspath();
-
- // Ensure no cycle reported
- assertTrue("P1 should not have a cycle", !p1.hasClasspathCycle(originalP1CP));
-
- // Ensure that adding NervousTest as a prerequesite of P2 doesn't report a cycle
- int length = originalP2CP.length;
- IClasspathEntry[] newCP= new IClasspathEntry[length + 1];
- System.arraycopy(originalP2CP, 0 , newCP, 0, length);
- newCP[length]= JavaCore.newProjectEntry(p1.getProject().getFullPath(), false);
- assertTrue("P2 should not have a cycle", !p2.hasClasspathCycle(newCP));
- p2.setRawClasspath(newCP, null);
-
- // Ensure that adding P3 as a prerequesite of P1 reports a cycle
- length = originalP1CP.length;
- newCP= new IClasspathEntry[length + 1];
- System.arraycopy(originalP1CP, 0 , newCP, 0, length);
- newCP[length]= JavaCore.newProjectEntry(p2.getProject().getFullPath(), false);
- assertTrue("P3 should have a cycle", p2.hasClasspathCycle(newCP));
-
- // Ensure a cycle is not reported through markers
- IWorkspace workspace = getJavaModel().getWorkspace();
- IMarker[] markers = workspace.getRoot().findMarkers(IJavaModelMarker.TRANSIENT_PROBLEM, true, 1);
- boolean hasCycleMarker = false;
- for (int i = 0; i < markers.length; i++){
- if (markers[i].getAttribute(IJavaModelMarker.CYCLE_DETECTED) != null) {
- hasCycleMarker = true;
- break;
- }
- }
- assertTrue("Should have no cycle markers", !hasCycleMarker);
-
- } finally {
- // cleanup
- this.deleteProjects(new String[] {"P1", "P2", "P3"});
- }
-}
-/**
- * Ensures that a marker is created if editing the .classpath results in an invalid classpath.
- */
-public void testInvalidClasspath1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/\n" + // missing >
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- assertMarkers(
- "Unexpected markers",
- "XML format error in 'P/.classpath' file: Bad format.",
- project);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that a marker is created if editing the .classpath results in an invalid classpath.
- */
-public void testInvalidClasspath2() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src1\" path=\"src\"/>\n" + // invalid kind: src1
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- assertMarkers(
- "Unexpected markers",
- "Illegal entry in 'P/.classpath' file: Unknown kind: src1",
- project);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Test that a marker is added when a project as a missing project in its classpath.
- */
-public void testMissingPrereq1() throws CoreException {
- try {
- IJavaProject javaProject = this.createJavaProject("A", new String[] {}, "");
- IClasspathEntry[] classpath =
- new IClasspathEntry[] {
- JavaCore.newProjectEntry(new Path("/B"))
- };
- javaProject.setRawClasspath(classpath, null);
- this.assertMarkers(
- "Unexpected markers",
- "Missing required Java project: B.",
- javaProject);
- } finally {
- this.deleteProject("A");
- }
-}
-/**
- * Test that a marker is added when a project as a missing project in its classpath.
- */
-public void testMissingPrereq2() throws CoreException {
- try {
- IJavaProject javaProject =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {"/B"}, // projects
- "");
- this.assertMarkers(
- "Unexpected markers",
- "Missing required Java project: B.",
- javaProject);
- } finally {
- this.deleteProject("A");
- }
-}
-/**
- * Test that a marker indicating a missing project is removed when the project is added.
- */
-public void testMissingPrereq3() throws CoreException {
- try {
- IJavaProject javaProject =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {"/B"}, // projects
- "");
- this.createJavaProject("B", new String[] {}, "");
- this.assertMarkers("Unexpected markers", "", javaProject);
- } finally {
- this.deleteProjects(new String[] {"A", "B"});
- }
-}
-/**
- * Test that a marker indicating a cycle is removed when a project in the cycle is deleted
- * and replaced with a missing prereq marker.
- * (regression test for bug 15168 circular errors not reported)
- */
-public void testMissingPrereq4() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {"/B"}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {"/A"}, // projects
- "");
- this.assertMarkers(
- "Unexpected markers for project A",
- "A cycle was detected in the build path of project: A",
- projectA);
- this.assertMarkers(
- "Unexpected markers for project B",
- "A cycle was detected in the build path of project: B",
- projectB);
-
- // delete project B
- this.deleteProject("B");
- this.assertMarkers(
- "Unexpected markers for project A after deleting of project B",
- "Missing required Java project: B.",
- projectA);
-
- // add project B back
- projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {"/A"}, // projects
- "");
- this.assertMarkers(
- "Unexpected markers for project A after adding project B back",
- "A cycle was detected in the build path of project: A",
- projectA);
- this.assertMarkers(
- "Unexpected markers for project B after adding project B back",
- "A cycle was detected in the build path of project: B",
- projectB);
-
- } finally {
- this.deleteProjects(new String[] {"A", "B"});
- }
-}
-/**
- * Setting the classpath to null should be the same as using the
- * default classpath.
- */
-public void testNullClasspath() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
- setClasspath(project, null);
- IClasspathEntry[] cp= project.getRawClasspath();
- assertTrue("classpath should have one root entry", cp.length == 1 && cp[0].getPath().equals(project.getUnderlyingResource().getFullPath()));
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensure that reading an empty custom putput from the .classpath returns a non-null output location.
- * (regression test for 28531 Classpath Entry: Output folder can not be set to project)
- */
-public void testReadEmptyCustomOutput() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {}, "");
- this.editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" output=\"\" path=\"\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- IClasspathEntry[] classpath = project.getRawClasspath();
- assertEquals("Unexpected classpath length", 1, classpath.length);
- assertEquals("Unexpected custom output location", new Path("/P"), classpath[0].getOutputLocation());
- } finally {
- this.deleteProject("P");
- }
-}
-
-
-public void testCycleDetection() throws CoreException {
-
- int max = 5;
- IJavaProject[] p = new IJavaProject[max];
- String[] projectNames = new String[max];
- try {
- for (int i = 0; i < max; i++) {
- projectNames[i] = "P"+i;
- p[i] = this.createJavaProject(projectNames[i], new String[] {""}, "");
- }
-
- IClasspathEntry[][] extraEntries = new IClasspathEntry[][]{
- { JavaCore.newProjectEntry(p[1].getPath()), JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newProjectEntry(p[2].getPath()), JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newProjectEntry(p[1].getPath()) },
- { JavaCore.newProjectEntry(p[4].getPath())},
- { JavaCore.newProjectEntry(p[3].getPath()), JavaCore.newProjectEntry(p[0].getPath()) }
- };
-
- int[][] expectedCycleParticipants = new int[][] {
- { 0, 0, 0, 0, 0 }, // after setting CP p[0]
- { 0, 0, 0, 0, 0 }, // after setting CP p[1]
- { 0, 1, 1, 0, 0 }, // after setting CP p[2]
- { 0, 1, 1, 0, 0 }, // after setting CP p[3]
- { 1, 1, 1, 1, 1 }, // after setting CP p[4]
- };
-
- for (int i = 0; i < p.length; i++){
-
- // append project references
- IClasspathEntry[] oldClasspath = p[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries[i].length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries[i].length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[i][j];
- }
- // set classpath
- p[i].setRawClasspath(newClasspath, null);
-
- // check cycle markers
- this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]);
- }
- //this.startDeltas();
-
- } finally {
- this.deleteProjects(projectNames);
- }
-}
-
-
-public void testCycleDetectionThroughVariables() throws CoreException {
-
- int max = 5;
- IJavaProject[] p = new IJavaProject[max];
- String[] projectNames = new String[max];
- try {
- for (int i = 0; i < max; i++) {
- projectNames[i] = "P"+i;
- p[i] = this.createJavaProject(projectNames[i], new String[] {""}, "");
- }
-
- String[] var = new String[]{ "v0", "v1", "v2"};
- IClasspathEntry[][] extraEntries = new IClasspathEntry[][]{
- { JavaCore.newProjectEntry(p[1].getPath()), JavaCore.newVariableEntry(new Path(var[0]), null, null) },
- { JavaCore.newProjectEntry(p[2].getPath()), JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newVariableEntry(new Path(var[1]), null, null) },
- { JavaCore.newVariableEntry(new Path(var[2]), null, null)},
- { JavaCore.newProjectEntry(p[3].getPath()), JavaCore.newProjectEntry(p[0].getPath()) }
- };
-
- int[][] expectedCycleParticipants = new int[][] {
- { 0, 0, 0, 0, 0 }, // after setting CP p[0]
- { 0, 0, 0, 0, 0 }, // after setting CP p[1]
- { 0, 0, 0, 0, 0 }, // after setting CP p[2]
- { 0, 0, 0, 0, 0 }, // after setting CP p[3]
- { 1, 1, 1, 1, 1 }, // after setting CP p[4]
- };
-
- IPath[][] variableValues = new IPath[][]{
- { null, null, null },
- { null, null, null },
- { null, null, null },
- { null, null, null },
- { p[3].getPath(), p[1].getPath(), p[4].getPath() },
- };
-
- for (int i = 0; i < p.length; i++){
-
- // append project references
- IClasspathEntry[] oldClasspath = p[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries[i].length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries[i].length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[i][j];
- }
- // set classpath
- p[i].setRawClasspath(newClasspath, null);
-
- // update variable values
- JavaCore.setClasspathVariables(var, variableValues[i], null);
-
- // check cycle markers
- this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]);
- }
- //this.startDeltas();
-
- } finally {
- //this.stopDeltas();
- this.deleteProjects(projectNames);
- }
-}
-
-public void testCycleDetectionThroughContainers() throws CoreException {
-
- int max = 5;
- IJavaProject[] p = new IJavaProject[max];
- String[] projectNames = new String[max];
- try {
- for (int i = 0; i < max; i++) {
- projectNames[i] = "P"+i;
- p[i] = this.createJavaProject(projectNames[i], new String[] {""}, "");
- }
-
- IClasspathContainer[] containers = new IClasspathContainer[]{
- new TestContainer(
- new Path("container0/default"),
- new IClasspathEntry[]{ JavaCore.newProjectEntry(p[3].getPath()) }),
- new TestContainer(
- new Path("container1/default"),
- new IClasspathEntry[]{ JavaCore.newProjectEntry(p[1].getPath()) }),
- new TestContainer(
- new Path("container2/default"),
- new IClasspathEntry[]{ JavaCore.newProjectEntry(p[4].getPath()) }),
- };
-
- IClasspathEntry[][] extraEntries = new IClasspathEntry[][]{
- { JavaCore.newProjectEntry(p[1].getPath()), JavaCore.newContainerEntry(containers[0].getPath()) },
- { JavaCore.newProjectEntry(p[2].getPath()), JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newContainerEntry(containers[1].getPath()) },
- { JavaCore.newContainerEntry(containers[2].getPath())},
- { JavaCore.newProjectEntry(p[3].getPath()), JavaCore.newProjectEntry(p[0].getPath()) }
- };
-
- int[][] expectedCycleParticipants = new int[][] {
- { 0, 0, 0, 0, 0 }, // after setting CP p[0]
- { 0, 0, 0, 0, 0 }, // after setting CP p[1]
- { 0, 0, 0, 0, 0 }, // after setting CP p[2]
- { 0, 0, 0, 0, 0 }, // after setting CP p[3]
- { 1, 1, 1, 1, 1 }, // after setting CP p[4]
- };
-
- for (int i = 0; i < p.length; i++){
-
- // append project references
- IClasspathEntry[] oldClasspath = p[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries[i].length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries[i].length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[i][j];
- }
- // set classpath
- p[i].setRawClasspath(newClasspath, null);
-
- // update container paths
- if (i == p.length - 1){
- JavaCore.setClasspathContainer(
- containers[0].getPath(),
- new IJavaProject[]{ p[0] },
- new IClasspathContainer[] { containers[0] },
- null);
-
- JavaCore.setClasspathContainer(
- containers[1].getPath(),
- new IJavaProject[]{ p[2] },
- new IClasspathContainer[] { containers[1] },
- null);
-
- JavaCore.setClasspathContainer(
- containers[2].getPath(),
- new IJavaProject[]{ p[3] },
- new IClasspathContainer[] { containers[2] },
- null);
- }
-
- // check cycle markers
- this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]);
- }
- //this.startDeltas();
-
- } finally {
- //this.stopDeltas();
- this.deleteProjects(projectNames);
- }
-}
-public void testCycleDetectionThroughContainerVariants() throws CoreException {
-
- int max = 5;
- IJavaProject[] p = new IJavaProject[max];
- String[] projectNames = new String[max];
- try {
- for (int i = 0; i < max; i++) {
- projectNames[i] = "P"+i;
- p[i] = this.createJavaProject(projectNames[i], new String[] {""}, "");
- }
-
- class TestContainer implements IClasspathContainer {
- IPath path;
- IClasspathEntry[] entries;
- TestContainer(IPath path, IClasspathEntry[] entries){
- this.path = path;
- this.entries = entries;
- }
- public IPath getPath() { return this.path; }
- public IClasspathEntry[] getClasspathEntries() { return this.entries; }
- public String getDescription() { return null; }
- public int getKind() { return 0; }
- };
-
- IClasspathContainer[] containers = new IClasspathContainer[]{
- new TestContainer(
- new Path("container0/default"),
- new IClasspathEntry[]{ JavaCore.newProjectEntry(p[3].getPath()) }),
- new TestContainer(
- new Path("container0/default"),
- new IClasspathEntry[]{ JavaCore.newProjectEntry(p[1].getPath()) }),
- new TestContainer(
- new Path("container0/default"),
- new IClasspathEntry[]{ JavaCore.newProjectEntry(p[4].getPath()) }),
- };
-
- IClasspathEntry[][] extraEntries = new IClasspathEntry[][]{
- { JavaCore.newProjectEntry(p[1].getPath()), JavaCore.newContainerEntry(containers[0].getPath()) },
- { JavaCore.newProjectEntry(p[2].getPath()), JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newContainerEntry(containers[1].getPath()) },
- { JavaCore.newContainerEntry(containers[2].getPath())},
- { JavaCore.newProjectEntry(p[3].getPath()), JavaCore.newProjectEntry(p[0].getPath()) }
- };
-
- int[][] expectedCycleParticipants = new int[][] {
- { 0, 0, 0, 0, 0 }, // after setting CP p[0]
- { 0, 0, 0, 0, 0 }, // after setting CP p[1]
- { 0, 0, 0, 0, 0 }, // after setting CP p[2]
- { 0, 0, 0, 0, 0 }, // after setting CP p[3]
- { 1, 1, 1, 1, 1 }, // after setting CP p[4]
- };
-
- for (int i = 0; i < p.length; i++){
-
- // append project references
- IClasspathEntry[] oldClasspath = p[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries[i].length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries[i].length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[i][j];
- }
- // set classpath
- p[i].setRawClasspath(newClasspath, null);
-
- // update same container path for multiple projects
- if (i == p.length - 1){
- JavaCore.setClasspathContainer(
- containers[0].getPath(),
- new IJavaProject[]{ p[0], p[2], p[3] },
- new IClasspathContainer[] { containers[0], containers[1], containers[2] },
- null);
- }
-
- // check cycle markers
- this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]);
- }
- //this.startDeltas();
-
- } finally {
- //this.stopDeltas();
- this.deleteProjects(projectNames);
- }
-}
-public void testCycleDetection2() throws CoreException {
-
- int max = 5;
- IJavaProject[] p = new IJavaProject[max];
- String[] projectNames = new String[max];
- try {
- for (int i = 0; i < max; i++) {
- projectNames[i] = "P"+i;
- p[i] = this.createJavaProject(projectNames[i], new String[] {""}, "");
- }
-
- IClasspathEntry[][] extraEntries = new IClasspathEntry[][]{
- { JavaCore.newProjectEntry(p[1].getPath()), JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newProjectEntry(p[2].getPath()) },
- { JavaCore.newProjectEntry(p[0].getPath()) },
- { JavaCore.newProjectEntry(p[4].getPath())},
- { JavaCore.newProjectEntry(p[0].getPath()) }
- };
-
- int[][] expectedCycleParticipants = new int[][] {
- { 0, 0, 0, 0, 0 }, // after setting CP p[0]
- { 0, 0, 0, 0, 0 }, // after setting CP p[1]
- { 1, 1, 1, 0, 0 }, // after setting CP p[2]
- { 1, 1, 1, 0, 0 }, // after setting CP p[3]
- { 1, 1, 1, 1, 1 }, // after setting CP p[4]
- };
-
- for (int i = 0; i < p.length; i++){
-
- // append project references
- IClasspathEntry[] oldClasspath = p[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries[i].length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries[i].length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[i][j];
- }
- // set classpath
- p[i].setRawClasspath(newClasspath, null);
-
- // check cycle markers
- this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]);
- }
- //this.startDeltas();
-
- } finally {
- //this.stopDeltas();
- this.deleteProjects(projectNames);
- }
-}
-
-public void testCycleDetection3() throws CoreException {
-
- int max = 6;
- IJavaProject[] p = new IJavaProject[max];
- String[] projectNames = new String[max];
- try {
- for (int i = 0; i < max; i++) {
- projectNames[i] = "P"+i;
- p[i] = this.createJavaProject(projectNames[i], new String[] {""}, "");
- }
-
- IClasspathEntry[][] extraEntries = new IClasspathEntry[][]{
- { JavaCore.newProjectEntry(p[2].getPath()), JavaCore.newProjectEntry(p[4].getPath()) },
- { JavaCore.newProjectEntry(p[0].getPath()) },
- { JavaCore.newProjectEntry(p[3].getPath()) },
- { JavaCore.newProjectEntry(p[1].getPath())},
- { JavaCore.newProjectEntry(p[5].getPath()) },
- { JavaCore.newProjectEntry(p[1].getPath()) }
- };
-
- int[][] expectedCycleParticipants = new int[][] {
- { 0, 0, 0, 0, 0, 0 }, // after setting CP p[0]
- { 0, 0, 0, 0, 0, 0 }, // after setting CP p[1]
- { 0, 0, 0, 0, 0, 0 }, // after setting CP p[2]
- { 1, 1, 1, 1, 0, 0 }, // after setting CP p[3]
- { 1, 1, 1, 1, 0, 0 }, // after setting CP p[4]
- { 1, 1, 1, 1, 1 , 1}, // after setting CP p[5]
- };
-
- for (int i = 0; i < p.length; i++){
-
- // append project references
- IClasspathEntry[] oldClasspath = p[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries[i].length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries[i].length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[i][j];
- }
- // set classpath
- p[i].setRawClasspath(newClasspath, null);
-
- // check cycle markers
- this.assertCycleMarkers(p[i], p, expectedCycleParticipants[i]);
- }
- //this.startDeltas();
-
- } finally {
- //this.stopDeltas();
- this.deleteProjects(projectNames);
- }
-}
-public void testDenseCycleDetection() throws CoreException {
-
- // each project prereqs all other projects
- denseCycleDetection(5);
- denseCycleDetection(10);
- denseCycleDetection(20);
- //denseCycleDetection(100);
-}
-/*
- * Create projects and set classpaths in one batch
- */
-public void testNoCycleDetection1() throws CoreException {
-
- // each project prereqs all the previous ones
- noCycleDetection(5, false, false);
- noCycleDetection(10, false, false);
- noCycleDetection(20, false, false);
-
- // each project prereqs all the next ones
- noCycleDetection(5, true, false);
- noCycleDetection(10, true, false);
- noCycleDetection(20, true, false);
-}
-/*
- * Create projects first, then set classpaths
- */
-public void testNoCycleDetection2() throws CoreException {
-
- // each project prereqs all the previous ones
- noCycleDetection(5, false, true);
- noCycleDetection(10, false, true);
- noCycleDetection(20, false, true);
-
- // each project prereqs all the next ones
- noCycleDetection(5, true, true);
- noCycleDetection(10, true, true);
- noCycleDetection(20, true, true);
-}
-/**
- * Ensures that a duplicate entry created by editing the .classpath is detected.
- * (regression test for bug 24498 Duplicate entries on classpath cause CP marker to no longer refresh)
- */
-public void testDuplicateEntries() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- assertMarkers(
- "Unexpected markers",
- "Invalid build path in \'P/.classpath\' file: Build path contains duplicate entry: P/src",
- project);
- } finally {
- this.deleteProject("P");
- }
-}
-
-private void denseCycleDetection(final int numberOfParticipants) throws CoreException {
-
- final IJavaProject[] projects = new IJavaProject[numberOfParticipants];
- final String[] projectNames = new String[numberOfParticipants];
- final int[] allProjectsInCycle = new int[numberOfParticipants];
-
- final long[] start = new long[1];
- final long[] time = new long[1];
-
-
- try {
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < numberOfParticipants; i++){
- projectNames[i] = "P"+i;
- projects[i] = createJavaProject(projectNames[i], new String[]{""}, "");
- allProjectsInCycle[i] = 1;
- }
- for (int i = 0; i < numberOfParticipants; i++){
- IClasspathEntry[] extraEntries = new IClasspathEntry[numberOfParticipants-1];
- int index = 0;
- for (int j = 0; j < numberOfParticipants; j++){
- if (i == j) continue;
- extraEntries[index++] = JavaCore.newProjectEntry(projects[j].getPath());
- }
- // append project references
- IClasspathEntry[] oldClasspath = projects[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries.length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries.length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[j];
- }
- // set classpath
- long innerStart = System.currentTimeMillis(); // time spent in individual CP setting
- projects[i].setRawClasspath(newClasspath, null);
- time[0] += System.currentTimeMillis() - innerStart;
- };
- start[0] = System.currentTimeMillis(); // time spent in delta refresh
- }
- },
- null);
- time[0] += System.currentTimeMillis()-start[0];
- System.out.println("Dense cycle check ("+numberOfParticipants+" participants) : "+ time[0]+" ms");
-
- for (int i = 0; i < numberOfParticipants; i++){
- // check cycle markers
- this.assertCycleMarkers(projects[i], projects, allProjectsInCycle);
- }
-
- } finally {
- this.deleteProjects(projectNames);
- }
-}
-/*
- * When using forward references, all projects prereq all of the ones which have a greater index,
- * e.g. P0, P1, P2: P0 prereqs {P1, P2}, P1 prereqs {P2}, P2 prereqs {}
- * When no using forward references (i.e. backward refs), all projects prereq projects with smaller index
- * e.g. P0, P1, P2: P0 prereqs {}, P1 prereqs {P0}, P2 prereqs {P0, P1}
- */
-private void noCycleDetection(final int numberOfParticipants, final boolean useForwardReferences, final boolean createProjectsFirst) throws CoreException {
-
- final IJavaProject[] projects = new IJavaProject[numberOfParticipants];
- final String[] projectNames = new String[numberOfParticipants];
- final int[] allProjectsInCycle = new int[numberOfParticipants];
-
- final long[] start = new long[1];
- final long[] time = new long[1];
-
- try {
- if (createProjectsFirst) {
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < numberOfParticipants; i++){
- projectNames[i] = "P"+i;
- projects[i] = createJavaProject(projectNames[i], new String[]{""}, "");
- allProjectsInCycle[i] = 0;
- }
- }
- },
- null);
- }
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- if (!createProjectsFirst) {
- for (int i = 0; i < numberOfParticipants; i++){
- projectNames[i] = "P"+i;
- projects[i] = createJavaProject(projectNames[i], new String[]{""}, "");
- allProjectsInCycle[i] = 0;
- }
- }
- for (int i = 0; i < numberOfParticipants; i++){
- IClasspathEntry[] extraEntries = new IClasspathEntry[useForwardReferences ? numberOfParticipants - i -1 : i];
- int index = 0;
- for (int j = useForwardReferences ? i+1 : 0;
- useForwardReferences ? (j < numberOfParticipants) : (j < i);
- j++){
- extraEntries[index++] = JavaCore.newProjectEntry(projects[j].getPath());
- }
- // append project references
- IClasspathEntry[] oldClasspath = projects[i].getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length+extraEntries.length];
- System.arraycopy(oldClasspath, 0 , newClasspath, 0, oldClasspath.length);
- for (int j = 0; j < extraEntries.length; j++){
- newClasspath[oldClasspath.length+j] = extraEntries[j];
- }
- // set classpath
- long innerStart = System.currentTimeMillis(); // time spent in individual CP setting
- projects[i].setRawClasspath(newClasspath, null);
- time[0] += System.currentTimeMillis() - innerStart;
- }
- start[0] = System.currentTimeMillis(); // time spent in delta refresh
- }
- },
- null);
- time[0] += System.currentTimeMillis()-start[0];
- System.out.println("No cycle check ("+numberOfParticipants+" participants) : "+ time[0]+" ms, "+ (useForwardReferences ? "forward references" : "backward references") + ", " + (createProjectsFirst ? "two steps (projects created first, then classpaths are set)" : "one step (projects created and classpaths set in one batch)"));
-
- for (int i = 0; i < numberOfParticipants; i++){
- // check cycle markers
- this.assertCycleMarkers(projects[i], projects, allProjectsInCycle);
- }
-
- } finally {
- this.deleteProjects(projectNames);
- }
-}
-
-/*
- * test for bug 32690
- */
-public void testNestedSourceFolders() throws CoreException {
- try {
- final IProject project = getProject("P");
-
- project.create(null);
- project.open(null);
-
- try {
- File pro = project.getLocation().toFile();
- File src = ClasspathTests.this.createFolder(pro, "src");
- ClasspathTests.this.createFolder(src, "src2");
-
- ClasspathTests.this.createFile(pro, ".project",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<projectDescription>\n" +
- " <name>org.eclipse.jdt.core</name>\n" +
- " <comment></comment>\n" +
- " <projects>\n" +
- " </projects>\n" +
- " <buildSpec>\n" +
- " <buildCommand>\n" +
- " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
- " <arguments>\n" +
- " </arguments>\n" +
- " </buildCommand>\n" +
- " </buildSpec>\n" +
- " <natures>\n" +
- " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
- " </natures>\n" +
- "</projectDescription>");
-
-
- ClasspathTests.this.createFile(pro, ".classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"src\" path=\"src/src2\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- } catch (IOException e) {
- assertTrue(e.getMessage(), false);
- }
- project.refreshLocal(IResource.DEPTH_INFINITE,null);
- this.assertMarkers(
- "Unexpected markers",
- "Cannot nest \'P/src/src2\' inside \'P/src\'. To enable the nesting exclude \'src2/\' from \'P/src\'.",
- JavaCore.create(project));
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * test for bug 32974
- */
-public void testOutputFolder1() throws CoreException {
- try {
- final IProject project = getProject("P");
-
- project.create(null);
- project.open(null);
-
- try {
- File pro = project.getLocation().toFile();
- File src = ClasspathTests.this.createFolder(pro, "src");
- ClasspathTests.this.createFolder(src, "src2");
-
- ClasspathTests.this.createFile(pro, ".project",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<projectDescription>\n" +
- " <name>org.eclipse.jdt.core</name>\n" +
- " <comment></comment>\n" +
- " <projects>\n" +
- " </projects>\n" +
- " <buildSpec>\n" +
- " <buildCommand>\n" +
- " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
- " <arguments>\n" +
- " </arguments>\n" +
- " </buildCommand>\n" +
- " </buildSpec>\n" +
- " <natures>\n" +
- " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
- " </natures>\n" +
- "</projectDescription>");
-
-
- ClasspathTests.this.createFile(pro, ".classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" output=\"bin2\" path=\"src1\"/>\n" +
- " <classpathentry kind=\"src\" path=\"src2\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- } catch (IOException e) {
- assertTrue(e.getMessage(), false);
- }
- project.refreshLocal(IResource.DEPTH_INFINITE,null);
- this.assertMarkers(
- "Unexpected markers",
- "Missing required source folder: \'P/src1\'.\n" +
- "Missing required source folder: \'P/src2\'.",
- JavaCore.create(project));
- } finally {
- this.deleteProject("P");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
deleted file mode 100644
index 8055759..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
+++ /dev/null
@@ -1,752 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.search.*;
-
-
-public class CodeCorrectionTests extends AbstractJavaModelTests {
- public static boolean fgDebug = false;
- public static boolean fgSpecific = false;
-
-public CodeCorrectionTests(String name) {
- super(name);
-}
-private IMarker[] getMarkers(ICompilationUnit unit){
- try {
- IResource resource = unit.getCorrespondingResource();
- return resource.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
- } catch (CoreException e) {
- }
- return new IMarker[0];
-}
-private IMarker getMarker(ICompilationUnit unit, String message) throws CoreException {
- IMarker[] markers = getMarkers(unit);
- for (int i = 0; i < markers.length; i++) {
- IMarker marker = markers[i];
- if (message.equals(marker.getAttribute(IMarker.MESSAGE))) {
- return marker;
- }
- }
- return null;
-}
-/**
- * Return the project names to load in the solution
- * when an independent test suite is being run.
- */
-public static String[] getProjectNames() {
- return new String[] {"Compiler", "CodeCorrection"};
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- IJavaProject project = setUpJavaProject("CodeCorrection");
-
- // dummy query for waiting until the indexes are ready
- SearchEngine engine = new SearchEngine();
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project});
- try {
- engine.searchAllTypeNames(
- project.getProject().getWorkspace(),
- null,
- "!@$#!@".toCharArray(),
- IJavaSearchConstants.PATTERN_MATCH,
- IJavaSearchConstants.CASE_SENSITIVE,
- IJavaSearchConstants.CLASS,
- scope,
- new ITypeNameRequestor() {
- public void acceptClass(
- char[] packageName,
- char[] simpleTypeName,
- char[][] enclosingTypeNames,
- String path) {}
- public void acceptInterface(
- char[] packageName,
- char[] simpleTypeName,
- char[][] enclosingTypeNames,
- String path) {}
- },
- IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null);
- } catch (CoreException e) {
- }
- // do a full build to create markers
- JavaCore.setOptions(JavaCore.getDefaultOptions());
- try {
- getWorkspace().getRoot().getProject("CodeCorrection").build(IncrementalProjectBuilder.FULL_BUILD,null);
- } catch (CoreException e) {
- assertTrue("building failed", false);
- }
-}
-public void tearDownSuite() throws Exception {
- deleteProject("CodeCorrection");
-
- super.tearDownSuite();
-}
-public static Test suite() {
- Suite suite = new Suite(CodeCorrectionTests.class.getName());
- if (fgSpecific) {
- suite.addTest(new CodeCorrectionTests("testCorrectMethod1"));
-
- return suite;
- } else {
- suite.addTest(new CodeCorrectionTests("testCorrectFieldType1"));
- suite.addTest(new CodeCorrectionTests("testCorrectFieldType2"));
- suite.addTest(new CodeCorrectionTests("testCorrectFieldType3"));
- suite.addTest(new CodeCorrectionTests("testCorrectLocalVariableType1"));
- suite.addTest(new CodeCorrectionTests("testCorrectLocalVariableType2"));
- suite.addTest(new CodeCorrectionTests("testCorrectImport1"));
- suite.addTest(new CodeCorrectionTests("testCorrectImport2"));
- suite.addTest(new CodeCorrectionTests("testCorrectImport3"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperClass1"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperClass2"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface1"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface2"));
- suite.addTest(new CodeCorrectionTests("testCorrectException1"));
- suite.addTest(new CodeCorrectionTests("testCorrectException2"));
- suite.addTest(new CodeCorrectionTests("testCorrectMethod1"));
- suite.addTest(new CodeCorrectionTests("testCorrectMethod2"));
- suite.addTest(new CodeCorrectionTests("testCorrectField1"));
- suite.addTest(new CodeCorrectionTests("testCorrectField2"));
- suite.addTest(new CodeCorrectionTests("testCorrectLocalVariable1"));
- suite.addTest(new CodeCorrectionTests("testCorrectArgument1"));
- suite.addTest(new CodeCorrectionTests("testCorrectReturnType1"));
- suite.addTest(new CodeCorrectionTests("testCorrectReturnType2"));
-
- return suite;
- }
-}
-public void testCorrectFieldType1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectFieldType1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "dddz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ddd\n"+
- "ddd.eee",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectFieldType2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectFieldType2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AClassz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AClass\n"+
- "AClass2",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectFieldType3() throws CoreException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectFieldType3.java");
- IMarker marker = getMarker(cu, "AClassz cannot be resolved (or is not a valid type) for the field CorrectFieldType3.field");
- assertTrue("Marker not found", marker != null);
- try {
- engine.computeCorrections(marker, null, 0, requestor);
- } catch(CoreException e) {
- }
-
- String src = cu.getSource();
- String error = "AClassz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AClass\n"+
- "AClass2",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectLocalVariableType1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectLocalVariableType1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "dddz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ddd\n"+
- "ddd.eee",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectLocalVariableType2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectLocalVariableType2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AClassz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AClass\n"+
- "AClass2",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectImport1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectImport1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "dddz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ddd\n"+
- "ddd.eee",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectImport2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectImport2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "dddz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ddd\n"+
- "ddd.eee",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectImport3() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectImport3.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AClassz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AClass\n"+
- "AClass2",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectSuperClass1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectSuperClass1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "dddz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ddd\n"+
- "ddd.eee",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectSuperClass2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectSuperClass2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AClassz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AClass\n"+
- "AClass2",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectSuperInterface1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectSuperInterface1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "cccz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ccc\n"+
- "cccInterface",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectSuperInterface2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectSuperInterface2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AListenerz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AListener\n"+
- "AListenerEvent",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectException1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectException1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bbbz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "bbb\n"+
- "bbb.ccc",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectException2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectException2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AnExceptionz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AnException",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectMethod1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectMethod1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bar";
- int start = src.lastIndexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have one suggestion",
- "bar0",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectMethod2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectMethod2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bar";
- int start = src.lastIndexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have one suggestion",
- "bar0",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectField1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectField1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bar";
- int start = src.lastIndexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have one suggestion",
- "bar0",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectField2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectField2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bar";
- int start = src.lastIndexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have one suggestion",
- "bar0",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectLocalVariable1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectLocalVariable1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bar";
- int start = src.lastIndexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have one suggestion",
- "bar0",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectArgument1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectArgument1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "bar";
- int start = src.lastIndexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have one suggestion",
- "bar0",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- ""+start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- ""+end,
- requestor.getEnds());
-}
-public void testCorrectReturnType1() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectReturnType1.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "dddz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "ddd\n"+
- "ddd.eee",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-public void testCorrectReturnType2() throws JavaModelException {
- CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
- CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectReturnType2.java");
- IMarker[] markers = getMarkers(cu);
- assertTrue("should have one problem",markers.length == 1);
- engine.computeCorrections(markers[0], null, 0, requestor);
-
- String src = cu.getSource();
- String error = "AClassz";
- int start = src.indexOf(error);
- int end = start + error.length();
-
- assertEquals(
- "should have two suggestions",
- "AClass\n"+
- "AClass2",
- requestor.getSuggestions());
- assertEquals(
- "a start of a suggestion is not correct",
- start+"\n"+
- start,
- requestor.getStarts());
- assertEquals(
- "a end of a suggestion is not correct",
- end+"\n"+
- end,
- requestor.getEnds());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTestsRequestor.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTestsRequestor.java
deleted file mode 100644
index 60534ab..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTestsRequestor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.*;
-
-import org.eclipse.jdt.core.ICorrectionRequestor;
-
-public class CodeCorrectionTestsRequestor implements ICorrectionRequestor {
- private class Suggestion {
- public String text;
- public int start;
- public int end;
- public Suggestion(char[] text, int start, int end){
- this.text = new String(text);
- this.start = start;
- this.end = end;
- }
- }
-
- private class SuggestionComparator implements Comparator {
- public int compare(Object o1,Object o2) {
- Suggestion s1 = (Suggestion)o1;
- Suggestion s2 = (Suggestion)o2;
-
- int result = s1.text.compareTo(s2.text);
- if(result == 0) {
- result = s1.start - s2.start;
- if(result == 0) {
- result = s1.end - s2.end;
- }
- }
- return result;
- }
- }
-
-
- private Vector fSuggestions = new Vector(5);
-
- public void acceptClass(char[] packageName,char[] className,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){
- fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd));
- }
-
- public void acceptField(char[] declaringTypePackageName,char[] declaringTypeName,char[] name,char[] typePackageName,char[] typeName,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){
- fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd));
- }
-
- public void acceptInterface(char[] packageName,char[] interfaceName,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){
- fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd));
- }
-
- public void acceptLocalVariable(char[] name,char[] typePackageName,char[] typeName,int modifiers,int correctionStart,int correctionEnd){
- fSuggestions.addElement(new Suggestion(name, correctionStart, correctionEnd));
- }
-
- public void acceptMethod(char[] declaringTypePackageName,char[] declaringTypeName,char[] selector,char[][] parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] returnTypePackageName,char[] returnTypeName,char[] correctionName,int modifiers,int correctionStart,int correctionEnd){
- fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd));
- }
-
- public void acceptPackage(char[] packageName,char[] correctionName,int correctionStart,int correctionEnd){
- fSuggestions.addElement(new Suggestion(correctionName, correctionStart, correctionEnd));
- }
-
- public String getSuggestions(){
- Suggestion[] suggestions = getSortedSuggestions();
-
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < suggestions.length; i++) {
- if(i != 0)
- result.append('\n');
-
- result.append(suggestions[i].text);
- }
- return result.toString();
- }
-
- public String getStarts(){
- Suggestion[] suggestions = getSortedSuggestions();
-
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < suggestions.length; i++) {
- if(i != 0)
- result.append('\n');
-
- result.append(suggestions[i].start);
- }
- return result.toString();
- }
-
- public String getEnds(){
- Suggestion[] suggestions = getSortedSuggestions();
-
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < suggestions.length; i++) {
- if(i != 0)
- result.append('\n');
-
- result.append(suggestions[i].end);
- }
- return result.toString();
- }
-
- private Suggestion[] getSortedSuggestions(){
- Object[] unsorted = fSuggestions.toArray();
- Suggestion[] sorted = new Suggestion[unsorted.length];
- System.arraycopy(unsorted, 0, sorted, 0, unsorted.length);
- Arrays.sort(sorted, new SuggestionComparator());
- return sorted;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java
deleted file mode 100644
index f6f4aae..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.internal.core.*;
-
-import junit.framework.Test;
-
-public class CompilationUnitTests extends ModifyingResourceTests {
- ICompilationUnit cu;
-
-public CompilationUnitTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- this.createJavaProject("P", new String[] {"src"}, new String[] {getExternalJCLPathString()}, "bin");
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/X.java",
- "/* some comment */" +
- "package p;\n" +
- "import p2.*;\n" +
- "import p3.Z;\n" +
- "public class X implements Runnable {\n" +
- " public int f1;\n" +
- " /** @deprecated\n */" +
- " protected Object f2;\n" +
- " private X f3;\n" +
- " java.lang.String f4;\n" +
- " public class Inner {\n" +
- " class InnerInner {\n" +
- " }\n" +
- " }\n" +
- " public void foo(Y y) throws IOException {\n" +
- " }\n" +
- " protected static Object bar() {\n" +
- " }\n" +
- " /** @deprecated\n */" +
- " private int fred() {\n" +
- " }\n" +
- "}\n" +
- "/** @deprecated\n */" +
- "interface I {\n" +
- " int run();\n" +
- "}");
- this.cu = this.getCompilationUnit("/P/src/p/X.java");
-}
-public static Test suite() {
- return new Suite(CompilationUnitTests.class);
-}
-public void tearDownSuite() throws Exception {
- this.deleteProject("P");
- super.tearDownSuite();
-}
-/**
- * Calls methods that do nothing to ensure code coverage
- */
-public void testCodeCoverage() throws JavaModelException {
- this.cu.destroy();
- this.cu.restore();
-}
-/**
- * Ensures <code>commit(boolean, IProgressMonitor)</code> throws the correct
- * <code>JavaModelException</code> for a <code>CompilationUnit</code>.
- */
-public void testCommit() throws JavaModelException {
- try {
- this.cu.commit(false, null);
- } catch (JavaModelException jme) {
- assertTrue("Incorrect status for committing a CompilationUnit", jme.getStatus().getCode() == JavaModelStatus.INVALID_ELEMENT_TYPES);
- return;
- }
- assertTrue("A compilation unit should throw an exception is a commit is attempted", false);
-}
-/*
- * Ensure that the deprecated flags is correctly reported
- * (regression test fo bug 23207 Flags.isDeprecated(IMethod.getFlags()) doesn't work)
- */
-public void testDeprecatedFlag() throws JavaModelException {
- IType type = this.cu.getType("X");
- assertTrue("Type X should not be deprecated", !Flags.isDeprecated(type.getFlags()));
- assertTrue("Type I should be deprecated", Flags.isDeprecated(this.cu.getType("I").getFlags()));
-
- assertTrue("Field f1 should not be deprecated", !Flags.isDeprecated(type.getField("f1").getFlags()));
- assertTrue("Field f2 should be deprecated", Flags.isDeprecated(type.getField("f2").getFlags()));
-
- assertTrue("Method bar should not be deprecated", !Flags.isDeprecated(type.getMethod("bar", new String[]{}).getFlags()));
- assertTrue("Method fred should be deprecated", Flags.isDeprecated(type.getMethod("fred", new String[]{}).getFlags()));
-}
-/**
- * Ensures <code>getContents()</code> returns the correct value
- * for a <code>CompilationUnit</code> that is not present
- */
-public void testGetContentsForNotPresent() throws JavaModelException {
- CompilationUnit compilationUnit = (CompilationUnit)getCompilationUnit("/P/src/p/Absent.java");
-
- assertSourceEquals("Unexpected contents for non present cu", "", new String(compilationUnit.getContents()));
-}
-/**
- * Tests Java element retrieval via source position
- */
-public void testGetElementAt() throws JavaModelException {
- IType type = this.cu.getType("X");
- ISourceRange sourceRange= type.getSourceRange();
- //ensure that we are into the body of the type
- IJavaElement element=
- this.cu.getElementAt(sourceRange.getOffset() + type.getElementName().length() + 1);
- assertTrue("Should have found a type", element instanceof IType);
- assertEquals(
- "Should have found X",
- "X",
- element.getElementName());
- //ensure that null is returned if there is no element other than the compilation
- //unit itself at the given position
- element= this.cu.getElementAt(this.cu.getSourceRange().getOffset() + 1);
- assertEquals("Should have not found any element", null, element);
-}
-/**
- * Tests import declararion retrieval via source position.
- * (regression test for bug 14331 ICompilationUnit.getElementAt dos not find import decl)
- */
-public void testGetElementAt2() throws JavaModelException {
- IImportContainer container = this.cu.getImportContainer();
- ISourceRange sourceRange= container.getSourceRange();
- //ensure that we are inside the import container
- IJavaElement element= this.cu.getElementAt(sourceRange.getOffset() + 1);
- assertTrue("Should have found an import", element instanceof IImportDeclaration);
- assertEquals(
- "Import not found",
- "p2.*",
- element.getElementName());
-}
-/**
- * Ensures that correct number of fields with the correct names, modifiers, signatures
- * and declaring types exist in a type.
- */
-public void testGetFields() throws JavaModelException {
- IType type = this.cu.getType("X");
- IField[] fields= type.getFields();
- String[] fieldNames = new String[] {"f1", "f2", "f3", "f4"};
- String[] flags = new String[] {"public", "protected", "private", ""};
- String[] signatures = new String[] {"I", "QObject;", "QX;", "Qjava.lang.String;"};
- assertEquals("Wrong number of fields returned", fieldNames.length, fields.length);
- for (int i = 0; i < fields.length; i++) {
- assertEquals("Incorrect name for the " + i + " field", fieldNames[i], fields[i].getElementName());
- String mod= Flags.toString(fields[i].getFlags());
- assertEquals("Unexpected modifier for " + fields[i].getElementName(), flags[i], mod);
- assertEquals("Unexpected type signature for " + fields[i].getElementName(), signatures[i], fields[i].getTypeSignature());
- assertEquals("Unexpected declaring type for " + fields[i].getElementName(), type, fields[i].getDeclaringType());
- assertTrue("Field should exist " + fields[i], fields[i].exists());
- }
-}
-/**
- * Ensure that import declaration handles are returned from the
- * compilation unit.
- * Checks non-existant handle, on demand and not.
- */
-public void testGetImport() throws JavaModelException {
- IImportDeclaration imprt = this.cu.getImport("java.lang");
- assertTrue("Import should not exist " + imprt, !imprt.exists());
-
- imprt = this.cu.getImport("p2.*");
- assertTrue("Import should exist " + imprt, imprt.exists());
-
- imprt = this.cu.getImport("p3.Z");
- assertTrue("Import should exist " + imprt, imprt.exists());
-}
-/**
- * Ensures that correct number of imports with the correct names
- * exist in "GraphicsTest" compilation unit.
- */
-public void testGetImports() throws JavaModelException {
- IImportDeclaration[] imprts = this.cu.getImports();
- IImportContainer container= this.cu.getImportContainer();
- String[] importNames = new String[] {"p2.*", "p3.Z"};
-
- assertEquals("Wrong number of imports returned", importNames.length, imprts.length);
- for (int i = 0; i < imprts.length; i++) {
- assertTrue("Incorrect name for the type in this position: " + imprts[i].getElementName(), imprts[i].getElementName().equals(importNames[i]));
- assertTrue("Import does not exist " + imprts[i], imprts[i].exists());
- if (i == 0) {
- assertTrue("Import is not on demand " + imprts[i], imprts[i].isOnDemand());
- } else {
- assertTrue("Import is on demand " + imprts[i], !imprts[i].isOnDemand());
- }
- assertTrue("Container import does not equal import", container.getImport(imprts[i].getElementName()).equals(imprts[i]));
- }
-
- assertTrue("Import container must exist and have children", container.exists() && container.hasChildren());
- ISourceRange containerRange= container.getSourceRange();
- assertEquals(
- "Offset container range not correct",
- imprts[0].getSourceRange().getOffset(),
- containerRange.getOffset());
- assertEquals(
- "Length container range not correct",
- imprts[imprts.length-1].getSourceRange().getOffset() + imprts[imprts.length-1].getSourceRange().getLength(),
- containerRange.getOffset() + containerRange.getLength());
- assertSourceEquals("Source not correct",
- "import p2.*;\n" +
- "import p3.Z;",
- container.getSource());
-
-}
-/**
- * Ensure that type handles are returned from the
- * compilation unit for an inner type.
- */
-public void testGetInnerTypes() throws JavaModelException {
- IType type1 = cu.getType("X");
- assertTrue("X type should have children", type1.hasChildren());
- assertTrue("X type superclass name should be null", type1.getSuperclassName() == null);
- String[] superinterfaceNames= type1.getSuperInterfaceNames();
- assertEquals("X type should have one superinterface", 1, superinterfaceNames.length);
- assertEquals("Unexpected super interface name", "Runnable", superinterfaceNames[0]);
- assertEquals("Fully qualified name of the type is incorrect", "p.X", type1.getFullyQualifiedName());
- IType type2 = type1.getType("Inner");
- superinterfaceNames = type2.getSuperInterfaceNames();
- assertEquals("X$Inner type should not have a superinterface", 0, superinterfaceNames.length);
- assertEquals("Fully qualified name of the inner type is incorrect", "p.X$Inner", type2.getFullyQualifiedName());
- assertEquals("Declaring type of the inner type is incorrect", type1, type2.getDeclaringType());
- IType type3 = type2.getType("InnerInner");
- assertTrue("InnerInner type should not have children", !type3.hasChildren());
-}
-/**
- * Ensures that a method has the correct return type, parameters and exceptions.
- */
-public void testGetMethod() throws JavaModelException {
- IType type = this.cu.getType("X");
- IMethod foo = type.getMethod("foo", new String[]{"QY;"});
- String[] exceptionTypes= foo.getExceptionTypes();
- assertEquals("Wrong number of exception types", 1, exceptionTypes.length);
- assertEquals("Unxepected exception type", "QIOException;", exceptionTypes[0]);
- assertEquals("Wrong return type", "V", foo.getReturnType());
- String[] parameterNames = foo.getParameterNames();
- assertEquals("Wrong number of parameter names", 1, parameterNames.length);
- assertEquals("Unexpected parameter name", "y", parameterNames[0]);
-}
-/**
- * Ensures that correct number of methods with the correct names and modifiers
- * exist in a type.
- */
-public void testGetMethods() throws JavaModelException {
- IType type = this.cu.getType("X");
- IMethod[] methods= type.getMethods();
- String[] methodNames = new String[] {"foo", "bar", "fred"};
- String[] flags = new String[] {"public", "protected static", "private"};
- assertEquals("Wrong number of methods returned", methodNames.length, methods.length);
- for (int i = 0; i < methods.length; i++) {
- assertEquals("Incorrect name for the " + i + " method", methodNames[i], methods[i].getElementName());
- String mod= Flags.toString(methods[i].getFlags());
- assertEquals("Unexpected modifier for " + methods[i].getElementName(), flags[i], mod);
- assertTrue("Method does not exist " + methods[i], methods[i].exists());
- }
-}
-/**
- * Ensures that correct modifiers are reported for a method in an interface.
- */
-public void testCheckInterfaceMethodModifiers() throws JavaModelException {
- IType type = this.cu.getType("I");
- IMethod method = type.getMethod("run", new String[0]);
- String expectedModifiers = "";
- String modifiers = Flags.toString(method.getFlags());
- assertEquals("Expected modifier for " + method.getElementName(), expectedModifiers, modifiers);
-}
-/**
- * Ensure that <code>null</code> is returned for the original and original element of a
- * compilation unit.
- */
-public void testGetOriginal() throws JavaModelException {
- IJavaElement original = this.cu.getOriginalElement();
- assertTrue("Original for a compilation unit should be null", original == null);
- original = this.cu.getOriginal(this.cu);
- assertTrue("Original for a compilation unit should be null", original == null);
-
-}
-/**
- * Ensures that correct number of package declarations with the correct names
- * exist a compilation unit.
- */
-public void testGetPackages() throws JavaModelException {
- IPackageDeclaration[] packages = this.cu.getPackageDeclarations();
- String packageName = "p";
- assertEquals("Wrong number of packages returned", 1, packages.length);
- assertEquals("Wrong package declaration returned: ", packageName, packages[0].getElementName());
-}
-/**
- * Ensure that type handles are returned from the
- * compilation unit.
- * Checks non-existant handle and existing handles.
- */
-public void testGetType() throws JavaModelException {
- IType type = this.cu.getType("someType");
- assertTrue("Type should not exist " + type, !type.exists());
-
- type = this.cu.getType("X");
- assertTrue("Type should exist " + type, type.exists());
-
- type = this.cu.getType("I"); // secondary type
- assertTrue("Type should exist " + type, type.exists());
-}
-/**
- * Ensures that correct number of types with the correct names and modifiers
- * exist in a compilation unit.
- */
-public void testGetTypes() throws JavaModelException {
- IType[] types = this.cu.getTypes();
- String[] typeNames = new String[] {"X", "I"};
- String[] flags = new String[] {"public", ""};
- assertEquals("Wrong number of types returned", typeNames.length, types.length);
- for (int i = 0; i < types.length; i++) {
- assertEquals("Incorrect name for the " + i + " type", typeNames[i], types[i].getElementName());
- String mod= Flags.toString(types[i].getFlags());
- assertEquals("Unexpected modifier for " + types[i].getElementName(), flags[i], mod);
- assertTrue("Type does not exist " + types[i], types[i].exists());
- }
-}
-/**
- * Ensures that a compilation unit has children.
- */
-public void testHasChildren() throws JavaModelException {
- this.cu.close();
- assertTrue("A closed compilation unit should have children", this.cu.hasChildren());
- this.cu.getChildren();
- assertTrue("The compilation unit should have children", this.cu.hasChildren());
-}
-/**
- * Ensures that a compilation unit is not based on its underlying resource.
- */
-public void testIsBasedOn() throws JavaModelException {
- assertTrue(
- "A compilation unit should not be based on any resource",
- !this.cu.isBasedOn(this.cu.getUnderlyingResource()));
-}
-/**
- * Ensures that a compilation unit that does not exist responds
- * false to #exists() and #isOpen()
- */
-public void testNotPresent1() {
- ICompilationUnit compilationUnit = ((IPackageFragment)this.cu.getParent()).getCompilationUnit("DoesNotExist.java");
- assertTrue("CU should not be open", !compilationUnit.isOpen());
- assertTrue("CU should not exist", !compilationUnit.exists());
- assertTrue("CU should still not be open", !compilationUnit.isOpen());
-}
-/**
- * Ensures that a compilation unit that does not exist
- * (because it is a child of a jar package fragment)
- * responds false to #exists() and #isOpen()
- * (regression test for PR #1G2RKD2)
- */
-public void testNotPresent2() throws CoreException {
- ICompilationUnit compilationUnit = getPackageFragment("P", getExternalJCLPathString(), "java.lang").getCompilationUnit("DoesNotExist.java");
- assertTrue("CU should not be open", !compilationUnit.isOpen());
- assertTrue("CU should not exist", !compilationUnit.exists());
- assertTrue("CU should still not be open", !compilationUnit.isOpen());
-}
-/**
- * Ensures that the "structure is known" flag is set for a valid compilation unit.
- */
-public void testStructureKnownForCU() throws JavaModelException {
- assertTrue("Structure is unknown for valid CU", this.cu.isStructureKnown());
-}
-/**
- * Ensures that the "structure is unknown" flag is set for a non valid compilation unit.
- */
-public void testStructureUnknownForCU() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/Invalid.java",
- "@#D(03");
- ICompilationUnit badCU = getCompilationUnit("/P/src/p/Invalid.java");
- assertTrue("Structure is known for an invalid CU", !badCU.isStructureKnown());
- } finally {
- this.deleteFile("/P/src/p/Invalid.java");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
deleted file mode 100644
index 8f0f07d..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
+++ /dev/null
@@ -1,8294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.ITypeNameRequestor;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.codeassist.RelevanceConstants;
-
-import junit.framework.*;
-
-public class CompletionTests extends AbstractJavaModelTests implements RelevanceConstants {
-
-public CompletionTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- IJavaProject project = setUpJavaProject("Completion");
-
- // dummy query for waiting until the indexes are ready
- SearchEngine engine = new SearchEngine();
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project});
- try {
- engine.searchAllTypeNames(
- project.getProject().getWorkspace(),
- null,
- "!@$#!@".toCharArray(),
- IJavaSearchConstants.PATTERN_MATCH,
- IJavaSearchConstants.CASE_SENSITIVE,
- IJavaSearchConstants.CLASS,
- scope,
- new ITypeNameRequestor() {
- public void acceptClass(
- char[] packageName,
- char[] simpleTypeName,
- char[][] enclosingTypeNames,
- String path) {}
- public void acceptInterface(
- char[] packageName,
- char[] simpleTypeName,
- char[][] enclosingTypeNames,
- String path) {}
- },
- IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null);
- } catch (CoreException e) {
- }
-}
-public void tearDownSuite() throws Exception {
- deleteProject("Completion");
-
- super.tearDownSuite();
-}
-
-
-public static Test suite() {
- TestSuite suite = new Suite(CompletionTests.class.getName());
-
- // completion tests
- suite.addTest(new CompletionTests("testCompletionCaseInsensitive"));
- suite.addTest(new CompletionTests("testCompletionNullRequestor"));
- suite.addTest(new CompletionTests("testCompletionFindExceptions1"));
- suite.addTest(new CompletionTests("testCompletionFindExceptions2"));
- suite.addTest(new CompletionTests("testCompletionFindClass"));
- suite.addTest(new CompletionTests("testCompletionFindClass2"));
- suite.addTest(new CompletionTests("testCompletionFindClassDefaultPackage"));
- suite.addTest(new CompletionTests("testCompletionFindConstructor"));
- suite.addTest(new CompletionTests("testCompletionFindField1"));
- suite.addTest(new CompletionTests("testCompletionFindField2"));
- suite.addTest(new CompletionTests("testCompletionFindField3"));
- suite.addTest(new CompletionTests("testCompletionFindImport1"));
- suite.addTest(new CompletionTests("testCompletionFindImport2"));
- suite.addTest(new CompletionTests("testCompletionFindLocalVariable"));
- suite.addTest(new CompletionTests("testCompletionFindMemberType1"));
- suite.addTest(new CompletionTests("testCompletionFindMemberType2"));
- suite.addTest(new CompletionTests("testCompletionFindMethod1"));
- suite.addTest(new CompletionTests("testCompletionFindMethod2"));
- suite.addTest(new CompletionTests("testCompletionFindMethodInThis"));
- suite.addTest(new CompletionTests("testCompletionFindMethodWhenInProcess"));
- suite.addTest(new CompletionTests("testCompletionFindThisDotField"));
- suite.addTest(new CompletionTests("testCompletionEndOfCompilationUnit"));
- suite.addTest(new CompletionTests("testCompletionOutOfBounds"));
- suite.addTest(new CompletionTests("testCompletionRepeatedType"));
- suite.addTest(new CompletionTests("testCompletionOnClassFile"));
- suite.addTest(new CompletionTests("testCompletionCaseInsensitivePackage"));
- suite.addTest(new CompletionTests("testCompletionFindSuperInterface"));
- suite.addTest(new CompletionTests("testCompletionVisibilityCheckEnabled"));
- suite.addTest(new CompletionTests("testCompletionVisibilityCheckDisabled"));
- suite.addTest(new CompletionTests("testCompletionAmbiguousFieldName"));
- suite.addTest(new CompletionTests("testCompletionAmbiguousFieldName2"));
- suite.addTest(new CompletionTests("testCompletionAmbiguousFieldName3"));
- suite.addTest(new CompletionTests("testCompletionAmbiguousFieldName4"));
- suite.addTest(new CompletionTests("testCompletionPrefixFieldName1"));
- suite.addTest(new CompletionTests("testCompletionPrefixFieldName2"));
- suite.addTest(new CompletionTests("testCompletionPrefixMethodName1"));
- suite.addTest(new CompletionTests("testCompletionPrefixMethodName2"));
- suite.addTest(new CompletionTests("testCompletionPrefixMethodName3"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration2"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration3"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration4"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration5"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration6"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration7"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration8"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration9"));
- suite.addTest(new CompletionTests("testCompletionMethodDeclaration10"));
- suite.addTest(new CompletionTests("testCompletionFieldName"));
- suite.addTest(new CompletionTests("testCompletionLocalName"));
- suite.addTest(new CompletionTests("testCompletionArgumentName"));
- suite.addTest(new CompletionTests("testCompletionCatchArgumentName"));
- suite.addTest(new CompletionTests("testCompletionCatchArgumentName2"));
- suite.addTest(new CompletionTests("testCompletionAmbiguousType"));
- suite.addTest(new CompletionTests("testCompletionAmbiguousType2"));
- suite.addTest(new CompletionTests("testCompletionWithBinaryFolder"));
- suite.addTest(new CompletionTests("testCompletionVariableNameOfArray1"));
- suite.addTest(new CompletionTests("testCompletionVariableNameOfArray2"));
- suite.addTest(new CompletionTests("testCompletionVariableNameOfArray3"));
- suite.addTest(new CompletionTests("testCompletionVariableNameOfArray4"));
- suite.addTest(new CompletionTests("testCompletionVariableNameUnresolvedType"));
- suite.addTest(new CompletionTests("testCompletionSameSuperClass"));
- suite.addTest(new CompletionTests("testCompletionSuperType"));
- suite.addTest(new CompletionTests("testCompletionSuperType2"));
- suite.addTest(new CompletionTests("testCompletionSuperType3"));
- suite.addTest(new CompletionTests("testCompletionSuperType4"));
- suite.addTest(new CompletionTests("testCompletionSuperType5"));
- suite.addTest(new CompletionTests("testCompletionSuperType6"));
- suite.addTest(new CompletionTests("testCompletionSuperType7"));
- suite.addTest(new CompletionTests("testCompletionSuperType8"));
- suite.addTest(new CompletionTests("testCompletionMethodThrowsClause"));
- suite.addTest(new CompletionTests("testCompletionMethodThrowsClause2"));
- suite.addTest(new CompletionTests("testCompletionThrowStatement"));
- suite.addTest(new CompletionTests("testCompletionUnresolvedReturnType"));
- suite.addTest(new CompletionTests("testCompletionUnresolvedParameterType"));
- suite.addTest(new CompletionTests("testCompletionUnresolvedFieldType"));
- suite.addTest(new CompletionTests("testCompletionUnresolvedEnclosingType"));
- suite.addTest(new CompletionTests("testCompletionObjectsMethodWithInterfaceReceiver"));
- suite.addTest(new CompletionTests("testCompletionConstructorForAnonymousType"));
- suite.addTest(new CompletionTests("testCompletionAbstractMethodRelevance1"));
- suite.addTest(new CompletionTests("testCompletionAbstractMethodRelevance2"));
- suite.addTest(new CompletionTests("testCompletionReturnInInitializer"));
- suite.addTest(new CompletionTests("testCompletionVariableName1"));
- suite.addTest(new CompletionTests("testCompletionVariableName2"));
- suite.addTest(new CompletionTests("testCompletionVariableName3"));
- suite.addTest(new CompletionTests("testCompletionOnStaticMember1"));
- suite.addTest(new CompletionTests("testCompletionOnStaticMember2"));
- suite.addTest(new CompletionTests("testCompletionMemberType2"));
- suite.addTest(new CompletionTests("testCompletionAfterCase1"));
- suite.addTest(new CompletionTests("testCompletionAfterCase2"));
- suite.addTest(new CompletionTests("testCompletionToplevelType1"));
- suite.addTest(new CompletionTests("testCompletionLocalType1"));
- suite.addTest(new CompletionTests("testCompletionType1"));
- suite.addTest(new CompletionTests("testCompletionQualifiedAllocationType1"));
-
- // completion expectedTypes tests
- suite.addTest(new CompletionTests("testCompletionReturnStatementIsParent1"));
- suite.addTest(new CompletionTests("testCompletionReturnStatementIsParent2"));
- suite.addTest(new CompletionTests("testCompletionCastIsParent1"));
- suite.addTest(new CompletionTests("testCompletionCastIsParent2"));
- suite.addTest(new CompletionTests("testCompletionMessageSendIsParent1"));
- suite.addTest(new CompletionTests("testCompletionMessageSendIsParent2"));
- suite.addTest(new CompletionTests("testCompletionMessageSendIsParent3"));
- suite.addTest(new CompletionTests("testCompletionMessageSendIsParent4"));
- suite.addTest(new CompletionTests("testCompletionMessageSendIsParent5"));
- suite.addTest(new CompletionTests("testCompletionMessageSendIsParent6"));
- suite.addTest(new CompletionTests("testCompletionAllocationExpressionIsParent1"));
- suite.addTest(new CompletionTests("testCompletionAllocationExpressionIsParent2"));
- suite.addTest(new CompletionTests("testCompletionAllocationExpressionIsParent3"));
- suite.addTest(new CompletionTests("testCompletionAllocationExpressionIsParent4"));
- suite.addTest(new CompletionTests("testCompletionAllocationExpressionIsParent5"));
- suite.addTest(new CompletionTests("testCompletionAllocationExpressionIsParent6"));
- suite.addTest(new CompletionTests("testCompletionFieldInitializer1"));
- suite.addTest(new CompletionTests("testCompletionFieldInitializer2"));
- suite.addTest(new CompletionTests("testCompletionFieldInitializer3"));
- suite.addTest(new CompletionTests("testCompletionFieldInitializer4"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInInitializer1"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInInitializer2"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInInitializer3"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInInitializer4"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInMethod1"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInMethod2"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInMethod3"));
- suite.addTest(new CompletionTests("testCompletionVariableInitializerInMethod4"));
- suite.addTest(new CompletionTests("testCompletionAssignmentInMethod1"));
- suite.addTest(new CompletionTests("testCompletionAssignmentInMethod2"));
- suite.addTest(new CompletionTests("testCompletionAssignmentInMethod3"));
- suite.addTest(new CompletionTests("testCompletionAssignmentInMethod4"));
- suite.addTest(new CompletionTests("testCompletionEmptyTypeName1"));
- suite.addTest(new CompletionTests("testCompletionEmptyTypeName2"));
- suite.addTest(new CompletionTests("testCompletionExpectedTypeIsNotValid"));
- suite.addTest(new CompletionTests("testCompletionMemberType"));
- suite.addTest(new CompletionTests("testCompletionVoidMethod"));
- suite.addTest(new CompletionTests("testCompletionQualifiedExpectedType"));
- suite.addTest(new CompletionTests("testCompletionUnaryOperator1"));
- suite.addTest(new CompletionTests("testCompletionUnaryOperator2"));
- suite.addTest(new CompletionTests("testCompletionBinaryOperator1"));
- suite.addTest(new CompletionTests("testCompletionBinaryOperator2"));
- suite.addTest(new CompletionTests("testCompletionBinaryOperator3"));
- suite.addTest(new CompletionTests("testCompletionInstanceofOperator1"));
- suite.addTest(new CompletionTests("testCompletionConditionalExpression1"));
- suite.addTest(new CompletionTests("testCompletionConditionalExpression2"));
- suite.addTest(new CompletionTests("testCompletionConditionalExpression3"));
- suite.addTest(new CompletionTests("testCompletionArrayAccess1"));
- suite.addTest(new CompletionTests("testCompletionFindSecondaryType1"));
-
- // completion keywords tests
- suite.addTest(new CompletionTests("testCompletionKeywordThis1"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis2"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis3"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis4"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis5"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis6"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis7"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis8"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis9"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis10"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis11"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis12"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis13"));
- suite.addTest(new CompletionTests("testCompletionKeywordThis14"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper1"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper2"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper3"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper4"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper5"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper6"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper7"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper8"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper9"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper10"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper11"));
- suite.addTest(new CompletionTests("testCompletionKeywordSuper12"));
- suite.addTest(new CompletionTests("testCompletionKeywordTry1"));
- suite.addTest(new CompletionTests("testCompletionKeywordTry2"));
- suite.addTest(new CompletionTests("testCompletionKeywordTry3"));
- suite.addTest(new CompletionTests("testCompletionKeywordTry4"));
- suite.addTest(new CompletionTests("testCompletionKeywordTry5"));
- suite.addTest(new CompletionTests("testCompletionKeywordTry6"));
- suite.addTest(new CompletionTests("testCompletionKeywordDo1"));
- suite.addTest(new CompletionTests("testCompletionKeywordDo2"));
- suite.addTest(new CompletionTests("testCompletionKeywordDo3"));
- suite.addTest(new CompletionTests("testCompletionKeywordDo4"));
- suite.addTest(new CompletionTests("testCompletionKeywordDo5"));
- suite.addTest(new CompletionTests("testCompletionKeywordDo6"));
- suite.addTest(new CompletionTests("testCompletionKeywordFor1"));
- suite.addTest(new CompletionTests("testCompletionKeywordFor2"));
- suite.addTest(new CompletionTests("testCompletionKeywordFor3"));
- suite.addTest(new CompletionTests("testCompletionKeywordFor4"));
- suite.addTest(new CompletionTests("testCompletionKeywordFor5"));
- suite.addTest(new CompletionTests("testCompletionKeywordFor6"));
- suite.addTest(new CompletionTests("testCompletionKeywordIf1"));
- suite.addTest(new CompletionTests("testCompletionKeywordIf2"));
- suite.addTest(new CompletionTests("testCompletionKeywordIf3"));
- suite.addTest(new CompletionTests("testCompletionKeywordIf4"));
- suite.addTest(new CompletionTests("testCompletionKeywordIf5"));
- suite.addTest(new CompletionTests("testCompletionKeywordIf6"));
- suite.addTest(new CompletionTests("testCompletionKeywordReturn1"));
- suite.addTest(new CompletionTests("testCompletionKeywordReturn2"));
- suite.addTest(new CompletionTests("testCompletionKeywordReturn3"));
- suite.addTest(new CompletionTests("testCompletionKeywordReturn4"));
- suite.addTest(new CompletionTests("testCompletionKeywordReturn5"));
- suite.addTest(new CompletionTests("testCompletionKeywordReturn6"));
- suite.addTest(new CompletionTests("testCompletionKeywordSwitch1"));
- suite.addTest(new CompletionTests("testCompletionKeywordSwitch2"));
- suite.addTest(new CompletionTests("testCompletionKeywordSwitch3"));
- suite.addTest(new CompletionTests("testCompletionKeywordSwitch4"));
- suite.addTest(new CompletionTests("testCompletionKeywordSwitch5"));
- suite.addTest(new CompletionTests("testCompletionKeywordSwitch6"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrow1"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrow2"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrow3"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrow4"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrow5"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrow6"));
- suite.addTest(new CompletionTests("testCompletionKeywordAssert1"));
- suite.addTest(new CompletionTests("testCompletionKeywordAssert2"));
- suite.addTest(new CompletionTests("testCompletionKeywordAssert3"));
- suite.addTest(new CompletionTests("testCompletionKeywordAssert4"));
- suite.addTest(new CompletionTests("testCompletionKeywordAssert5"));
- suite.addTest(new CompletionTests("testCompletionKeywordAssert6"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse1"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse2"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse3"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse4"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse5"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse6"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse7"));
- suite.addTest(new CompletionTests("testCompletionKeywordElse8"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch1"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch2"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch3"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch4"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch5"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch6"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch7"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch8"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch8"));
- suite.addTest(new CompletionTests("testCompletionKeywordCatch10"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally1"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally2"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally3"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally4"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally5"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally6"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally7"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally8"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally9"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally10"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally11"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally12"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally13"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinally14"));
- suite.addTest(new CompletionTests("testCompletionKeywordContinue1"));
- suite.addTest(new CompletionTests("testCompletionKeywordContinue2"));
- suite.addTest(new CompletionTests("testCompletionKeywordContinue3"));
- suite.addTest(new CompletionTests("testCompletionKeywordContinue4"));
- suite.addTest(new CompletionTests("testCompletionKeywordBreak1"));
- suite.addTest(new CompletionTests("testCompletionKeywordBreak2"));
- suite.addTest(new CompletionTests("testCompletionKeywordBreak3"));
- suite.addTest(new CompletionTests("testCompletionKeywordBreak4"));
- suite.addTest(new CompletionTests("testCompletionKeywordBreak5"));
- suite.addTest(new CompletionTests("testCompletionKeywordBreak6"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile1"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile2"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile3"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile4"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile5"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile6"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile7"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile8"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile9"));
- suite.addTest(new CompletionTests("testCompletionKeywordWhile10"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends1"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends2"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends3"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends4"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends5"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends6"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends7"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends8"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends9"));
- suite.addTest(new CompletionTests("testCompletionKeywordExtends10"));
- suite.addTest(new CompletionTests("testCompletionKeywordImplements1"));
- suite.addTest(new CompletionTests("testCompletionKeywordImplements2"));
- suite.addTest(new CompletionTests("testCompletionKeywordImplements3"));
- suite.addTest(new CompletionTests("testCompletionKeywordImplements4"));
- suite.addTest(new CompletionTests("testCompletionKeywordImplements5"));
- suite.addTest(new CompletionTests("testCompletionKeywordImplements6"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage1"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage2"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage3"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage4"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage5"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage6"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage7"));
- suite.addTest(new CompletionTests("testCompletionKeywordPackage8"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport1"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport2"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport3"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport4"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport5"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport6"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport7"));
- suite.addTest(new CompletionTests("testCompletionKeywordImport8"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase1"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase2"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase3"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase4"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase5"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase6"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase7"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase8"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase9"));
- suite.addTest(new CompletionTests("testCompletionKeywordCase10"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault1"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault2"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault3"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault4"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault5"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault6"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault7"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault8"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault9"));
- suite.addTest(new CompletionTests("testCompletionKeywordDefault10"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass1"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass2"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass3"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass4"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass5"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass6"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass7"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass8"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass9"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass10"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass11"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass12"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass13"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass14"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass15"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass16"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass17"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass18"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass19"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass20"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass21"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass22"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass23"));
- suite.addTest(new CompletionTests("testCompletionKeywordClass24"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface1"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface2"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface3"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface4"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface5"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface6"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface7"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface8"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface9"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface10"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface11"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface12"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface13"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface14"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface15"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface16"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface17"));
- suite.addTest(new CompletionTests("testCompletionKeywordInterface18"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows1"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows2"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows3"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows4"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows5"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows6"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows7"));
- suite.addTest(new CompletionTests("testCompletionKeywordThrows8"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized1"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized2"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized3"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized4"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized5"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized6"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized7"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized8"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized9"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized10"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized11"));
- suite.addTest(new CompletionTests("testCompletionKeywordSynchronized12"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative1"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative2"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative3"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative4"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative5"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative6"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative7"));
- suite.addTest(new CompletionTests("testCompletionKeywordNative8"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp1"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp2"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp3"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp4"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp5"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp6"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp7"));
- suite.addTest(new CompletionTests("testCompletionKeywordStrictfp8"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile1"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile2"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile3"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile4"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile5"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile6"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile7"));
- suite.addTest(new CompletionTests("testCompletionKeywordVolatile8"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient1"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient2"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient3"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient4"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient5"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient6"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient7"));
- suite.addTest(new CompletionTests("testCompletionKeywordTransient8"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew1"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew2"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew3"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew4"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew5"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew6"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew7"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew8"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew9"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew10"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew11"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew12"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew13"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew14"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew15"));
- suite.addTest(new CompletionTests("testCompletionKeywordNew16"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic1"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic2"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic3"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic4"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic5"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic6"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic7"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic8"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic9"));
- suite.addTest(new CompletionTests("testCompletionKeywordStatic10"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic1"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic2"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic3"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic4"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic5"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic6"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic7"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic8"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic9"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic10"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic11"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic12"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic13"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic14"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic15"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic16"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic17"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic18"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic19"));
- suite.addTest(new CompletionTests("testCompletionKeywordPublic20"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate1"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate2"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate3"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate4"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate5"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate6"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate7"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate8"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate9"));
- suite.addTest(new CompletionTests("testCompletionKeywordPrivate10"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected1"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected2"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected3"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected4"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected5"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected6"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected7"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected8"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected9"));
- suite.addTest(new CompletionTests("testCompletionKeywordProtected10"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal1"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal2"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal3"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal4"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal5"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal6"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal7"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal8"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal9"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal10"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal11"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal12"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal13"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal14"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal15"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal16"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal17"));
- suite.addTest(new CompletionTests("testCompletionKeywordFinal18"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract1"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract2"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract3"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract4"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract5"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract6"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract7"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract8"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract9"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract10"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract11"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract12"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract13"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract14"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract15"));
- suite.addTest(new CompletionTests("testCompletionKeywordAbstract16"));
- suite.addTest(new CompletionTests("testCompletionKeywordTrue1"));
- suite.addTest(new CompletionTests("testCompletionKeywordTrue2"));
- suite.addTest(new CompletionTests("testCompletionKeywordTrue3"));
- suite.addTest(new CompletionTests("testCompletionKeywordTrue4"));
- suite.addTest(new CompletionTests("testCompletionKeywordFalse1"));
- suite.addTest(new CompletionTests("testCompletionKeywordFalse2"));
- suite.addTest(new CompletionTests("testCompletionKeywordFalse3"));
- suite.addTest(new CompletionTests("testCompletionKeywordFalse4"));
- suite.addTest(new CompletionTests("testCompletionKeywordNull1"));
- suite.addTest(new CompletionTests("testCompletionKeywordNull2"));
- suite.addTest(new CompletionTests("testCompletionKeywordNull3"));
- suite.addTest(new CompletionTests("testCompletionKeywordNull4"));
- suite.addTest(new CompletionTests("testCompletionKeywordInstanceof1"));
- suite.addTest(new CompletionTests("testCompletionKeywordInstanceof2"));
- suite.addTest(new CompletionTests("testCompletionKeywordInstanceof3"));
- suite.addTest(new CompletionTests("testCompletionKeywordInstanceof4"));
- suite.addTest(new CompletionTests("testCompletionKeywordInstanceof5"));
- suite.addTest(new CompletionTests("testCompletionKeywordInstanceof6"));
-
- // completion tests with position
- suite.addTest(new CompletionTests("testCompletionNonEmptyToken1"));
- suite.addTest(new CompletionTests("testCompletionEmptyToken1"));
-
- return suite;
-}
-/**
- * Ensures that completion is not case sensitive
- */
-public void testCompletionCaseInsensitive() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu = getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitive.java");
-
- String str = cu.getSource();
- String completeBehind = "Field";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals("should have one class",
- "element:field completion:field relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-/**
- * Complete a package in a case insensitive way
- */
-public void testCompletionCaseInsensitivePackage() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitivePackage.java");
-
- String str = cu.getSource();
- String completeBehind = "Ja";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
-
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have package completions",
- "element:jarpack1 completion:jarpack1 relevance:"+(R_DEFAULT + R_INTERESTING)+"\n" +
- "element:jarpack2 completion:jarpack2 relevance:"+(R_DEFAULT + R_INTERESTING)+"\n" +
- "element:java completion:java relevance:"+(R_DEFAULT + R_INTERESTING)+"\n" +
- "element:java.lang completion:java.lang relevance:"+(R_DEFAULT + R_INTERESTING),
- requestor.getResults());
-}
-
-/**
- * Complete at end of file.
- */
-public void testCompletionEndOfCompilationUnit() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu = getCompilationUnit("Completion", "src", "", "CompletionEndOfCompilationUnit.java");
- cu.codeComplete(cu.getSourceRange().getOffset() + cu.getSourceRange().getLength(), requestor);
- assertEquals(
- "should have two methods of 'foo'",
- "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n" +
- "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the type "A" from "new A".
- */
-public void testCompletionFindClass() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindClass.java");
-
- String str = cu.getSource();
- String completeBehind = "A";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
-
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have one class",
- "element:A completion:A relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n" +
- "element:A1 completion:A1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:A2 completion:A2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:A3 completion:A3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:ABC completion:p1.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:ABC completion:p2.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-/**
- * The same type must be find only once
- */
-public void testCompletionFindClass2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindClass2.java");
-
- String str = cu.getSource();
- String completeBehind = "PX";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one classe",
- "element:PX completion:pack1.PX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-
-
-/**
- * Complete the type "Default" in the default package example.
- */
-public void testCompletionFindClassDefaultPackage() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionDefaultPackage.java");
-
- String str = cu.getSource();
- String completeBehind = "Def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one class",
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the constructor "CompletionFindConstructor" from "new CompletionFindConstructor(".
- */
-public void testCompletionFindConstructor() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindConstructor.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionFindConstructor(";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have two constructor (a constructor and an anonymous type)",
- "element:CompletionFindConstructor completion:) relevance:"+(R_DEFAULT + R_INTERESTING)+"\n" +
- "element:CompletionFindConstructor completion:) relevance:"+(R_DEFAULT + R_INTERESTING),
- requestor.getResults());
-}
-
-/**
- * Complete the exception "Exception" in a catch clause.
- */
-public void testCompletionFindExceptions1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException1.java");
-
- String str = cu.getSource();
- String completeBehind = "Ex";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one class",
- "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the exception "Exception" in a throws clause.
- */
-public void testCompletionFindExceptions2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException2.java");
-
- String str = cu.getSource();
- String completeBehind = "Ex";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one class",
- "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the field "var" from "va";
- */
-public void testCompletionFindField1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField1.java");
-
- String str = cu.getSource();
- String completeBehind = "va";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one field: 'var' and one variable: 'var'",
- "element:var completion:this.var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE)+"\n"+
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the field "var" from "this.va";
- */
-public void testCompletionFindField2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField2.java");
-
- String str = cu.getSource();
- String completeBehind = "va";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have 1 field of starting with 'va'",
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionFindField3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField3.java");
-
- String str = cu.getSource();
- String completeBehind = "b.ba";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:bar completion:bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the import, "import pac"
- */
-public void testCompletionFindImport1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindImport1.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have three imports \"pack1\" & \"pack1\" & \"pack1.pack3\" & \"pack2\"",
- "element:pack completion:pack.*; relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:pack1 completion:pack1.*; relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:pack1.pack3 completion:pack1.pack3.*; relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:pack2 completion:pack2.*; relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionFindImport2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindImport2.java");
-
- String str = cu.getSource();
- String completeBehind = "pack1.P";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have six completions",
- "element:PX completion:pack1.PX; relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:pack1.pack3 completion:pack1.pack3.*; relevance:"+(R_DEFAULT + R_INTERESTING),
- requestor.getResults());
-}
-
-/**
- * Complete the local variable "var";
- */
-public void testCompletionFindLocalVariable() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindLocalVariable.java");
-
- String str = cu.getSource();
- String completeBehind = "va";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have one local variable of 'var'",
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the method call "a.foobar" from "a.fooba";
- */
-public void testCompletionFindMethod1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod1.java");
-
- String str = cu.getSource();
- String completeBehind = "fooba";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have two methods of 'foobar'",
- "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED)+"\n" +
- "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-/**
- * Too much Completion match on interface
- */
-public void testCompletionFindMethod2() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod2.java");
-
- String str = cu.getSource();
- String completeBehind = "fooba";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED)+"\n" +
- "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-/**
- * Complete the method call "foobar" from "fooba";
- */
-public void testCompletionFindMethodInThis() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInThis.java");
-
- String str = cu.getSource();
- String completeBehind = "fooba";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have one method of 'foobar'",
- "element:foobar completion:foobar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the method call "foobar" from "fooba". The compilation
- * unit simulates typing in process; ie it has incomplete structure/syntax errors.
- */
-public void testCompletionFindMethodWhenInProcess() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInProcess.java");
-
- String str = cu.getSource();
- String completeBehind = "fooba";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have a method of 'foobar'",
- "element:foobar completion:foobar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
- cu.close();
-}
-
-public void testCompletionFindSuperInterface() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindSuperInterface.java");
-
- String str = cu.getSource();
- String completeBehind = "Super";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:SuperInterface completion:SuperInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Complete the field "bar" from "this.ba"
- */
-public void testCompletionFindThisDotField() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.java");
-
- String str = cu.getSource();
- String completeBehind = "this.ba";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have one result of 'bar'",
- "element:bar completion:bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Attempt to do completion with a null requestor
- */
-public void testCompletionNullRequestor() throws JavaModelException {
- try {
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.java");
- cu.codeComplete(5, (ICompletionRequestor)null);
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Should not be able to do completion with a null requestor", false);
-}
-
-/**
- * Ensures that the code assist features works on class files with associated source.
- */
-public void testCompletionOnClassFile() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- IClassFile cu = getClassFile("Completion", "zzz.jar", "jarpack1", "X.class");
-
- String str = cu.getSource();
- String completeBehind = "Obj";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have one class",
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-/**
- * Test that an out of bounds index causes an exception.
- */
-public void testCompletionOutOfBounds() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOutOfBounds.java");
- try {
- cu.codeComplete(cu.getSource().length() + 1, requestor);
- } catch (JavaModelException e) {
- assertTrue("Should be out of bounds", e.getStatus().getCode() == IJavaModelStatusConstants.INDEX_OUT_OF_BOUNDS);
- return;
- }
- assertTrue("should have failed", false);
-}
-
-/**
- * Complete the type "Repeated", "RepeatedOtherType from "Repeated".
- */
-public void testCompletionRepeatedType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionRepeatedType.java");
-
- String str = cu.getSource();
- String completeBehind = "/**/CompletionRepeated";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
- assertEquals(
- "should have two types",
- "element:CompletionRepeatedOtherType completion:CompletionRepeatedOtherType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionRepeatedType completion:CompletionRepeatedType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionVisibilityCheckEnabled() throws JavaModelException {
- String visibilityCheckID = "org.eclipse.jdt.core.codeComplete.visibilityCheck";
- Hashtable options = JavaCore.getOptions();
- Object visibilityCheckPreviousValue = options.get(visibilityCheckID);
- options.put(visibilityCheckID,"enabled");
- JavaCore.setOptions(options);
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.java");
-
- String str = cu.getSource();
- String completeBehind = "x.p";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- options.put(visibilityCheckID,visibilityCheckPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "should have two methods",
- "element:protectedFoo completion:protectedFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED)+"\n" +
- "element:publicFoo completion:publicFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionVisibilityCheckDisabled() throws JavaModelException {
- String visibilityCheckID = "org.eclipse.jdt.core.codeComplete.visibilityCheck";
- Hashtable options = JavaCore.getOptions();
- Object visibilityCheckPreviousValue = options.get(visibilityCheckID);
- options.put(visibilityCheckID,"disabled");
- JavaCore.setOptions(options);
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.java");
-
- String str = cu.getSource();
- String completeBehind = "x.p";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- options.put(visibilityCheckID,visibilityCheckPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "should have three methods",
- "element:privateFoo completion:privateFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED)+"\n" +
- "element:protectedFoo completion:protectedFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED)+"\n" +
- "element:publicFoo completion:publicFoo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAmbiguousFieldName() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:xBar completion:this.xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAmbiguousFieldName2() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName2.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:xBar completion:CompletionAmbiguousFieldName2.this.xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAmbiguousFieldName3() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName3.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:xBar completion:ClassFoo.this.xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionAmbiguousFieldName4() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName4.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionPrefixFieldName1() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionPrefixFieldName1.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:xBar completion:CompletionPrefixFieldName1.this.xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionPrefixFieldName2() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionPrefixFieldName2.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:xBar completion:xBar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionPrefixMethodName1() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionPrefixMethodName1.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:xBar completion:CompletionPrefixMethodName1.this.xBar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:xBar completion:xBar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-
-public void testCompletionPrefixMethodName2() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionPrefixMethodName2.java");
-
- String str = cu.getSource();
- String completeBehind = "xBa";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:xBar completion:xBar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionPrefixMethodName3() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionPrefixMethodName3.java");
-
- String str = cu.getSource();
- String completeBehind = "xBar(1,";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:xBar completion: relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n" +
- "element:xBar completion:CompletionPrefixMethodName3.this.xBar(1, relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-
-public void testCompletionFindMemberType1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMemberType1.java");
-
- String str = cu.getSource();
- String completeBehind = "Inner";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:B1.Inner1 completion:Inner1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionFindMemberType2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMemberType2.java");
-
- String str = cu.getSource();
- String completeBehind = "Inner";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:B2.Inner2 completion:Inner2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration.java");
-
- String str = cu.getSource();
- String completeBehind = "eq";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:eqFoo completion:public int eqFoo(int a,Object b) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration2() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration2.java");
-
- String str = cu.getSource();
- String completeBehind = "eq";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:eqFoo completion:public int eqFoo(int a,Object b) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-/**
- * Completion should not propose declarations of method already locally implemented
- */
-public void testCompletionMethodDeclaration3() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration3.java");
-
- String str = cu.getSource();
- String completeBehind = "eq";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionMethodDeclaration4() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration4.java");
-
- String str = cu.getSource();
- String completeBehind = "eq";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:eqFoo completion:public int eqFoo(int a,Object b) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD)+"\n"+
- "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration5() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration5.java");
-
- String str = cu.getSource();
- String completeBehind = "new CompletionSuperClass() {";
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:CompletionMethodDeclaration5 completion:CompletionMethodDeclaration5 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:eqFoo completion:public int eqFoo(int a,Object b) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:hashCode completion:public int hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:toString completion:public String toString() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration6() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration6.java");
-
- String str = cu.getSource();
- String completeBehind = "clon";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration7() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration7.java");
-
- String str = cu.getSource();
- String completeBehind = "clon";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration8() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration8.java");
-
- String str = cu.getSource();
- String completeBehind = "clon";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration9() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration9.java");
-
- String str = cu.getSource();
- String completeBehind = "clon";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionMethodDeclaration10() throws JavaModelException {
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration10.java");
-
- String str = cu.getSource();
- String completeBehind = "clon";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:CloneNotSupportedException completion:CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:clone completion:protected Object clone() throws CloneNotSupportedException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionFieldName() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldName.java");
-
- String str = cu.getSource();
- String completeBehind = "ClassWithComplexName ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:classWithComplexName completion:classWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:complexName2 completion:complexName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:withComplexName completion:withComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionLocalName() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionLocalName.java");
-
- String str = cu.getSource();
- String completeBehind = "ClassWithComplexName ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:classWithComplexName completion:classWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:complexName2 completion:complexName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:withComplexName completion:withComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionArgumentName() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArgumentName.java");
-
- String str = cu.getSource();
- String completeBehind = "ClassWithComplexName ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:classWithComplexName completion:classWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:complexName2 completion:complexName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:withComplexName completion:withComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionCatchArgumentName() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCatchArgumentName.java");
-
- String str = cu.getSource();
- String completeBehind = "ex";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:exception completion:exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionAmbiguousType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType.java");
-
- String str = cu.getSource();
- String completeBehind = "ABC";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:ABC completion:p1.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME)+"\n" +
- "element:ABC completion:p2.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-
-
-public void testCompletionAmbiguousType2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType2.java");
-
- String str = cu.getSource();
- String completeBehind = "ABC";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:ABC completion:ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n" +
- "element:ABC completion:p2.ABC relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-
-
-public void testCompletionWithBinaryFolder() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionWithBinaryFolder.java");
-
- String str = cu.getSource();
- String completeBehind = "My";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have two completions",
- "element:MyClass completion:MyClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:mypackage completion:mypackage relevance:"+(R_DEFAULT + R_INTERESTING),
- requestor.getResults());
-}
-
-
-public void testCompletionVariableNameOfArray1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameOfArray1.java");
-
- String str = cu.getSource();
- String completeBehind = "ob";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:objects completion:objects relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionVariableNameOfArray2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameOfArray2.java");
-
- String str = cu.getSource();
- String completeBehind = "cl";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:classes completion:classes relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionVariableNameOfArray3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameOfArray3.java");
-
- String str = cu.getSource();
- String completeBehind = "ob";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have one completion",
- "element:objects completion:objects relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCompletionVariableNameOfArray4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameOfArray4.java");
-
- String str = cu.getSource();
- String completeBehind = "ob";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have no completion",
- "",
- requestor.getResults());
-}
-
-
-public void testCompletionVariableNameUnresolvedType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameUnresolvedType.java");
-
- String str = cu.getSource();
- String completeBehind = "ob";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have no completion",
- "",
- requestor.getResults());
-}
-
-
-public void testCompletionSameSuperClass() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSameSuperClass.java");
-
- String str = cu.getSource();
- String completeBehind = "bar";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "should have five completions",
- "element:bar completion:CompletionSameSuperClass.this.bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME)+"\n"+
- "element:bar completion:CompletionSameSuperClass.this.bar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME)+"\n"+
- "element:bar completion:bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n"+
- "element:bar completion:bar() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n"+
- "element:bar completion:this.bar relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-
-public void testCompletionSuperType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuperClass.";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperClass.Inner completion:Inner relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS),
- requestor.getResults());
-}
-
-public void testCompletionSuperType2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType2.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuper";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperClass completion:CompletionSuperClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperClass2 completion:CompletionSuperClass2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperInterface completion:CompletionSuperInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperInterface2 completion:CompletionSuperInterface2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType completion:CompletionSuperType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType2 completion:CompletionSuperType2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType3 completion:CompletionSuperType3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType4 completion:CompletionSuperType4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType5 completion:CompletionSuperType5 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType6 completion:CompletionSuperType6 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType7 completion:CompletionSuperType7 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType8 completion:CompletionSuperType8 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionSuperType3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType3.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuper";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperClass completion:CompletionSuperClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperClass2 completion:CompletionSuperClass2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperInterface completion:CompletionSuperInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperInterface2 completion:CompletionSuperInterface2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType completion:CompletionSuperType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType2 completion:CompletionSuperType2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType3 completion:CompletionSuperType3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType4 completion:CompletionSuperType4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType5 completion:CompletionSuperType5 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType6 completion:CompletionSuperType6 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType7 completion:CompletionSuperType7 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType8 completion:CompletionSuperType8 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionSuperType4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType4.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuperClass2.Inner";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperClass2.InnerClass completion:InnerClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS)+"\n" +
- "element:CompletionSuperClass2.InnerInterface completion:InnerInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCompletionSuperType5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType5.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuperInterface2.Inner";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperInterface2.InnerClass completion:InnerClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:CompletionSuperInterface2.InnerInterface completion:InnerInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE),
- requestor.getResults());
-}
-
-public void testCompletionSuperType6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType6.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuper";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperClass completion:CompletionSuperClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperClass2 completion:CompletionSuperClass2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperInterface completion:CompletionSuperInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperInterface2 completion:CompletionSuperInterface2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType completion:CompletionSuperType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType2 completion:CompletionSuperType2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType3 completion:CompletionSuperType3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType4 completion:CompletionSuperType4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType5 completion:CompletionSuperType5 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType6 completion:CompletionSuperType6 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType7 completion:CompletionSuperType7 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED)+"\n" +
- "element:CompletionSuperType8 completion:CompletionSuperType8 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionSuperType7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType7.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuperClass2.Inner";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperClass2.InnerClass completion:InnerClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:CompletionSuperClass2.InnerInterface completion:InnerInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE),
- requestor.getResults());
-}
-
-public void testCompletionSuperType8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSuperType8.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionSuperInterface2.Inner";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionSuperInterface2.InnerClass completion:InnerClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:CompletionSuperInterface2.InnerInterface completion:InnerInterface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE),
- requestor.getResults());
-}
-
-public void testCompletionMethodThrowsClause() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause.java");
-
- String str = cu.getSource();
- String completeBehind = "Ex";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMethodThrowsClause2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause2.java");
-
- String str = cu.getSource();
- String completeBehind = "Ex";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Exception completion:java.lang.Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION),
- requestor.getResults());
-}
-
-public void testCompletionThrowStatement() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionThrowStatement.java");
-
- String str = cu.getSource();
- String completeBehind = "Ex";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Exception completion:Exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionUnresolvedReturnType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedReturnType.java");
-
- String str = cu.getSource();
- String completeBehind = "bar";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:barPlus completion:barPlus() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionUnresolvedParameterType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedParameterType.java");
-
- String str = cu.getSource();
- String completeBehind = "bar";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:barPlus completion:barPlus() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionUnresolvedFieldType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedFieldType.java");
-
- String str = cu.getSource();
- String completeBehind = "bar";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:barPlus completion:barPlus() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
- * bug : http://dev.eclipse.org/bugs/show_bug.cgi?id=24440
- */
-public void testCompletionUnresolvedEnclosingType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedEnclosingType.java");
-
- String str = cu.getSource();
- String completeBehind = "new ZZZ(";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertTrue(
- requestor.getResults().length() == 0);
-}
-public void testCompletionReturnStatementIsParent1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zz00 completion:zz00 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz00M completion:zz00M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz01 completion:zz01 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz01M completion:zz01M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz02 completion:zz02 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz02M completion:zz02M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz10 completion:zz10 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz10M completion:zz10M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz11 completion:zz11 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz11M completion:zz11M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz12 completion:zz12 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz12M completion:zz12M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz20 completion:zz20 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz20M completion:zz20M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz21 completion:zz21 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz21M completion:zz21M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz22 completion:zz22 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz22M completion:zz22M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzOb completion:zzOb relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzObM completion:zzObM() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionReturnStatementIsParent2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent2.java");
-
- String str = cu.getSource();
- String completeBehind = "xx";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:XX00 completion:XX00 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX01 completion:XX01 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX02 completion:XX02 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX10 completion:XX10 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX11 completion:XX11 relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:XX12 completion:XX12 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX20 completion:XX20 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX21 completion:XX21 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX22 completion:XX22 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionCastIsParent1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zz00 completion:zz00 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz00M completion:zz00M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz01 completion:zz01 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz01M completion:zz01M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz02 completion:zz02 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz02M completion:zz02M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz10 completion:zz10 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz10M completion:zz10M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz11 completion:zz11 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz11M completion:zz11M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz12 completion:zz12 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz12M completion:zz12M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz20 completion:zz20 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz20M completion:zz20M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz21 completion:zz21 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz21M completion:zz21M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zz22 completion:zz22 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zz22M completion:zz22M() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzOb completion:zzOb relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzObM completion:zzObM() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionCastIsParent2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent2.java");
-
- String str = cu.getSource();
- String completeBehind = "xx";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:XX00 completion:XX00 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX01 completion:XX01 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX02 completion:XX02 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX10 completion:XX10 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX11 completion:XX11 relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:XX12 completion:XX12 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX20 completion:XX20 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX21 completion:XX21 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n" +
- "element:XX22 completion:XX22 relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMessageSendIsParent1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMessageSendIsParent2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMessageSendIsParent3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent3.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMessageSendIsParent4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent4.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMessageSendIsParent5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent5.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionMessageSendIsParent6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent6.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAllocationExpressionIsParent1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAllocationExpressionIsParent2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAllocationExpressionIsParent3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent3.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAllocationExpressionIsParent4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent4.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAllocationExpressionIsParent5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent5.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAllocationExpressionIsParent6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent6.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionFieldInitializer1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionFieldInitializer2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionFieldInitializer3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer3.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionFieldInitializer4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer4.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionVariableInitializerInInitializer1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionVariableInitializerInInitializer2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionVariableInitializerInInitializer3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer3.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionVariableInitializerInInitializer4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer4.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionVariableInitializerInMethod1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionVariableInitializerInMethod2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionVariableInitializerInMethod3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod3.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionVariableInitializerInMethod4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod4.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionAssignmentInMethod1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAssignmentInMethod2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzObject completion:zzObject relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:zzboolean completion:zzboolean relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzdouble completion:zzdouble relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzint completion:zzint relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:zzlong completion:zzlong relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAssignmentInMethod3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod3.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-
-public void testCompletionAssignmentInMethod4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod4.java");
-
- String str = cu.getSource();
- String completeBehind = "Objec";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Object completion:Object relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=24565
-*/
-public void testCompletionObjectsMethodWithInterfaceReceiver() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionObjectsMethodWithInterfaceReceiver.java");
-
- String str = cu.getSource();
- String completeBehind = "hash";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=24939
-*/
-public void testCompletionConstructorForAnonymousType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConstructorForAnonymousType.java");
-
- String str = cu.getSource();
- String completeBehind = "TypeWithConstructor(";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:TypeWithConstructor completion:) relevance:"+(R_DEFAULT + R_INTERESTING),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221
-*/
-public void testCompletionEmptyTypeName1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName1.java");
-
- String str = cu.getSource();
- String completeBehind = "new ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:A completion:A relevance:" +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:CompletionEmptyTypeName1 completion:CompletionEmptyTypeName1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221
-*/
-public void testCompletionEmptyTypeName2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName2.java");
-
- String str = cu.getSource();
- String completeBehind = " = ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:A completion:A relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:CompletionEmptyTypeName2 completion:CompletionEmptyTypeName2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:a completion:a relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:clone completion:clone() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:getClass completion:getClass() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:hashCode completion:hashCode() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:toString completion:toString() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578
-*/
-public void testCompletionAbstractMethodRelevance1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAbstractMethodRelevance1.java");
-
- String str = cu.getSource();
- String completeBehind = "foo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:foo1 completion:public void foo1() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:foo2 completion:public void foo2() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD)+"\n" +
- "element:foo3 completion:public void foo3() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578
-*/
-public void testCompletionAbstractMethodRelevance2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAbstractMethodRelevance2.java");
-
- String str = cu.getSource();
- String completeBehind = "eq";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:eqFoo completion:public int eqFoo(int a,Object b) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD)+"\n" +
- "element:equals completion:public boolean equals(Object obj) relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25591
-*/
-public void testCompletionReturnInInitializer() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnInInitializer.java");
-
- String str = cu.getSource();
- String completeBehind = "eq";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:equals completion:equals() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811
-*/
-public void testCompletionVariableName1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName1.java");
-
- String str = cu.getSource();
- String completeBehind = "TEST_FOO_MyClass ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class1 completion:class1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:myClass completion:myClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811
-*/
-public void testCompletionVariableName2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName2.java");
-
- String str = cu.getSource();
- String completeBehind = "Test_Bar_MyClass ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:bar_MyClass completion:bar_MyClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:class1 completion:class1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:myClass completion:myClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n" +
- "element:test_Bar_MyClass completion:test_Bar_MyClass relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25820
-*/
-public void testCompletionExpectedTypeIsNotValid() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExpectedTypeIsNotValid.java");
-
- String str = cu.getSource();
- String completeBehind = "new ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionExpectedTypeIsNotValid completion:CompletionExpectedTypeIsNotValid relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815
-*/
-public void testCompletionMemberType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMemberType.java");
-
- String str = cu.getSource();
- String completeBehind = "new ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionMemberType completion:CompletionMemberType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:Y completion:Y relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815
-*/
-public void testCompletionVoidMethod() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVoidMethod.java");
-
- String str = cu.getSource();
- String completeBehind = "foo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:foo1 completion:foo1() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED)+"\n" +
- "element:foo3 completion:foo3() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890
-*/
-public void testCompletionOnStaticMember1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember1.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890
-*/
-public void testCompletionOnStaticMember2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember2.java");
-
- String str = cu.getSource();
- String completeBehind = "method";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:method1 completion:method1() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:method2 completion:method2() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_UNQUALIFIED),
- requestor.getResults());
-}
-/*
-* http://dev.eclipse.org/bugs/show_bug.cgi?id=26677
-*/
-public void testCompletionQualifiedExpectedType() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionQualifiedExpectedType.java");
-
- String str = cu.getSource();
- String completeBehind = "new ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionQualifiedExpectedType completion:CompletionQualifiedExpectedType relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:PX completion:pack2.PX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE),
- requestor.getResults());
-}
-public void testCompletionUnaryOperator1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator1.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionUnaryOperator2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator2.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionBinaryOperator1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator1.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE),
- requestor.getResults());
-}
-public void testCompletionBinaryOperator2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator2.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionBinaryOperator3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator3.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionInstanceofOperator1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInstanceofOperator1.java");
-
- String str = cu.getSource();
- String completeBehind = "x instanceof WWWCompletionInstanceof";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:WWWCompletionInstanceof1 completion:WWWCompletionInstanceof1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE)+"\n" +
- "element:WWWCompletionInstanceof2 completion:WWWCompletionInstanceof2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:WWWCompletionInstanceof3 completion:WWWCompletionInstanceof3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE)+"\n" +
- "element:WWWCompletionInstanceof4 completion:WWWCompletionInstanceof4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionConditionalExpression1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression1.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionConditionalExpression2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression2.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionConditionalExpression3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression3.java");
-
- String str = cu.getSource();
- String completeBehind = "var";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:var1 completion:var1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE)+"\n" +
- "element:var2 completion:var2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var3 completion:var3 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n" +
- "element:var4 completion:var4 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordThis1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis1.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis2.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis3.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThis4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis4.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis5.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThis6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis6.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis7.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSuper1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper1.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper2.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper3.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper4.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper5.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper6.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE) + "\n" +
- "element:super completion:super() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTry1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry1.java");
-
- String str = cu.getSource();
- String completeBehind = "tr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:try completion:try relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTry2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry2.java");
-
- String str = cu.getSource();
- String completeBehind = "tr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTry3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry3.java");
-
- String str = cu.getSource();
- String completeBehind = "try";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordDo1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo1.java");
-
- String str = cu.getSource();
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:do completion:do relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME)+"\n"+
- "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDo2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo2.java");
-
- String str = cu.getSource();
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDo3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo3.java");
-
- String str = cu.getSource();
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFor1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor1.java");
-
- String str = cu.getSource();
- String completeBehind = "fo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:for completion:for relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFor2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor2.java");
-
- String str = cu.getSource();
- String completeBehind = "fo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFor3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor3.java");
-
- String str = cu.getSource();
- String completeBehind = "fo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordIf1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf1.java");
-
- String str = cu.getSource();
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:if completion:if relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-public void testCompletionKeywordIf2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf2.java");
-
- String str = cu.getSource();
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordIf3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf3.java");
-
- String str = cu.getSource();
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordReturn1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn1.java");
-
- String str = cu.getSource();
- String completeBehind = "re";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:return completion:return relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordReturn2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn2.java");
-
- String str = cu.getSource();
- String completeBehind = "re";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordReturn3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn3.java");
-
- String str = cu.getSource();
- String completeBehind = "re";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSwitch1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch1.java");
-
- String str = cu.getSource();
- String completeBehind = "sw";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:switch completion:switch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSwitch2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch2.java");
-
- String str = cu.getSource();
- String completeBehind = "sw";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSwitch3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch3.java");
-
- String str = cu.getSource();
- String completeBehind = "sw";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThrow1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow1.java");
-
- String str = cu.getSource();
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:throw completion:throw relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrow2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow2.java");
-
- String str = cu.getSource();
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordThrow3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow3.java");
-
- String str = cu.getSource();
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordAssert1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert1.java");
-
- String str = cu.getSource();
- String completeBehind = "as";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:assert completion:assert relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAssert2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert2.java");
-
- String str = cu.getSource();
- String completeBehind = "as";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordAssert3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert3.java");
-
- String str = cu.getSource();
- String completeBehind = "as";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordElse1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse1.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:else completion:else relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordElse2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse2.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordElse3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse3.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordElse4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse4.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch1.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCatch2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch2.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch3.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch4.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch5.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:catchz completion:catchz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally1.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally2.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinally3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally3.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinally4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally4.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinally5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally5.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally6.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally7.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordContinue1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue1.java");
-
- String str = cu.getSource();
- String completeBehind = "cont";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:continue completion:continue relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordContinue2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue2.java");
-
- String str = cu.getSource();
- String completeBehind = "cont";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordBreak1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak1.java");
-
- String str = cu.getSource();
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordBreak2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak2.java");
-
- String str = cu.getSource();
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordBreak3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak3.java");
-
- String str = cu.getSource();
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordWhile1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile1.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordWhile2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile2.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordWhile3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile3.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordWhile4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile4.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordWhile5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile5.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordExtends1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends1.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:extends completion:extends relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordExtends2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends2.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordExtends3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends3.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordExtends4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends4.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:extends completion:extends relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordExtends5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends5.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordImplements1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements1.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:implements completion:implements relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImplements2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements2.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:implements completion:implements relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImplements3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements3.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage1.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:package completion:package relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPackage2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage2.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage3.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage4.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordImport1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport1.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImport2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport2.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImport3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport3.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImport4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport4.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCase1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase1.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase2.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase3.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase4.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase5.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordDefault1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault1.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault2.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault3.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault4.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault5.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordClass1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass1.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass2.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass3.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass4.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass5.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass6.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass7.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass8.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass9.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass10.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass11.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass12.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface1.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface2.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface3.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface4.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface5.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface6.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface7.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface8.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface9.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrows1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows1.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrows2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows2.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThrows3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows3.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrows4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows4.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized1.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:synchronized completion:synchronized relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized2.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized3.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:synchronized completion:synchronized relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized4.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized5.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:synchronized completion:synchronized relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized6.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNative1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative1.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:native completion:native relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNative2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative2.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNative3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative3.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:native completion:native relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNative4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative4.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp1.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp2.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp3.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp4.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile1.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:volatile completion:volatile relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile2.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile3.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:volatile completion:volatile relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile4.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordTransient1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient1.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:transient completion:transient relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTransient2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient2.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordTransient3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient3.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:transient completion:transient relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTransient4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient4.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNew1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew1.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew2.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew3.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew4.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew5.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew6.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew7.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew8.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic1.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic2.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic3.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic4.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordStatic5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic5.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic1.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic2.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic3.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic4.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic5.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic6.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic7.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic8.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic9.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate1.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate2.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate3.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate4.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate5.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordProtected1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected1.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordProtected2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected2.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordProtected3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected3.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordProtected4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected4.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordProtected5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected5.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinal1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal1.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal2.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinal3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal3.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal4.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal5.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal6.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinal7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal7.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal8.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal9.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE +R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract1.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract2.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract3.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract4.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract5.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract6.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract7.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract8.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTrue1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue1.java");
-
- String str = cu.getSource();
- String completeBehind = "tru";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordTrue2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue2.java");
-
- String str = cu.getSource();
- String completeBehind = "tru";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFalse1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse1.java");
-
- String str = cu.getSource();
- String completeBehind = "fal";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFalse2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse2.java");
-
- String str = cu.getSource();
- String completeBehind = "fal";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:false completion:false relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNull1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull1.java");
-
- String str = cu.getSource();
- String completeBehind = "nul";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNull2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull2.java");
-
- String str = cu.getSource();
- String completeBehind = "nul";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:null completion:null relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInstanceof1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof1.java");
-
- String str = cu.getSource();
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:instanceof completion:instanceof relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInstanceof2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof2.java");
-
- String str = cu.getSource();
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordInstanceof3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof3.java");
-
- String str = cu.getSource();
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-
-public void testCompletionKeywordThis8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis8.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis9.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis10.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThis11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis11.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis12.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThis13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis13.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThis14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis14.java");
-
- String str = cu.getSource();
- String completeBehind = "thi";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSuper7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper7.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper8.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper9.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper10.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper11.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordSuper12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper12.java");
-
- String str = cu.getSource();
- String completeBehind = "sup";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SuperClass completion:SuperClass relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:SuperInterface completion:SuperInterface relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED) + "\n" +
- "element:super completion:super relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE) + "\n" +
- "element:super completion:super() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTry4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry4.java");
-
- String str = cu.getSource();
- String completeBehind = "tr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:try completion:try relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTry5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry5.java");
-
- String str = cu.getSource();
- String completeBehind = "tr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTry6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry6.java");
-
- String str = cu.getSource();
- String completeBehind = "try";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordDo4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo4.java");
-
- String str = cu.getSource();
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:do completion:do relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME)+"\n"+
- "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDo5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo5.java");
-
- String str = cu.getSource();
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDo6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo6.java");
-
- String str = cu.getSource();
- String completeBehind = "do";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:double completion:double relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFor4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor4.java");
-
- String str = cu.getSource();
- String completeBehind = "fo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:for completion:for relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFor5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor5.java");
-
- String str = cu.getSource();
- String completeBehind = "fo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:foo completion:foo() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFor6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor6.java");
-
- String str = cu.getSource();
- String completeBehind = "fo";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordIf4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf4.java");
-
- String str = cu.getSource();
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:if completion:if relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-public void testCompletionKeywordIf5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf5.java");
-
- String str = cu.getSource();
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordIf6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf6.java");
-
- String str = cu.getSource();
- String completeBehind = "if";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordReturn4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn4.java");
-
- String str = cu.getSource();
- String completeBehind = "re";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:return completion:return relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordReturn5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn5.java");
-
- String str = cu.getSource();
- String completeBehind = "re";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordReturn6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn6.java");
-
- String str = cu.getSource();
- String completeBehind = "re";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSwitch4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch4.java");
-
- String str = cu.getSource();
- String completeBehind = "sw";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:switch completion:switch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSwitch5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch5.java");
-
- String str = cu.getSource();
- String completeBehind = "sw";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSwitch6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch6.java");
-
- String str = cu.getSource();
- String completeBehind = "sw";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThrow4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow4.java");
-
- String str = cu.getSource();
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:throw completion:throw relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrow5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow5.java");
-
- String str = cu.getSource();
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordThrow6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow6.java");
-
- String str = cu.getSource();
- String completeBehind = "thr";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Throwable completion:Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordAssert4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert4.java");
-
- String str = cu.getSource();
- String completeBehind = "as";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:assert completion:assert relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAssert5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert5.java");
-
- String str = cu.getSource();
- String completeBehind = "as";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordAssert6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert6.java");
-
- String str = cu.getSource();
- String completeBehind = "as";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordElse5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse5.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:else completion:else relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordElse6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse6.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordElse7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse7.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordElse8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse8.java");
-
- String str = cu.getSource();
- String completeBehind = "els";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch6.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCatch7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch7.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch8.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch9.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordCatch10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch10.java");
-
- String str = cu.getSource();
- String completeBehind = "cat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:catch completion:catch relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:catchz completion:catchz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally8.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally9.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinally10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally10.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinally11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally11.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinally12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally12.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally13.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finally completion:finally relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFinally14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally14.java");
-
- String str = cu.getSource();
- String completeBehind = "finall";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:finallyz completion:finallyz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordContinue3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue3.java");
-
- String str = cu.getSource();
- String completeBehind = "cont";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:continue completion:continue relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordContinue4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue4.java");
-
- String str = cu.getSource();
- String completeBehind = "cont";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordBreak4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak4.java");
-
- String str = cu.getSource();
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordBreak5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak5.java");
-
- String str = cu.getSource();
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordBreak6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak6.java");
-
- String str = cu.getSource();
- String completeBehind = "bre";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:break completion:break relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordWhile6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile6.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordWhile7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile7.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordWhile8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile8.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordWhile9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile9.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordWhile10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile10.java");
-
- String str = cu.getSource();
- String completeBehind = "wh";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:while completion:while relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordExtends6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends6.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:extends completion:extends relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordExtends7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends7.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordExtends8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends8.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordExtends9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends9.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:extends completion:extends relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordExtends10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends10.java");
-
- String str = cu.getSource();
- String completeBehind = "ext";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordImplements4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements4.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:implements completion:implements relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImplements5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements5.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:implements completion:implements relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImplements6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements6.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage5.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage6.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage7.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPackage8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage8.java");
-
- String str = cu.getSource();
- String completeBehind = "pac";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordImport5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport5.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImport6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport6.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordImport7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport7.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordImport8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport8.java");
-
- String str = cu.getSource();
- String completeBehind = "imp";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:import completion:import relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase6.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase7.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase8.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase9.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:case completion:case relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordCase10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase10.java");
-
- String str = cu.getSource();
- String completeBehind = "cas";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordDefault6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault6.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault7.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault8.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:default completion:default relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault9.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordDefault10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault10.java");
-
- String str = cu.getSource();
- String completeBehind = "def";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Default completion:Default relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordClass13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass13.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass14.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass15() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass15.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass16() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass16.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass17() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass17.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass18() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass18.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass19() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass19.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass20() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass20.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass21() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass21.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass22() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass22.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass23() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass23.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordClass24() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass24.java");
-
- String str = cu.getSource();
- String completeBehind = "cla";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:Class completion:Class relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:ClassWithComplexName completion:ClassWithComplexName relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface1.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface11.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface12.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface13.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface14.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface15() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface15.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface16() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface16.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface17() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface17.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInterface18() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface18.java");
-
- String str = cu.getSource();
- String completeBehind = "interf";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:interface completion:interface relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrows5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows5.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrows6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows6.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordThrows7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows7.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordThrows8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows8.java");
-
- String str = cu.getSource();
- String completeBehind = "thro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:throws completion:throws relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized7.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:synchronized completion:synchronized relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized8.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized9.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:synchronized completion:synchronized relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized10.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized11.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:synchronized completion:synchronized relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordSynchronized12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized12.java");
-
- String str = cu.getSource();
- String completeBehind = "syn";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNative5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative5.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:native completion:native relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNative6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative6.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNative7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative7.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:native completion:native relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNative8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative8.java");
-
- String str = cu.getSource();
- String completeBehind = "nat";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp5.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp6.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp7.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:strictfp completion:strictfp relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStrictfp8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp8.java");
-
- String str = cu.getSource();
- String completeBehind = "stric";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile5.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:volatile completion:volatile relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile6.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile7.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:volatile completion:volatile relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordVolatile8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile8.java");
-
- String str = cu.getSource();
- String completeBehind = "vol";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordTransient5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient5.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:transient completion:transient relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTransient6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient6.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordTransient7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient7.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:transient completion:transient relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTransient8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient8.java");
-
- String str = cu.getSource();
- String completeBehind = "tran";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNew9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew9.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew10.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew11.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew12.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew13.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew14.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew15() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew15.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNew16() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew16.java");
-
- String str = cu.getSource();
- String completeBehind = "ne";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:new completion:new relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic6.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic7.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic8.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordStatic9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic9.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordStatic10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic10.java");
-
- String str = cu.getSource();
- String completeBehind = "sta";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:static completion:static relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic20() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic11.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic12.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic13.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic14.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic15() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic15.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic16() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic16.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPublic17() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic17.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic18() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic18.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPublic19() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic19.java");
-
- String str = cu.getSource();
- String completeBehind = "pub";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:public completion:public relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate6.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate7.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate8.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:private completion:private relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate9.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordPrivate10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate10.java");
-
- String str = cu.getSource();
- String completeBehind = "pri";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordProtected6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected6.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordProtected7() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected7.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordProtected8() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected8.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:protected completion:protected relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordProtected9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected9.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordProtected10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected10.java");
-
- String str = cu.getSource();
- String completeBehind = "pro";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinal18() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal18.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:finalize() relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal10.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal11.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinal12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal12.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal13.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal14.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal15() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal15.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFinal16() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal16.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:finalize completion:protected void finalize() throws Throwable relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFinal17() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal17.java");
-
- String str = cu.getSource();
- String completeBehind = "fin";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:final completion:final relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract9() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract9.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract10() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract10.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract11() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract11.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract12() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract12.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract13() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract13.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract14() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract14.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract15() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract15.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordAbstract16() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract16.java");
-
- String str = cu.getSource();
- String completeBehind = "abs";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:abstract completion:abstract relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordTrue3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue3.java");
-
- String str = cu.getSource();
- String completeBehind = "tru";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordTrue4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue4.java");
-
- String str = cu.getSource();
- String completeBehind = "tru";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:true completion:true relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordFalse3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse3.java");
-
- String str = cu.getSource();
- String completeBehind = "fal";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordFalse4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse4.java");
-
- String str = cu.getSource();
- String completeBehind = "fal";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:false completion:false relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordNull3() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull3.java");
-
- String str = cu.getSource();
- String completeBehind = "nul";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordNull4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull4.java");
-
- String str = cu.getSource();
- String completeBehind = "nul";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:null completion:null relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInstanceof4() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof4.java");
-
- String str = cu.getSource();
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:instanceof completion:instanceof relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-public void testCompletionKeywordInstanceof5() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof5.java");
-
- String str = cu.getSource();
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionKeywordInstanceof6() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof6.java");
-
- String str = cu.getSource();
- String completeBehind = "ins";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "",
- requestor.getResults());
-}
-public void testCompletionMemberType2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMemberType2.java");
-
- String str = cu.getSource();
- String completeBehind = "new ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionMemberType2 completion:CompletionMemberType2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:CompletionMemberType2.MemberException completion:MemberException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION),
- requestor.getResults());
-}
-public void testCompletionAfterCase1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzz completion:zzz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionAfterCase2() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase2.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzz completion:zzz relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionToplevelType1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "p3", "CompletionToplevelType1.java");
-
- String str = cu.getSource();
- String completeBehind = "CompletionToplevelType1";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionToplevelType1 completion:CompletionToplevelType1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME),
- requestor.getResults());
-}
-public void testCompletionCatchArgumentName2() throws JavaModelException {
- Hashtable options = JavaCore.getOptions();
- Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_ARGUMENT_PREFIXES);
- options.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES,"arg"); //$NON-NLS-1$
- Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
- options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"loc"); //$NON-NLS-1$
-
- JavaCore.setOptions(options);
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCatchArgumentName2.java");
-
- String str = cu.getSource();
- String completeBehind = "Exception ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- options.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES,argumentPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,localPrefixPreviousValue);
- JavaCore.setOptions(options);
-
- assertEquals(
- "element:exception completion:exception relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:locException completion:locException relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX),
- requestor.getResults());
-}
-public void testCompletionArrayAccess1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArrayAccess1.java");
-
- String str = cu.getSource();
- String completeBehind = "zzz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzz1 completion:zzz1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:zzz2 completion:zzz2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE +R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionVariableName3() throws JavaModelException {
- Hashtable options = JavaCore.getOptions();
- Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
- options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"p1,p2"); //$NON-NLS-1$
- Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
- options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"s1,s2"); //$NON-NLS-1$
-
- JavaCore.setOptions(options);
-
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName3.java");
-
- String str = cu.getSource();
- String completeBehind = "OneName ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
- JavaCore.setOptions(options);
-
- assertEquals(
- "element:name completion:name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:names1 completion:names1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX)+"\n"+
- "element:names2 completion:names2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX)+"\n"+
- "element:oneName completion:oneName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE)+"\n"+
- "element:oneNames1 completion:oneNames1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX)+"\n"+
- "element:oneNames2 completion:oneNames2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX)+"\n"+
- "element:p1Name completion:p1Name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX)+"\n"+
- "element:p1Names1 completion:p1Names1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX)+"\n"+
- "element:p1Names2 completion:p1Names2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX)+"\n"+
- "element:p1OneName completion:p1OneName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX)+"\n"+
- "element:p1OneNames1 completion:p1OneNames1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX)+"\n"+
- "element:p1OneNames2 completion:p1OneNames2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX)+"\n"+
- "element:p2Name completion:p2Name relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX)+"\n"+
- "element:p2Names1 completion:p2Names1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX)+"\n"+
- "element:p2Names2 completion:p2Names2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX)+"\n"+
- "element:p2OneName completion:p2OneName relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX)+"\n"+
- "element:p2OneNames1 completion:p2OneNames1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX)+"\n"+
- "element:p2OneNames2 completion:p2OneNames2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX),
- requestor.getResults());
-}
-public void testCompletionNonEmptyToken1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonEmptyToken1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- int start = cursorLocation - 2;
- int end = start + 4;
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:zzyy completion:zzyy position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResultsWithPosition());
-}
-public void testCompletionEmptyToken1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyToken1.java");
-
- String str = cu.getSource();
- String completeBehind = "zz";
- // completion is just at start of 'zz'
- int cursorLocation = str.lastIndexOf(completeBehind);
- int start = cursorLocation;
- int end = start + 4;
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionEmptyToken1 completion:CompletionEmptyToken1 position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:clone completion:clone() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:equals completion:equals() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:finalize completion:finalize() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:foo completion:foo() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:getClass completion:getClass() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:hashCode completion:hashCode() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:notify completion:notify() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:notifyAll completion:notifyAll() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:toString completion:toString() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:wait completion:wait() position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:zzyy completion:zzyy position:["+start+","+end+"] relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResultsWithPosition());
-}
-public void testCompletionFindSecondaryType1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindSecondaryType1.java");
-
- String str = cu.getSource();
- String completeBehind = "/**/Secondary";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:SecondaryType1 completion:SecondaryType1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:SecondaryType2 completion:SecondaryType2 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionLocalType1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionLocalType1.java");
-
- String str = cu.getSource();
- String completeBehind = "ZZZ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:ZZZZ completion:ZZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED),
- requestor.getResults());
-}
-public void testCompletionType1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionType1.java");
-
- String str = cu.getSource();
- String completeBehind = "CT1";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CT1 completion:CT1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED)+"\n"+
- "element:CT1 completion:q2.CT1 relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-public void testCompletionQualifiedAllocationType1() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionQualifiedAllocationType1.java");
-
- String str = cu.getSource();
- String completeBehind = "YYY";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:CompletionQualifiedAllocationType1.YYY completion:YYY relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
deleted file mode 100644
index 653c0be..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.ICompilationUnit;
-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.Util;
-import org.eclipse.jdt.internal.codeassist.RelevanceConstants;
-
-import junit.framework.*;
-
-public class CompletionTests2 extends ModifyingResourceTests implements RelevanceConstants {
-
-public CompletionTests2(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("Completion");
-}
-public void tearDownSuite() throws Exception {
- deleteProject("Completion");
-
- super.tearDownSuite();
-}
-
-
-public static Test suite() {
- TestSuite suite = new Suite(CompletionTests2.class.getName());
-
- suite.addTest(new CompletionTests2("testBug29832"));
- suite.addTest(new CompletionTests2("testBug33560"));
-
- return suite;
-}
-
-File createFile(File parent, String name, String content) throws IOException {
- File file = new File(parent, name);
- FileOutputStream out = new FileOutputStream(file);
- out.write(content.getBytes());
- out.close();
- return file;
-}
-File createDirectory(File parent, String name) throws IOException {
- File dir = new File(parent, name);
- dir.mkdirs();
- return dir;
-}
-void addLibraryEntry(IJavaProject project, String path, boolean exported) throws JavaModelException {
- this.addLibraryEntry(project, new Path(path), null, null, exported);
-}
-void addLibraryEntry(IJavaProject project, String path, String srcAttachmentPath, String srcAttachmentPathRoot, boolean exported) throws JavaModelException{
- this.addLibraryEntry(
- project,
- new Path(path),
- srcAttachmentPath == null ? null : new Path(srcAttachmentPath),
- srcAttachmentPathRoot == null ? null : new Path(srcAttachmentPathRoot),
- exported
- );
-}
-void addLibraryEntry(IJavaProject project, IPath path, IPath srcAttachmentPath, IPath srcAttachmentPathRoot, boolean exported) throws JavaModelException{
- IClasspathEntry[] entries = project.getRawClasspath();
- int length = entries.length;
- System.arraycopy(entries, 0, entries = new IClasspathEntry[length + 1], 1, length);
- entries[0] = JavaCore.newLibraryEntry(path, srcAttachmentPath, srcAttachmentPathRoot, exported);
- project.setRawClasspath(entries, null);
-}
-/**
- * Test for bug 29832
- */
-public void testBug29832() throws Exception {
- try {
- // create variable
- JavaCore.setClasspathVariables(
- new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
- null);
-
- // create P1
- IFile f = getFile("/Completion/lib.jar");
- IJavaProject p = this.createJavaProject(
- "P1",
- new String[]{},
- new String[]{Util.getJavaClassLib()},
- "");
- this.createFile("/P1/lib.jar", f.getContents());
- this.addLibraryEntry(p, "/P1/lib.jar", true);
-
- // create P2
- this.createJavaProject(
- "P2",
- new String[]{"src"},
- new String[]{Util.getJavaClassLib()},
- new String[]{"/P1"},
- "bin");
- this.createFile(
- "/P2/src/X.java",
- "public class X {\n"+
- " ZZZ z;\n"+
- "}");
-
- // do completion
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("P2", "src", "", "X.java");
-
- String str = cu.getSource();
- String completeBehind = "ZZZ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-
-
- // delete P1
- p.getProject().delete(true, false, null);
-
- // create P1
- File dest = getWorkspaceRoot().getLocation().toFile();
- File pro = this.createDirectory(dest, "P1");
-
- this.createFile(pro, ".classpath", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"var\" path=\"JCL_LIB\" sourcepath=\"JCL_SRC\" rootpath=\"JCL_SRCROOT\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>");
-
- this.createFile(pro, ".project",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<projectDescription>\n" +
- " <name>org.eclipse.jdt.core</name>\n" +
- " <comment></comment>\n" +
- " <projects>\n" +
- " </projects>\n" +
- " <buildSpec>\n" +
- " <buildCommand>\n" +
- " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
- " <arguments>\n" +
- " </arguments>\n" +
- " </buildCommand>\n" +
- " </buildSpec>\n" +
- " <natures>\n" +
- " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
- " </natures>\n" +
- "</projectDescription>");
-
- File src = this.createDirectory(pro, "src");
-
- File pz = this.createDirectory(src, "pz");
-
- this.createFile(pz, "ZZZ.java",
- "package pz;\n" +
- "public class ZZZ {\n" +
- "}");
-
- final IProject project = getWorkspaceRoot().getProject("P1");
- IWorkspaceRunnable populate = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
- };
- getWorkspace().run(populate, null);
- JavaCore.create(project);
-
-
- // do completion
- requestor = new CompletionTestsRequestor();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/**
- * Test for bug 33560
- */
-public void testBug33560() throws Exception {
- try {
- // create variable
- JavaCore.setClasspathVariables(
- new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
- null);
-
- // create P1
- IFile f = getFile("/Completion/lib.jar");
- IJavaProject p = this.createJavaProject(
- "P1",
- new String[]{},
- new String[]{Util.getJavaClassLib()},
- "");
- this.createFile("/P1/lib.jar", f.getContents());
- this.addLibraryEntry(p, "/P1/lib.jar", true);
-
- // create P2
- this.createJavaProject(
- "P2",
- new String[]{"src"},
- new String[]{Util.getJavaClassLib()},
- new String[]{"/P1"},
- new boolean[]{true},
- "bin");
-
- // create P3
- this.createJavaProject(
- "P3",
- new String[]{"src"},
- new String[]{Util.getJavaClassLib()},
- new String[]{"/P2"},
- "bin");
- this.createFile(
- "/P3/src/X.java",
- "public class X {\n"+
- " ZZZ z;\n"+
- "}");
-
- // do completion
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu= getCompilationUnit("P3", "src", "", "X.java");
-
- String str = cu.getSource();
- String completeBehind = "ZZZ";
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
-
-
- // delete P1
- p.getProject().delete(true, false, null);
-
- // create P1
- File dest = getWorkspaceRoot().getLocation().toFile();
- File pro = this.createDirectory(dest, "P1");
-
- this.createFile(pro, ".classpath", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"var\" path=\"JCL_LIB\" sourcepath=\"JCL_SRC\" rootpath=\"JCL_SRCROOT\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>");
-
- this.createFile(pro, ".project",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<projectDescription>\n" +
- " <name>org.eclipse.jdt.core</name>\n" +
- " <comment></comment>\n" +
- " <projects>\n" +
- " </projects>\n" +
- " <buildSpec>\n" +
- " <buildCommand>\n" +
- " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
- " <arguments>\n" +
- " </arguments>\n" +
- " </buildCommand>\n" +
- " </buildSpec>\n" +
- " <natures>\n" +
- " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
- " </natures>\n" +
- "</projectDescription>");
-
- File src = this.createDirectory(pro, "src");
-
- File pz = this.createDirectory(src, "pz");
-
- this.createFile(pz, "ZZZ.java",
- "package pz;\n" +
- "public class ZZZ {\n" +
- "}");
-
- final IProject project = getWorkspaceRoot().getProject("P1");
- IWorkspaceRunnable populate = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
- };
- getWorkspace().run(populate, null);
- JavaCore.create(project);
-
-
- // do completion
- requestor = new CompletionTestsRequestor();
- cu.codeComplete(cursorLocation, requestor);
-
- assertEquals(
- "element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME),
- requestor.getResults());
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- this.deleteProject("P3");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor.java
deleted file mode 100644
index 5ac1c03..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.core.ICompletionRequestor;
-import org.eclipse.jdt.core.compiler.IProblem;
-
-import java.util.Vector;
-
-public class CompletionTestsRequestor implements ICompletionRequestor {
- private Vector fElements = new Vector();
- private Vector fCompletions = new Vector();
- private Vector fRelevances = new Vector();
- private Vector fCompletionStart = new Vector();
- private Vector fCompletionEnd = new Vector();
-
- public boolean fDebug = false;
-/**
- * CompletionTestsRequestor constructor comment.
- */
-public CompletionTestsRequestor() {
- super();
-}
-
-public void acceptAnonymousType(char[] superTypePackageName,char[] superTypeName,char[][] parameterPackageNames,char[][] parameterTypeNames,char[][] parameterNames,char[] completionName,int modifiers,int completionStart,int completionEnd, int relevance){
- fElements.addElement(new String(superTypeName));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("anonymous type " + new String(superTypeName));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptClass(char[] packageName, char[] className, char[] completionName, int modifiers, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(className));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("Class " + new String(className));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptError(IProblem error) {
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptField(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] name,
- char[] typePackageName,
- char[] typeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
-
- fElements.addElement(new String(name));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("Field " + new String(name));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptInterface(char[] packageName, char[] interfaceName, char[] completionName, int modifiers, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(interfaceName));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("Interface " + new String(interfaceName));
-
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptKeyword(char[] keywordName, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(keywordName));
- fCompletions.addElement(new String(keywordName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("Keyword " + new String(keywordName));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptLabel(char[] labelName, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(labelName));
- fCompletions.addElement(new String(labelName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("Label " + new String(labelName));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptLocalVariable(char[] name, char[] typePackageName, char[] typeName, int modifiers, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(name));
- fCompletions.addElement(new String(name));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("Local variable " + new String(name));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptMethod(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageName,
- char[][] parameterTypeName,
- char[][] parameterNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
-
- fElements.addElement(new String(selector));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("method " + new String(selector));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptMethodDeclaration(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
-
- fElements.addElement(new String(selector));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("method declaration " + new String(selector));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptModifier(char[] modifierName, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(modifierName));
- fCompletions.addElement(new String(modifierName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("modifier " + new String(modifierName));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptPackage(char[] packageName, char[] completionName, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(packageName));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("package " + new String(packageName));
-}
-/**
- * @see ICompletionRequestor
- */
-public void acceptType(char[] packageName, char[] typeName, char[] completionName, int completionStart, int completionEnd, int relevance) {
- fElements.addElement(new String(typeName));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("type " + new String(typeName));
-}
-
-/**
- * @see ICompletionRequestor
- */
-public void acceptVariableName(char[] typePackageName, char[] typeName, char[] name, char[] completionName, int completionStart, int completionEnd, int relevance){
- fElements.addElement(new String(name));
- fCompletions.addElement(new String(completionName));
- fRelevances.addElement(String.valueOf(relevance));
- fCompletionStart.addElement(String.valueOf(completionStart));
- fCompletionEnd.addElement(String.valueOf(completionEnd));
- if (fDebug)
- System.out.println("variable name " + new String(name));
-}
-
-public String getResults() {
- return getResults(true, false);
-}
-
-public String getResultsWithPosition(){
- return getResults(true, true);
-}
-
-public String getResults(boolean relevance, boolean position) {
- StringBuffer result = new StringBuffer();
- int size = fElements.size();
-
- if (size == 1) {
- result.append(getResult(0, relevance, position));
- } else if (size > 1) {
- String[] sortedBucket = new String[size];
- for (int i = 0; i < size; i++) {
- sortedBucket[i] = getResult(i, relevance, position);
- }
- quickSort(sortedBucket, 0, size - 1);
- for (int j = 0; j < sortedBucket.length; j++) {
- if (result.length() > 0) result.append("\n");
- result.append(sortedBucket[j]);
- }
- }
-
- return result.toString();
-}
-
-private String getResult(int i, boolean relevance, boolean position) {
- if(i < 0 || i >= fElements.size())
- return "";
-
- StringBuffer buffer = new StringBuffer();
- buffer.append("element:");
- buffer.append(fElements.elementAt(i));
- buffer.append(" completion:");
- buffer.append(fCompletions.elementAt(i));
- if(position) {
- buffer.append(" position:[");
- buffer.append(fCompletionStart.elementAt(i));
- buffer.append(",");
- buffer.append(fCompletionEnd.elementAt(i));
- buffer.append("]");
- }
- if(relevance) {
- buffer.append(" relevance:");
- buffer.append(fRelevances.elementAt(i));
- }
- return buffer.toString();
-}
-
-protected String[] quickSort(String[] collection, int left, int right) {
- int original_left = left;
- int original_right = right;
- String mid = collection[ (left + right) / 2];
- do {
- while (mid.compareTo(collection[left]) > 0)
- // s[left] >= mid
- left++;
- while (mid.compareTo(collection[right]) < 0)
- // s[right] <= mid
- right--;
- if (left <= right) {
- String tmp = collection[left];
- collection[left] = collection[right];
- collection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right)
- collection = quickSort(collection, original_left, right);
- if (left < original_right)
- collection = quickSort(collection, left, original_right);
- return collection;
-}
-public String toString() {
- return getResults();
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ContainerInitializer.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ContainerInitializer.java
deleted file mode 100644
index e43a1dd..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ContainerInitializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IJavaProject;
-
-public class ContainerInitializer extends ClasspathContainerInitializer {
- public static ITestInitializer initializer;
-
- public static interface ITestInitializer {
- public void initialize(IPath containerPath, IJavaProject project) throws CoreException;
- }
-
- public static void setInitializer(ITestInitializer initializer) {
- ContainerInitializer.initializer = initializer;
- }
-
- public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
- if (initializer == null) return;
- initializer.initialize(containerPath, project);
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java
deleted file mode 100644
index b0efb62..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java
+++ /dev/null
@@ -1,2660 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.*;
-
-public class CopyMoveElementsTests extends CopyMoveTests {
-public CopyMoveElementsTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- IJavaProject project = this.createJavaProject("BinaryProject", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin");
- this.createFile(
- "/BinaryProject/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- " public void foo() {\n" +
- " }\n" +
- "}"
- );
- project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
-}
-/**
- * Setup for the next test.
- */
-public void setUp() throws Exception {
- super.setUp();
-
- this.createJavaProject("P", new String[] {"src"}, new String[] {"/BinaryProject/bin"}, "bin");
-}
-public static Test suite() {
- return new Suite(CopyMoveElementsTests.class);
-}
-/**
- * Cleanup after the previous test.
- */
-public void tearDown() throws Exception {
- this.deleteProject("P");
-
- super.tearDown();
-}
-public void tearDownSuite() throws Exception {
- this.deleteProject("BinaryProject");
- super.tearDownSuite();
-}
-/**
- * Ensures that a binary field cannot be renamed.
- */
-public void testCopyBinaryField() throws JavaModelException {
- IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class");
- IField binaryField = cf.getType().getField("bar");
- copyNegative(binaryField, cf, null, "bar2", false, IJavaModelStatusConstants.READ_ONLY);
-}
-/**
- * Ensures that a binary method cannot be renamed.
- */
-public void testCopyBinaryMethod() throws JavaModelException {
- IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class");
- IMethod binaryMethod = cf.getType().getMethod("foo", new String[] {});
- copyNegative(binaryMethod, cf, null, "foo2", false, IJavaModelStatusConstants.READ_ONLY);
-}
-/**
- * Ensures that a binary type cannot be copied.
- */
-public void testCopyBinaryType() throws JavaModelException {
- IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class");
- IType binaryType = cf.getType();
- copyNegative(binaryType, cf, null, "Y", false, IJavaModelStatusConstants.READ_ONLY);
-}
-/**
- * Ensures that a constructor can be copied to a different type. The constructor
- * should be automatically renamed to that of the destination type.
- */
-public void testCopyConstructor() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " X(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("X", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a constructor can be copied to a different type across projects.
- * The constructor should be automatically renamed to that of the destination type.
- */
-public void testCopyConstructorInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " X(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("X", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, false);
-
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type.
- */
-public void testCopyField() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a field can be copied to a different type replacing an existing field.
- */
-public void testCopyFieldForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean foo;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, null, true);
-}
-/**
- * Ensures that a field can be copied to a different type across projects
- * replacing an existing field.
- */
-public void testCopyFieldForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("bar");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, null, true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type in a different project.
- */
-public void testCopyFieldInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("bar");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type,
- * and renamed.
- */
-public void testCopyFieldRename() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, "bar", false);
-}
-/**
- * Ensures that a field can be copied to a different type,
- * and renamed, overwriting an existing field.
- */
-public void testCopyFieldRenameForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, "bar", true);
-}
-/**
- * Ensures that a field can be copied to a different type across two different
- * projects, and renamed, overwriting an existing field.
- */
-public void testCopyFieldRenameForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, "bar", true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type across two different
- * projects, and renamed.
- */
-public void testCopyFieldRenameInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, null, "bar", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be duplicated in the same type.
- */
-public void testCopyFieldSameParent() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- copyPositive(fieldSource, typeSource, null, "bar", false);
-}
-/**
- * Ensures that a multi status exception is generated when copying fields.
- */
-public void testCopyFieldsMultiStatus() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " Object bar;\n" +
- " char[] fred;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- IField[] fieldsSource = typeSource.getFields();
- IJavaElement[] dests = new IJavaElement[fieldsSource.length];
- for (int i = 0; i < dests.length; i++) {
- dests[i] = typeDest;
- }
- dests[1] = (IJavaElement)fieldsSource[0]; //invalid destination
- dests[2]= (IJavaElement)fieldsSource[0];
-
- try {
- startDeltas();
- boolean e= false;
- try {
- typeDest.getJavaModel().copy(fieldsSource, dests, null, null, false, null);
- } catch (JavaModelException jme) {
- assertTrue("Should be multistatus", jme.getStatus().isMultiStatus());
- assertTrue("Should be an invalid destination", ((IJavaModelStatus)jme.getStatus().getChildren()[0]).getCode()== IJavaModelStatusConstants.INVALID_DESTINATION);
- e = true;
- }
- assertTrue("Should have been an exception", e);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " Y.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " Y[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}"
- );
-
- IJavaElement copy= generateHandle(fieldsSource[0], null, typeDest);
- assertTrue("Copy should exist", copy.exists());
- } finally {
- stopDeltas();
- }
-}
-/**
- * Ensures that a multi status exception is generated when copying fields.
- */
-public void testCopyFieldsMultiStatusInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " Object bar;\n" +
- " char[] fred;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- IField[] fieldsSource = typeSource.getFields();
- IJavaElement[] dests = new IJavaElement[fieldsSource.length];
- for (int i = 0; i < dests.length; i++) {
- dests[i] = typeDest;
- }
- dests[1] = (IJavaElement)fieldsSource[0]; //invalid destination
- dests[2]= (IJavaElement)fieldsSource[0];
-
- startDeltas();
- boolean e= false;
- try {
- typeDest.getJavaModel().copy(fieldsSource, dests, null, null, false, null);
- } catch (JavaModelException jme) {
- assertTrue("Should be multistatus", jme.getStatus().isMultiStatus());
- assertTrue("Should be an invalid destination", ((IJavaModelStatus)jme.getStatus().getChildren()[0]).getCode()== IJavaModelStatusConstants.INVALID_DESTINATION);
- e = true;
- }
- assertTrue("Should have been an exception", e);
-
- assertDeltas(
- "Unexpected delta",
- "P2[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " Y.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " Y[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}"
- );
-
- IJavaElement copy= generateHandle(fieldsSource[0], null, typeDest);
- assertTrue("Copy should exist", copy.exists());
- } finally {
- stopDeltas();
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field cannot be copied to a different type replacing an existing field if
- * no force.
- */
-public void testCopyFieldWithCollision() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean foo;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyNegative(fieldSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a field cannot be copied to a different type across different projects
- * replacing an existing field if no force.
- */
-public void testCopyFieldWithCollisionInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("bar");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyNegative(fieldSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field cannot be copied to an invalid destination.
- */
-public void testCopyFieldWithInvalidDestination() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class");
-
- copyNegative(fieldSource, cf.getType(), null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
-}
-/**
- * Ensures that a field cannot be copied to an invalid destination.
- */
-public void testCopyFieldWithInvalidDestinationInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, new String[] {"/BinaryProject/bin"}, "bin");
- IClassFile cf = getClassFile("P2", "/BinaryProject/bin", "", "X.class");
-
- copyNegative(fieldSource, cf.getType(), null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field cannot be copied to a different type with an invalid sibling
- * used for positioning.
- */
-public void testCopyFieldWithInvalidPositioning() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyNegative(
- fieldSource,
- typeDest,
- typeDest.getField("invalid"),
- null,
- false,
- IJavaModelStatusConstants.INVALID_SIBLING);
-}
-/**
- * Ensures that a field cannot be copied to a different type with an invalid sibling
- * used for positioning.
- */
-public void testCopyFieldWithInvalidPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyNegative(
- fieldSource,
- typeDest,
- typeDest.getField("invalid"),
- null,
- false,
- IJavaModelStatusConstants.INVALID_SIBLING);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type with positioning.
- */
-public void testCopyFieldWithPositioning() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, typeDest.getField("bar"), null, false);
-}
-/**
- * Ensures that a field can be copied to a different type across different projects
- * with positioning.
- */
-public void testCopyFieldWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(fieldSource, typeDest, typeDest.getField("bar"), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a initializer can be copied to a different type.
- */
-public void testCopyInitializer() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(initializerSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a initializer can be copied to a different type across two different
- * projects.
- */
-public void testCopyInitializerInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(initializerSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a initializer cannot be copied and renamed.
- */
-public void testCopyInitializerRename() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyNegative(initializerSource, typeDest, null, "newName", false, IJavaModelStatusConstants.INVALID_NAME);
-}
-/**
- * Ensures that a initializer cannot be copied and renamed.
- */
-public void testCopyInitializerRenameInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyNegative(initializerSource, typeDest, null, "newName", false, IJavaModelStatusConstants.INVALID_NAME);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a initializer can be copied to a different type across two different
- * projects with positioning.
- */
-public void testCopyInitializerWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(initializerSource, typeDest, typeDest.getField("bar"), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that an inner type can be copied with positioning.
- */
-public void testCopyInnerTypeWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " class Inner {\n" +
- " }" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X").getType("Inner");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
- IType typeDest = cuDest.getType("Y");
-
- copyPositive(typeSource, typeDest, typeDest.getMethod("foo", new String[] {}), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a main type can be copied.
- */
-public void testCopyMainType() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P/src/Y.java");
-
- copyPositive(typeSource, cuDest, null, null, false);
-}
-/**
- * Ensures that a main type can be copied across two different projects.
- */
-public void testCopyMainTypeInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
-
- copyPositive(typeSource, cuDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be copied to a different type.
- */
-public void testCopyMethod() throws CoreException{
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a method can be copied to a different type, forcing
- * an overwrite when there is a name collision
- */
-public void testCopyMethodForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, true);
-}
-/**
- * Ensures that a method can be copied to a different type across different projects,
- * forcing an overwrite when there is a name collision
- */
-public void testCopyMethodForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be copied to a different type across different projects.
- */
-public void testCopyMethodInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be copied to a different type, renamed
- * simaltaneously.
- */
-public void testCopyMethodRename() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, "bar", false);
-}
-/**
- * Ensures that a method can be copied to a different type, renamed
- * simaltaneously, overwriting an existing method.
- */
-public void testCopyMethodRenameForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " void bar(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, "bar", true);
-}
-/**
- * Ensures that a method can be copied to a different type across different projects,
- * renamed simaltaneously, overwriting an existing method.
- */
-public void testCopyMethodRenameForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void bar(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, "bar", true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be copied to a different type across different projects,
- * renamed simaltaneously.
- */
-public void testCopyMethodRenameInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, "bar", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be copied to the same type, renamed
- * simaltaneously.
- */
-public void testCopyMethodSameParent() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- copyPositive(methodSource, typeSource, null, "bar", false);
-}
-/**
- * Ensures that a method cannot be copied to a different type, when not forcing
- * an overwrite when there is a name collision
- */
-public void testCopyMethodWithCollision() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyNegative(methodSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a method cannot be copied to a different type across different projects,
- * when not forcing an overwrite when there is a name collision
- */
-public void testCopyMethodWithCollisionInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyNegative(methodSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method cannot be copied to an invalid destination.
- */
-public void testCopyMethodWithInvalidDestination() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- copyNegative(methodSource, methodSource, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
-}
-/**
- * Ensures that a method cannot be copied to an invalid destination.
- */
-public void testCopyMethodWithInvalidDestinationInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void bar() {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
- IMethod methodDest = typeDest.getMethod("bar", new String[] {});
-
- copyNegative(methodSource, methodDest, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be copied to a different type with positioning.
- */
-public void testCopyMethodWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar() {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, typeDest.getMethod("bar", new String[] {}), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that attempting to rename with an incorrect number of renamings fails
- */
-public void testCopyMoveWithInvalidRenamings() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("foo", new String[]{});
- copyNegative(
- new IJavaElement[] {methodSource},
- new IJavaElement[] {typeSource},
- null,
- new String[] {"bar", "fred"},
- false,
- IJavaModelStatusConstants.INDEX_OUT_OF_BOUNDS);
-}
-/**
- * Ensures that a method with syntax errors can be copied to a different type.
- */
-public void testCopySyntaxErrorMethod() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s\n" + // syntax error
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a method with syntax errors can be copied to a different type across different
- * projects.
- */
-public void testCopySyntaxErrorMethodInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s\n" + // syntax error
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- copyPositive(methodSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a type can be copied.
- */
-public void testCopyType() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}\n" +
- "class Z {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("Z");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P/src/Y.java");
-
- copyPositive(typeSource, cuDest, null, null, false);
-}
-/**
- * Ensures that a type can be copied.
- */
-public void testCopyTypeInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}\n" +
- "class Z {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("Z");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
-
- copyPositive(typeSource, cuDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a type can be copied with positioning.
- */
-public void testCopyTypeWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}\n" +
- "class Z {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("Z");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
-
- copyPositive(typeSource, cuDest, cuDest.getType("Y"), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a constructor can be moved to a different type. The constructor
- * should be automatically renamed to that of the destination type.
- */
-public void testMoveConstructor() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " X(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("X", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, false);
-
- // test that the constructor has been renamed
- assertTrue(
- "Constructor was not renamed",
- typeDest.getMethod("Y", new String[] {"QString;"}).exists());
-}
-/**
- * Ensures that a constructor can be moved to a different type across different projects.
- * The constructor should be automatically renamed to that of the destination type.
- */
-public void testMoveConstructorInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " X(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("X", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, false);
-
- // test that the constructor has been renamed
- assertTrue(
- "Constructor was not renamed",
- typeDest.getMethod("Y", new String[] {"QString;"}).exists());
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be moved to a different type.
- */
-public void testMoveField() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a field can be moved to a different type replacing an existing field.
- */
-public void testMoveFieldForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean foo;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, null, true);
-}
-/**
- * Ensures that a field can be moved to a different type across differnt projects
- * replacing an existing field.
- */
-public void testMoveFieldForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("bar");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, null, true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be moved to a different type across differnt projects.
- */
-public void testMoveFieldInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("bar");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be moved to a different type,
- * and renamed.
- */
-public void testMoveFieldRename() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, "fred", false);
-}
-/**
- * Ensures that a field can be moved to a different type,
- * and renamed, overwriting an existing field.
- */
-public void testMoveFieldRenameForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, "bar", true);
-}
-/**
- * Ensures that a field can be moved to a different type across differnt projects,
- * and renamed, overwriting an existing field.
- */
-public void testMoveFieldRenameForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, "bar", true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be moved to a different type across different projects,
- * and renamed.
- */
-public void testMoveFieldRenameInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, null, "bar", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type across different projects
- * with positioning.
- */
-public void testMoveFieldRenameForceWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- " char fred;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, typeDest.getField("bar"), "fred", true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be moved in the same type.
- */
-public void testMoveFieldSameParent() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- movePositive(fieldSource, typeSource, null, "bar", false);
-}
-/**
- * Ensures that a field cannot be moved to a different type replacing an existing field if
- * not forced.
- */
-public void testMoveFieldWithCollision() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " boolean foo;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- moveNegative(fieldSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a field cannot be moved to a different type across differnt projects
- * replacing an existing field if not forced.
- */
-public void testMoveFieldWithCollisionInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("bar");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- moveNegative(fieldSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field cannot be moved to an invalid destination
- */
-public void testMoveFieldWithInvalidDestination() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- IClassFile cf = getClassFile("P", "/BinaryProject/bin", "", "X.class");
-
- moveNegative(fieldSource, cf.getType(), null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
-}
-/**
- * Ensures that a field cannot be moved to an invalid destination.
- */
-public void testMoveFieldWithInvalidDestinationInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, new String[] {"/BinaryProject/bin"}, "bin");
- IClassFile cf = getClassFile("P2", "/BinaryProject/bin", "", "X.class");
-
- moveNegative(fieldSource, cf.getType(), null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a field can be copied to a different type across different projects
- * with positioning.
- */
-public void testMoveFieldWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IField fieldSource= typeSource.getField("foo");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(fieldSource, typeDest, typeDest.getField("bar"), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a initializer can be moved to a different type.
- */
-public void testMoveInitializer() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(initializerSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a initializer can be copied to a different type that is in a different
- * projects=.
- */
-public void testMoveInitializerInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(initializerSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a initializer cannot be moved and renamed.
- */
-public void testMoveInitializerRename() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- moveNegative(initializerSource, typeDest, null, "newName", false, IJavaModelStatusConstants.INVALID_NAME);
-}
-/**
- * Ensures that a initializer cannot be moved and renamed.
- */
-public void testMoveInitializerRenameInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- moveNegative(initializerSource, typeDest, null, "newName", false, IJavaModelStatusConstants.INVALID_NAME);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a initializer can be moved to a different type in a different project
- * with positioning.
- */
-public void testMoveInitializerWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo;\n" +
- " {\n" +
- " foo = 10;\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " int bar;\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(initializerSource, typeDest, typeDest.getField("bar"), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that an inner type can be moved and renamed to a type that is in different project
- * with positioning.
- */
-public void testMoveInnerTypeRenameWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " class Inner {\n" +
- " }" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X").getType("Inner");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
- IType typeDest = cuDest.getType("Y");
-
- movePositive(typeSource, typeDest, typeDest.getMethod("foo", new String[] {}), "T", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that an inner type can be moved to a type that is in different project
- * with positioning.
- */
-public void testMoveInnerTypeWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " class Inner {\n" +
- " }" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X").getType("Inner");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void foo() {\n" +
- " }\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
- IType typeDest = cuDest.getType("Y");
-
- movePositive(typeSource, typeDest, typeDest.getMethod("foo", new String[] {}), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that main types can be moved and renamed (within the same parent).
- */
-public void testMoveMainTypes() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkg = getPackage("/P/src");
- ICompilationUnit cu = pkg.getCompilationUnit("X.java");
- IType typeSource = cu.getType("X");
-
- movePositive(
- new IJavaElement[] {typeSource},
- new IJavaElement[]{cu},
- null,
- new String[] {"Y"},
- false);
-
- // test that both the compilation unit and the main type have been renamed.
- ICompilationUnit renamedCU = pkg.getCompilationUnit("Y.java");
- assertTrue("Renamed element should be present", renamedCU.getType("Y").exists());
-}
-/**
- * Ensures that a method can be moved to a different type.
- */
-public void testMoveMethod() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a method can be moved to a different type, forcing
- * an overwrite when there is a name collision
- */
-public void testMoveMethodForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, true);
-}
-/**
- * Ensures that a method can be moved to a different type across different projects,
- * forcing an overwrite when there is a name collision
- */
-public void testMoveMethodForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be moved to a different type in a different project.
- */
-public void testMoveMethodInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be moved to a different type, renamed
- * simaltaneously.
- */
-public void testMoveMethodRename() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, "bar", false);
-}
-/**
- * Ensures that a method can be moved to a different type, renamed
- * simaltaneously, overwriting an existing method.
- */
-public void testMoveMethodRenameForce() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " void bar(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, "bar", true);
-}
-/**
- * Ensures that a method can be moved to a different type across different projects,
- * renamed simaltaneously, overwriting an existing method.
- */
-public void testMoveMethodRenameForceInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void bar(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, "bar", true);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be moved to a different type across different projects,
- * renamed simaltaneously.
- */
-public void testMoveMethodRenameInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, "bar", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be moved and renamed to a different type across two different projects
- * with positioning.
- */
-public void testMoveMethodRenameWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar() {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, typeDest.getMethod("bar", new String[] {}), "fred", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be moved to the same type.
- */
-public void testMoveMethodSameParent() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- movePositive(methodSource, typeSource, null, "bar", false);
-}
-/**
- * Ensures that a method moves can be cancelled.
- */
-public void testMoveMethodsWithCancel() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}"
- );
- final IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- boolean isCanceled = false;
- try {
- TestProgressMonitor monitor = TestProgressMonitor.getInstance();
- monitor.setCancelledCounter(1);
- movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, monitor);
- } catch (OperationCanceledException e) {
- isCanceled = true;
- }
- assertTrue("Operation should have thrown an operation canceled exception", isCanceled);
-}
-/**
- * Ensures that a method moves across differnt projects can be cancelled.
- */
-public void testMoveMethodsWithCancelInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- "}"
- );
- final IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- boolean isCanceled = false;
- try {
- TestProgressMonitor monitor = TestProgressMonitor.getInstance();
- monitor.setCancelledCounter(1);
- movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, monitor);
- } catch (OperationCanceledException e) {
- isCanceled = true;
- }
- assertTrue("Operation should have thrown an operation canceled exception", isCanceled);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method cannot be moved to a different type, when not forcing
- * an overwrite when there is a name collision
- */
-public void testMoveMethodWithCollision() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- moveNegative(methodSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a method cannot be moved to a different type, when not forcing
- * an overwrite when there is a name collision
- */
-public void testMoveMethodWithCollisionInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- moveNegative(methodSource, typeDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method cannot be moved to an invalid destination.
- */
-public void testMoveMethodWithInvalidDestination() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- moveNegative(methodSource, methodSource, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
-}
-/**
- * Ensures that a method cannot be moved to an invalid destination.
- */
-public void testMoveMethodWithInvalidDestinationInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " void bar() {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
- IMethod methodDest = typeDest.getMethod("bar", new String[] {});
-
- moveNegative(methodSource, methodDest, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method can be moved to a different type that is in a different project
- * with positioning.
- */
-public void testMoveMethodWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " int foo(String s) {\n" +
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource = typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- " boolean bar() {\n" +
- " }\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, typeDest.getMethod("bar", new String[] {}), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a method with syntax errors can be moved to a different type.
- */
-public void testMoveSyntaxErrorMethod() throws CoreException {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s\n" + // syntax error
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, false);
-}
-/**
- * Ensures that a method with syntax errors can be moved to a different type
- * that is in a different project.
- */
-public void testMoveSyntaxErrorMethodInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " void foo(String s\n" + // syntax error
- " }\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("X");
- IMethod methodSource= typeSource.getMethod("foo", new String[] {"QString;"});
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- IType typeDest = getCompilationUnit("/P2/src/Y.java").getType("Y");
-
- movePositive(methodSource, typeDest, null, null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a type can be moved and renamed across projects to a specified position.
- */
-public void testMoveTypeRenameWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}\n" +
- "class Z {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("Z");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
-
- movePositive(typeSource, cuDest, cuDest.getType("Y"), "T", false);
- } finally {
- this.deleteProject("P2");
- }
-}
-/**
- * Ensures that a type that is in a different project can be moved to a specified position.
- */
-public void testMoveTypeWithPositioningInDifferentProject() throws CoreException {
- try {
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- "}\n" +
- "class Z {\n" +
- "}"
- );
- IType typeSource = getCompilationUnit("/P/src/X.java").getType("Z");
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFile(
- "/P2/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cuDest = getCompilationUnit("/P2/src/Y.java");
-
- movePositive(typeSource, cuDest, cuDest.getType("Y"), null, false);
- } finally {
- this.deleteProject("P2");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java
deleted file mode 100644
index 2c3d351..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java
+++ /dev/null
@@ -1,863 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.jdt.core.*;
-
-public class CopyMoveResourcesTests extends CopyMoveTests {
-/**
- */
-public CopyMoveResourcesTests(String name) {
- super(name);
-}
-/**
- * Copies the element to the container with optional rename
- * and forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public IJavaElement copyPositive(IJavaElement element, IJavaElement container, IJavaElement sibling, String rename, boolean force) throws JavaModelException {
- try {
- startDeltas();
-
- // if forcing, ensure that a name collision exists
- if (force) {
- IJavaElement collision = generateHandle(element, rename, container);
- assertTrue("Collision does not exist", collision.exists());
- }
-
- // copy
- ((ISourceManipulation) element).copy(container, sibling, rename, force, null);
-
- // ensure the original element still exists
- assertTrue("The original element must still exist", element.exists());
-
- // generate the new element handle
- IJavaElement copy = generateHandle(element, rename, container);
- assertTrue("Copy should exist", copy.exists());
- //ensure correct position
- if (element.getElementType() > IJavaElement.COMPILATION_UNIT) {
- ensureCorrectPositioning((IParent) container, sibling, copy);
- } else {
- if (container.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) {
- } else {
- // ensure package name is correct
- if (container.getElementName().equals("")) {
- // default package - should be no package decl
- IJavaElement[] children = ((ICompilationUnit) copy).getChildren();
- boolean found = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof IPackageDeclaration) {
- found = true;
- }
- }
- assertTrue("Should not find package decl", !found);
- } else {
- IJavaElement[] children = ((ICompilationUnit) copy).getChildren();
- boolean found = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof IPackageDeclaration) {
- assertTrue("package declaration incorrect", ((IPackageDeclaration) children[i]).getElementName().equals(container.getElementName()));
- found = true;
- }
- }
- assertTrue("Did not find package decl", found);
- }
- }
- }
- IJavaElementDelta destDelta = getDeltaFor(container, true);
- assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
- IJavaElementDelta[] deltas = destDelta.getAddedChildren();
- // FIXME: not strong enough
- boolean found = false;
- for (int i = 0; i < deltas.length; i++) {
- if (deltas[i].getElement().equals(copy))
- found = true;
- }
- assertTrue("Added children not correct for element copy", found);
- return copy;
- } finally {
- stopDeltas();
- }
-}
-
-/**
- * Moves the elements to the containers with optional renaming
- * and forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaModelException {
- try {
- startDeltas();
-
- // if forcing, ensure that a name collision exists
- int i;
- if (force) {
- for (i = 0; i < elements.length; i++) {
- IJavaElement e = elements[i];
- IJavaElement collision = null;
- if (names == null) {
- collision = generateHandle(e, null, destinations[i]);
- } else {
- collision = generateHandle(e, names[i], destinations[i]);
- }
- assertTrue("Collision does not exist", collision.exists());
- }
- }
-
- // move
- getJavaModel().move(elements, destinations, siblings, names, force, monitor);
-
- for (i = 0; i < elements.length; i++) {
- IJavaElement element = elements[i];
- IJavaElement moved = null;
- if (names == null) {
- moved = generateHandle(element, null, destinations[i]);
- } else {
- moved = generateHandle(element, names[i], destinations[i]);
- }
- // ensure the original element no longer exists, unless moving within the same container
- if (!destinations[i].equals(element.getParent())) {
- assertTrue("The original element must not exist", !element.exists());
- }
- assertTrue("Moved element should exist", moved.exists());
-
- IJavaElement container = destinations[i];
- if (container.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- if (container.getElementName().equals("")) {
- // default package
- if (moved.getElementType() == IJavaElement.COMPILATION_UNIT) {
- IJavaElement[] children = ((ICompilationUnit) moved).getChildren();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getElementType() == IJavaElement.PACKAGE_DECLARATION) {
- assertTrue("Should not find package decl", false);
- }
- }
- }
- } else {
- IJavaElement[] children = ((ICompilationUnit) moved).getChildren();
- boolean found = false;
- for (int j = 0; j < children.length; j++) {
- if (children[j] instanceof IPackageDeclaration) {
- assertTrue("package declaration incorrect", ((IPackageDeclaration) children[j]).getElementName().equals(container.getElementName()));
- found = true;
- break;
- }
- }
- assertTrue("Did not find package decl", found);
- }
- }
- IJavaElementDelta destDelta = null;
- if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu
- destDelta = getDeltaFor(moved.getParent());
- assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED);
- IJavaElementDelta[] deltas = destDelta.getAddedChildren();
- assertTrue("Added children not correct for element copy", deltas[0].getElement().equals(moved));
- assertTrue("flag should be F_MOVED_FROM", (deltas[0].getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0);
- assertTrue("moved from handle should be original", deltas[0].getMovedFromElement().equals(element));
- } else {
- destDelta = getDeltaFor(destinations[i], true);
- assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
- IJavaElementDelta[] deltas = destDelta.getAddedChildren();
- for (int j = 0; j < deltas.length - 1; j++) {
- // side effect packages added
- IJavaElement pkg = deltas[j].getElement();
- assertTrue("Side effect child should be a package fragment", pkg.getElementType() == IJavaElement.PACKAGE_FRAGMENT);
- assertTrue("Side effect child should be an enclosing package", element.getElementName().startsWith(pkg.getElementName()));
- }
- IJavaElementDelta pkgDelta = deltas[deltas.length - 1];
- assertTrue("Added children not correct for element copy", pkgDelta.getElement().equals(moved));
- assertTrue("flag should be F_MOVED_FROM", (pkgDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0);
- assertTrue("moved from handle shoud be original", pkgDelta.getMovedFromElement().equals(element));
- IJavaElementDelta sourceDelta = getDeltaFor(element, true);
- assertTrue("moved to handle should be original", sourceDelta.getMovedToElement().equals(moved));
- }
- }
- } finally {
- stopDeltas();
- }
-}
-/**
- * Setup for the next test.
- */
-public void setUp() throws Exception {
- super.setUp();
-
- this.createJavaProject("P", new String[] {"src", "src2"}, "bin");
-}
-public static Test suite() {
- return new Suite(CopyMoveResourcesTests.class);
-}
-/**
- * Cleanup after the previous test.
- */
-public void tearDown() throws Exception {
- this.deleteProject("P");
-
- super.tearDown();
-}
-/**
- * Ensures that a CU can be copied to a different package.
- */
-public void testCopyCU() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(cuSource, pkgDest, null, null, false);
-
- ICompilationUnit cu= pkgDest.getCompilationUnit("X.java");
- assertTrue("Package declaration not updated for copied cu", cu.getPackageDeclaration("p2").exists());
-}
-/**
- * This operation should fail as copying a CU and a CU member at the
- * same time is not supported.
- */
-public void testCopyCUAndType() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- copyNegative(
- new IJavaElement[]{cuSource, cuSource.getType("X")},
- new IJavaElement[]{cuSource.getParent(), cuSource},
- null,
- new String[]{"Y.java", "Y"},
- false,
- IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
-}
-/**
- * Ensures that a CU can be copied to a different package, replacing an existing CU.
- */
-public void testCopyCUForce() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/X.java",
- "package p2;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(cuSource, pkgDest, null, null, true);
-}
-/**
- * Ensures that a CU can be copied to a different package,
- * and be renamed.
- */
-public void testCopyCURename() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(cuSource, pkgDest, null, "Y.java", false);
-}
-/**
- * Ensures that a CU can be copied to a different package,
- * and be renamed, overwriting an existing CU
- */
-public void testCopyCURenameForce() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/Y.java",
- "package p2;\n" +
- "public class Y {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(cuSource, pkgDest, null, "Y.java", true);
-}
-/**
- * Ensures that a CU cannot be copied to a different package,over an existing CU when no force.
- */
-public void testCopyCUWithCollision() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/X.java",
- "package p2;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyNegative(cuSource, pkgDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a CU cannot be copied to an invalid destination
- */
-public void testCopyCUWithInvalidDestination() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- copyNegative(cuSource, cuSource, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
-}
-/**
- * Ensures that a CU can be copied to a null container
- */
-public void testCopyCUWithNullContainer() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- try {
- cuSource.copy(null, null, null, false, null);
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Should not be able to move a cu to a null container", false);
-}
-/**
- * Ensures that a CU can be copied to along with its server properties.
- * (Regression test for PR #1G56QT9)
- */
-public void testCopyCUWithServerProperties() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- QualifiedName qualifiedName = new QualifiedName("x.y.z", "a property");
- cuSource.getUnderlyingResource().setPersistentProperty(
- qualifiedName,
- "some value");
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(cuSource, pkgDest, null, null, false);
- ICompilationUnit cu= pkgDest.getCompilationUnit("X.java");
- String propertyValue = cu.getUnderlyingResource().getPersistentProperty(qualifiedName);
- assertEquals(
- "Server property should be copied with cu",
- "some value",
- propertyValue
- );
-}
-/**
- * Ensures that a package fragment can be copied to a different package fragment root.
- */
-public void testCopyPackageFragment() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgSource = getPackage("/P/src/p1");
-
- IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2");
-
- copyPositive(pkgSource, rootDest, null, null, false);
-}
-/**
- * Ensures that a package fragment can be copied to a different package fragment root.
- */
-public void testCopyReadOnlyPackageFragment() throws CoreException {
- try {
- this.createFolder("/P/src/p1/p2/p3");
- this.createFile(
- "/P/src/p1/p2/p3/X.java",
- "package p1.p2.p3;\n" +
- "public class X {\n" +
- "}"
- );
- getFile("/P/src/p1/p2/p3/X.java").setReadOnly(true);
- IPackageFragment pkgSource = getPackage("/P/src/p1");
- pkgSource.getResource().setReadOnly(true);
- IPackageFragment pkg2 = getPackage("/P/src/p1/p2/p3");
- pkg2.getResource().setReadOnly(true);
-
- IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2");
-
- copyPositive(pkg2, rootDest, null, null, false);
-
- assertTrue("Not readOnly", getPackage("/P/src2/p1").getResource().isReadOnly());
- assertTrue("Is readOnly", !getPackage("/P/src2/p1/p2").getResource().isReadOnly());
- assertTrue("Not readOnly", getPackage("/P/src2/p1/p2/p3").getResource().isReadOnly());
- assertTrue("Is readOnly", getFile("/P/src2/p1/p2/p3/X.java").isReadOnly());
- } finally {
- deleteFolder("/P/src/p1");
- }
-}
-/**
- * Ensures that a WorkingCopy can be copied to a different package.
- */
-public void testCopyWorkingCopy() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(copy, pkgDest, null, null, false);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-/**
- * Ensures that a WorkingCopy can be copied to a different package, replacing an existing WorkingCopy.
- */
-public void testCopyWorkingCopyForce() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/X.java",
- "package p2;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(copy, pkgDest, null, null, true);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-/**
- * Ensures that a WorkingCopy can be copied to a different package,
- * and be renamed.
- */
-public void testCopyWorkingCopyRename() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(copy, pkgDest, null, "Y.java", false);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-/**
- * Ensures that a WorkingCopy can be copied to a different package,
- * and be renamed, overwriting an existing WorkingCopy
- */
-public void testCopyWorkingCopyRenameForce() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/Y.java",
- "package p2;\n" +
- "public class Y {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyPositive(copy, pkgDest, null, "Y.java", true);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-/**
- * Ensures that a WorkingCopy cannot be copied to a different package,over an existing WorkingCopy when no force.
- */
-public void testCopyWorkingCopyWithCollision() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/X.java",
- "package p2;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- copyNegative(copy, pkgDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-/**
- * Ensures that a WorkingCopy cannot be copied to an invalid destination
- */
-public void testCopyWorkingCopyWithInvalidDestination() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- copyNegative(copy, cuSource, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-/**
- * Ensures that a CU can be moved to a different package.
- */
-public void testMoveCU() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- movePositive(cuSource, pkgDest, null, null, false);
-
- ICompilationUnit cu= pkgDest.getCompilationUnit("X.java");
- assertTrue("Package declaration not updated for copied cu", cu.getPackageDeclaration("p2").exists());
-}
-/**
- * This operation should fail as moving a CU and a CU member at the
- * same time is not supported.
- */
-public void testMoveCUAndType() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- moveNegative(
- new IJavaElement[]{cuSource, cuSource.getType("X")},
- new IJavaElement[]{cuSource.getParent(), cuSource},
- null,
- new String[]{"Y.java", "Y"},
- false,
- IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
-}
-/**
- * Ensures that a CU can be moved to a different package, replacing an
- * existing CU.
- */
-public void testMoveCUForce() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/X.java",
- "package p2;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- movePositive(cuSource, pkgDest, null, null, true);
-}
-/**
- * Ensures that a CU can be moved to a different package,
- * be renamed
- */
-public void testMoveCURename() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- movePositive(cuSource, pkgDest, null, "Y.java", false);
-}
-/**
- * Ensures that a CU can be moved to a different package,
- * be renamed, overwriting an existing resource.
- */
-public void testMoveCURenameForce() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/Y.java",
- "package p2;\n" +
- "public class Y {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- movePositive(cuSource, pkgDest, null, "Y.java", true);
-}
-/**
- * Ensures that a CU cannot be moved to a different package, replacing an
- * existing CU when not forced.
- */
-public void testMoveCUWithCollision() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- this.createFolder("/P/src/p2");
- this.createFile(
- "/P/src/p2/X.java",
- "package p2;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- moveNegative(cuSource, pkgDest, null, null, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a CU cannot be moved to an invalid destination.
- */
-public void testMoveCUWithInvalidDestination() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- moveNegative(cuSource, cuSource, null, null, false, IJavaModelStatusConstants.INVALID_DESTINATION);
-}
-/**
- * Ensures that a CU cannot be moved to a null container
- */
-public void testMoveCUWithNullContainer() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
-
- try {
- cuSource.move(null, null, null, false, null);
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Should not be able to move a cu to a null container", false);
-}
-/**
- * Ensures that a package fragment can be moved to a different package fragment root.
- */
-public void testMovePackageFragment() throws CoreException {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragment pkgSource = getPackage("/P/src/p1");
-
- IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2");
-
- movePositive(pkgSource, rootDest, null, null, false);
-}
-/**
- * Ensures that a package fragment can be copied to a different package fragment root.
- */
-public void testMoveReadOnlyPackageFragment() throws CoreException {
- try {
- this.createFolder("/P/src/p1/p2/p3");
- this.createFile(
- "/P/src/p1/p2/p3/X.java",
- "package p1.p2.p3;\n" +
- "public class X {\n" +
- "}"
- );
- getFile("/P/src/p1/p2/p3/X.java").setReadOnly(true);
- IPackageFragment pkgSource = getPackage("/P/src/p1");
- pkgSource.getResource().setReadOnly(true);
- IPackageFragment pkg2 = getPackage("/P/src/p1/p2/p3");
- pkg2.getResource().setReadOnly(true);
-
- IPackageFragmentRoot rootDest= getPackageFragmentRoot("P", "src2");
-
- movePositive(pkg2, rootDest, null, null, false);
-
- assertTrue("Not readOnly", getPackage("/P/src2/p1").getResource().isReadOnly());
- assertTrue("Is readOnly", !getPackage("/P/src2/p1/p2").getResource().isReadOnly());
- assertTrue("Not readOnly", getPackage("/P/src2/p1/p2/p3").getResource().isReadOnly());
- assertTrue("Is readOnly", getFile("/P/src2/p1/p2/p3/X.java").isReadOnly());
- } finally {
- deleteFolder("/P/src/p1");
- }
-}
-/**
- * Ensures that a WorkingCopy cannot be moved to a different package.
- */
-public void testMoveWorkingCopy() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createFolder("/P/src/p1");
- this.createFile(
- "/P/src/p1/X.java",
- "package p1;\n" +
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
- copy = (ICompilationUnit)cuSource.getWorkingCopy();
-
- this.createFolder("/P/src/p2");
- IPackageFragment pkgDest = getPackage("/P/src/p2");
-
- moveNegative(copy, pkgDest, null, null, false, IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java
deleted file mode 100644
index 8862dc6..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.*;
-
-abstract public class CopyMoveTests extends ModifyingResourceTests {
-public CopyMoveTests(String name) {
- super(name);
-}
-/**
- * Attempts to copy the element with optional
- * forcing. The operation should fail with the failure code.
- */
-public void copyNegative(IJavaElement element, IJavaElement destination, IJavaElement sibling, String rename, boolean force, int failureCode) {
- try {
- ((ISourceManipulation)element).copy(destination, sibling, rename, force, null);
- } catch (JavaModelException jme) {
- assertTrue("Code not correct for JavaModelException: " + jme, jme.getStatus().getCode() == failureCode);
- return;
- }
- assertTrue("The copy should have failed for: " + element, false);
- return;
-}
-/**
- * Attempts to copy the elements with optional
- * forcing. The operation should fail with the failure code.
- */
-public void copyNegative(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] renames, boolean force, int failureCode) {
- try {
- getJavaModel().copy(elements, destinations, siblings, renames, force, null);
- } catch (JavaModelException jme) {
- assertTrue("Code not correct for JavaModelException: " + jme, jme.getStatus().getCode() == failureCode);
- return;
- }
- assertTrue("The move should have failed for for multiple elements: ", false);
- return;
-}
-/**
- * Copies the element to the container with optional rename
- * and forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public IJavaElement copyPositive(IJavaElement element, IJavaElement container, IJavaElement sibling, String rename, boolean force) throws JavaModelException {
- // if forcing, ensure that a name collision exists
- if (force) {
- IJavaElement collision = generateHandle(element, rename, container);
- assertTrue("Collision does not exist", collision.exists());
- }
-
- IJavaElement copy;
- try {
- startDeltas();
-
- // copy
- ((ISourceManipulation) element).copy(container, sibling, rename, force, null);
-
- // ensure the original element still exists
- assertTrue("The original element must still exist", element.exists());
-
- // generate the new element handle
- copy = generateHandle(element, rename, container);
- assertTrue("Copy should exist", copy.exists());
-
- //ensure correct position
- if (element.getElementType() > IJavaElement.COMPILATION_UNIT) {
- ensureCorrectPositioning((IParent) container, sibling, copy);
- } else {
- if (container.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) {
- } else {
- // ensure package name is correct
- if (container.getElementName().equals("")) {
- // default package - should be no package decl
- IJavaElement[] children = ((ICompilationUnit) copy).getChildren();
- boolean found = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof IPackageDeclaration) {
- found = true;
- }
- }
- assertTrue("Should not find package decl", !found);
- } else {
- IJavaElement[] children = ((ICompilationUnit) copy).getChildren();
- boolean found = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof IPackageDeclaration) {
- assertTrue("package declaration incorrect", ((IPackageDeclaration) children[i]).getElementName().equals(container.getElementName()));
- found = true;
- }
- }
- assertTrue("Did not find package decl", found);
- }
- }
- }
- IJavaElementDelta destDelta = getDeltaFor(container, true);
- assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
- IJavaElementDelta[] deltas = destDelta.getAddedChildren();
- assertTrue("Added children not correct for element copy", deltas[0].getElement().equals(copy));
- } finally {
- stopDeltas();
- }
- return copy;
-}
-/**
- * Generates a new handle to the original element in
- * its new container.
- */
-public IJavaElement generateHandle(IJavaElement original, String rename, IJavaElement container) {
- String name = original.getElementName();
- if (rename != null) {
- name = rename;
- }
- switch (container.getElementType()) {
- case IJavaElement.PACKAGE_FRAGMENT_ROOT :
- switch (original.getElementType()) {
- case IJavaElement.PACKAGE_FRAGMENT :
- return ((IPackageFragmentRoot) container).getPackageFragment(name);
- default :
- assertTrue("illegal child type", false);
- break;
- }
- break;
- case IJavaElement.PACKAGE_FRAGMENT :
- switch (original.getElementType()) {
- case IJavaElement.COMPILATION_UNIT :
- return ((IPackageFragment) container).getCompilationUnit(name);
- default :
- assertTrue("illegal child type", false);
- break;
- }
- break;
- case IJavaElement.COMPILATION_UNIT :
- switch (original.getElementType()) {
- case IJavaElement.IMPORT_DECLARATION :
- return ((ICompilationUnit) container).getImport(name);
- case IJavaElement.PACKAGE_DECLARATION :
- return ((ICompilationUnit) container).getPackageDeclaration(name);
- case IJavaElement.TYPE :
- if (isMainType(original, container)) {
- //the cu has been renamed as well
- container = ((IPackageFragment) container.getParent()).getCompilationUnit(name + ".java");
- }
- return ((ICompilationUnit) container).getType(name);
- default :
- assertTrue("illegal child type", false);
- break;
- }
- break;
- case IJavaElement.TYPE :
- switch (original.getElementType()) {
- case IJavaElement.METHOD :
- if (name.equals(original.getParent().getElementName())) {
- //method is a constructor
- return ((IType) container).getMethod(container.getElementName(), ((IMethod) original).getParameterTypes());
- } else {
- return ((IType) container).getMethod(name, ((IMethod) original).getParameterTypes());
- }
- case IJavaElement.FIELD :
- return ((IType) container).getField(name);
- case IJavaElement.TYPE :
- return ((IType) container).getType(name);
- case IJavaElement.INITIALIZER :
- //hack to return the first initializer
- return ((IType) container).getInitializer(1);
- default :
- assertTrue("illegal child type", false);
- break;
- }
- break;
- default :
- assertTrue("unsupported container type", false);
- break;
- }
- assertTrue("should not get here", false);
- return null;
-}
-/**
- * Returns true if this element is the main type of its compilation unit.
- */
-protected boolean isMainType(IJavaElement element, IJavaElement parent) {
- if (parent instanceof ICompilationUnit) {
- if (element instanceof IType) {
- ICompilationUnit cu= (ICompilationUnit)parent;
- String typeName = cu.getElementName();
- typeName = typeName.substring(0, typeName.length() - 5);
- return element.getElementName().equals(typeName) && element.getParent().equals(cu);
- }
- }
- return false;
-}
-/**
- * Attempts to move the element with optional
- * forcing. The operation should fail with the failure code.
- */
-public void moveNegative(IJavaElement element, IJavaElement destination, IJavaElement sibling, String rename, boolean force, int failureCode) {
- try {
- ((ISourceManipulation)element).move(destination, sibling, rename, force, null);
- } catch (JavaModelException jme) {
- assertTrue("Code not correct for JavaModelException: " + jme, jme.getStatus().getCode() == failureCode);
- return;
- }
- assertTrue("The move should have failed for: " + element, false);
- return;
-}
-/**
- * Attempts to move the element with optional
- * forcing. The operation should fail with the failure code.
- */
-public void moveNegative(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] renames, boolean force, int failureCode) {
- try {
- getJavaModel().move(elements, destinations, siblings, renames, force, null);
- } catch (JavaModelException jme) {
- assertTrue("Code not correct for JavaModelException: " + jme, jme.getStatus().getCode() == failureCode);
- return;
- }
- assertTrue("The move should have failed for for multiple elements: ", false);
- return;
-}
-/**
- * Moves the element to the container with optional rename
- * and forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void movePositive(IJavaElement element, IJavaElement container, IJavaElement sibling, String rename, boolean force) throws JavaModelException {
- IJavaElement[] siblings = new IJavaElement[] {sibling};
- String[] renamings = new String[] {rename};
- if (sibling == null) {
- siblings = null;
- }
- if (rename == null) {
- renamings = null;
- }
- movePositive(new IJavaElement[] {element}, new IJavaElement[] {container}, siblings, renamings, force);
-}
-/**
- * Moves the elements to the containers with optional renaming
- * and forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force) throws JavaModelException {
- movePositive(elements, destinations, siblings, names, force, null);
-}
-/**
- * Moves the elements to the containers with optional renaming
- * and forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaModelException {
- // if forcing, ensure that a name collision exists
- int i;
- if (force) {
- for (i = 0; i < elements.length; i++) {
- IJavaElement e = elements[i];
- IJavaElement collision = null;
- if (names == null) {
- collision = generateHandle(e, null, destinations[i]);
- } else {
- collision = generateHandle(e, names[i], destinations[i]);
- }
- assertTrue("Collision does not exist", collision.exists());
- }
- }
-
- try {
- startDeltas();
-
- // move
- getJavaModel().move(elements, destinations, siblings, names, force, monitor);
- for (i = 0; i < elements.length; i++) {
- IJavaElement element = elements[i];
- IJavaElement moved = null;
- if (names == null) {
- moved = generateHandle(element, null, destinations[i]);
- } else {
- moved = generateHandle(element, names[i], destinations[i]);
- }
- // ensure the original element no longer exists, unless moving within the same container
- if (!destinations[i].equals(element.getParent())) {
- if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- //moving a package fragment does not necessary mean that it no longer exists
- //it could have members that are not part of the Java Model
- try {
- IResource[] members = ((IContainer) element.getUnderlyingResource()).members();
- if (members.length == 0) {
- assertTrue("The original element must not exist", !element.exists());
- }
- } catch (CoreException ce) {
- throw new JavaModelException(ce);
- }
- } else {
- assertTrue("The original element must not exist", !element.exists());
- }
- }
- assertTrue("Moved element should exist", moved.exists());
-
- //ensure correct position
- if (element.getElementType() > IJavaElement.COMPILATION_UNIT) {
- if (siblings != null && siblings.length > 0) {
- ensureCorrectPositioning((IParent) moved.getParent(), siblings[i], moved);
- }
- } else {
- IJavaElement container = destinations[i];
- if (container.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) {
- } else { // ensure package name is correct
-
- if (container.getElementName().equals("")) {
- // default package - should be no package decl
- IJavaElement[] children = ((ICompilationUnit) moved).getChildren();
- boolean found = false;
- for (int j = 0; j < children.length; j++) {
- if (children[j] instanceof IPackageDeclaration) {
- found = true;
- break;
- }
- }
- assertTrue("Should not find package decl", !found);
- } else {
- IJavaElement[] children = ((ICompilationUnit) moved).getChildren();
- boolean found = false;
- for (int j = 0; j < children.length; j++) {
- if (children[j] instanceof IPackageDeclaration) {
- assertTrue("package declaration incorrect", ((IPackageDeclaration) children[j]).getElementName().equals(container.getElementName()));
- found = true;
- break;
- }
- }
- assertTrue("Did not find package decl", found);
- }
- }
- }
- IJavaElementDelta destDelta = null;
- if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu
- destDelta = getDeltaFor(moved.getParent());
- assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED);
- assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0);
- assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(element.getParent()));
- } else {
- destDelta = getDeltaFor(destinations[i], true);
- assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
- IJavaElementDelta[] deltas = destDelta.getAddedChildren();
- assertTrue("Added children not correct for element copy", deltas[i].getElement().equals(moved));
- assertTrue("should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED);
- IJavaElementDelta sourceDelta= getDeltaFor(element, false);
- assertTrue("should be K_REMOVED", sourceDelta.getKind() == IJavaElementDelta.REMOVED);
- }
- }
- } finally {
- stopDeltas();
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java
deleted file mode 100644
index cdd8c07..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-
-public class CreateMembersTests extends AbstractJavaModelTests {
-
- IJavaProject project;
-
- public CreateMembersTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new Suite(CreateMembersTests.class);
- }
- public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("CreateMembers");
- }
- public void tearDownSuite() throws Exception {
- deleteProject("CreateMembers");
-
- super.tearDownSuite();
- }
-
- private void assertArraysEquals(String actualContents, String expectedContents) {
- String[] actualContentsArray = createArrayOfString(actualContents);
- String[] expectedContentsArray = createArrayOfString(expectedContents);
- assertTrue("Different size", actualContentsArray.length == expectedContentsArray.length); //$NON-NLS-1$
- for (int i = 0, max = expectedContentsArray.length; i < max; i++) {
- if (!expectedContentsArray[i].equals(actualContentsArray[i])) {
- assertTrue("Found: \n" + actualContents + "\nExpecting: \n" + expectedContents, false);
- }
- }
- }
-
- private String[] createArrayOfString(String s) {
- StringTokenizer tokenizer = new StringTokenizer(s, "\r\n"); //$NON-NLS-1$
- ArrayList arrayList = new ArrayList();
- while (tokenizer.hasMoreElements()) {
- String nextToken = tokenizer.nextToken();
- if (nextToken.length() != 0) {
- arrayList.add(nextToken);
- }
- }
- return (String[]) arrayList.toArray(new String[arrayList.size()]);
- }
-
- public void test001() throws JavaModelException {
- ICompilationUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "A.java");
- assertNotNull("No compilation unit", compilationUnit);
- IType[] types = compilationUnit.getTypes();
- assertNotNull("No types", types);
- assertEquals("Wrong size", 1, types.length);
- IType type = types[0];
- type.createMethod("\tpublic void foo() {\n\t\tSystem.out.println(\"Hello World\");\n\t}\n", null, true, new NullProgressMonitor());
- String expectedSource = "public class A\n" +
- "{ public void foo() {\n" +
- " System.out.println(\"Hello World\");\n" +
- " }\n" +
- "}";
- assertArraysEquals(type.getSource(), expectedSource);
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java
deleted file mode 100644
index 1e81252..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.internal.compiler.env.IConstants;
-import org.eclipse.jdt.core.jdom.*;
-
-import junit.framework.Test;
-
-public class CreateMethodSourceExamplesTests extends AbstractJavaModelTests {
-
- IDOMFactory domFactory;
-
-public CreateMethodSourceExamplesTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.domFactory = new DOMFactory();
-}
-
-public static Test suite() {
- return new Suite(CreateMethodSourceExamplesTests.class);
-}
-/**
- * Example of creating source for a method in an interface.
- */
-public void testCreateEmptyInterfaceMethod() {
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setBody(";\n");
- assertSourceEquals(
- "source code incorrect",
- "public void foo();\n",
- method.getContents());
-}
-/**
- * Example of creating a default empty method.
- */
-public void testCreateEmptyMethod() {
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- assertSourceEquals(
- "source code incorrect",
- "public void foo() {\n" +
- "}\n",
- method.getContents());
-}
-/**
- * Example of creating an abstract method.
- */
-public void testCreateMethodWithAbstractModifier() {
-
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setFlags(IConstants.AccPublic| IConstants.AccAbstract);
- assertSourceEquals(
- "source code incorrect",
- "public abstract void foo() {\n" +
- "}\n",
- method.getContents());
-
-}
-/**
- * Example of creating a method body.
- */
-public void testCreateMethodWithBody() {
-
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setBody(
- " {\n" +
- "\t...method body...\n" +
- "}\n");
- assertSourceEquals(
- "source code incorrect",
- "public void foo() {\n" +
- "\t...method body...\n" +
- "}\n",
- method.getContents());
-
-}
-/**
- * Example of creating a method with public and static modifiers.
- */
-public void testCreateMethodWithModifiers() {
-
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setFlags(IConstants.AccPublic| IConstants.AccStatic);
- assertSourceEquals(
- "source code incorrect",
- "public static void foo() {\n" +
- "}\n",
- method.getContents());
-
-}
-/**
- * Example of creating a method with modifiers and exceptions
- */
-public void testCreateMethodWithModifiersAndExceptions() {
-
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setFlags(IConstants.AccPrivate);
- method.setExceptions(new String[]
- {"java.lang.IllegalArgumentException",
- "java.io.FileNotFoundExcpetion"});
- assertSourceEquals(
- "source code incorrect",
- "private void foo() throws java.lang.IllegalArgumentException, java.io.FileNotFoundExcpetion {\n" +
- "}\n",
- method.getContents());
-
-}
-/**
- * Example of creating a method with parameters
- */
-public void testCreateMethodWithParameters() {
-
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setParameters(
- new String[] {"String", "int", "char[]"},
- new String[] {"name", "number", "buffer"});
- assertSourceEquals(
- "source code incorrect",
- "public void foo(String name, int number, char[] buffer) {\n" +
- "}\n",
- method.getContents());
-}
-/**
- * Example of creating a method with a return type
- */
-public void testCreateMethodWithReturnType() {
-
- IDOMMethod method= this.domFactory.createMethod();
- method.setName("foo");
- method.setReturnType("String");
- assertSourceEquals(
- "source code incorrect",
- "public String foo() {\n" +
- "}\n",
- method.getContents());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java
deleted file mode 100644
index 4ea07df..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.internal.compiler.env.IConstants;
-import org.eclipse.jdt.core.jdom.*;
-
-import junit.framework.Test;
-
-public class CreateTypeSourceExamplesTests extends AbstractJavaModelTests {
- IDOMFactory domFactory;
-
-public CreateTypeSourceExamplesTests(String name) {
- super(name);
-}
-public static Test suite() {
- return new Suite(CreateTypeSourceExamplesTests.class);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.domFactory = new DOMFactory();
-}
-/**
- * Example of creating a class with an extends clause
- */
-public void testCreateClassWithExtends() {
- IDOMType type= this.domFactory.createType();
- type.setName("Foo");
- type.setSuperclass("Bar");
- assertSourceEquals(
- "source code incorrect",
- "public class Foo extends Bar {\n" +
- "}\n",
- type.getContents());
-}
-/**
- * Example of creating a class with an implements clause.
- */
-public void testCreateClassWithImplements() {
- IDOMType type= this.domFactory.createType();
- type.setName("Foo");
- type.setSuperInterfaces(new String[] {"ISomething", "IOtherwise"});
- assertSourceEquals(
- "source code incorrect",
- "public class Foo implements ISomething, IOtherwise {\n" +
- "}\n",
- type.getContents());
-}
-
-/**
- * Example of creating a class with an implements clause.
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10979
- */
-public void testCreateClassWithImplements2() {
- IDOMType type= this.domFactory.createType("class A implements I1 {\n}");
- type.addSuperInterface("I2");
- assertSourceEquals(
- "source code incorrect",
- "class A implements I1, I2 {\n}",
- type.getContents());
-}
-
-/**
- * Example of creating a class with an implements clause.
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10979
- */
-public void testCreateClassWithImplements3() {
- IDOMType type= this.domFactory.createType("class A {\n}");
- type.setSuperInterfaces(new String[] {"I1", "I2"});
- assertSourceEquals(
- "source code incorrect",
- "class A implements I1, I2 {\n}",
- type.getContents());
-}
-
-/**
- * Example of creating a class with an implements clause.
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10979
- */
-public void testCreateClassWithImplements4() {
- IDOMType type= this.domFactory.createType("class A implements I1{\n}");
- type.addSuperInterface("I2");
- assertSourceEquals(
- "source code incorrect",
- "class A implements I1, I2{\n}",
- type.getContents());
-}
-
-/**
- * Example of creating a class with modifiers
- */
-public void testCreateClassWithModifiers() {
- IDOMType type= this.domFactory.createType();
- type.setName("Foo");
- type.setFlags(IConstants.AccPublic | IConstants.AccFinal);
- assertSourceEquals(
- "source code incorrect",
- "public final class Foo {\n" +
- "}\n",
- type.getContents());
-}
-/**
- * Example of creating a default class
- */
-public void testCreateEmptyClass() {
- IDOMType type= this.domFactory.createType();
- type.setName("Foo");
- assertSourceEquals(
- "source code incorrect",
- "public class Foo {\n" +
- "}\n",
- type.getContents());
-}
-/**
- * Ensures that an interface is created using
- * <code>CreateTypeSourceOperation</code> and that the source
- * of the created interface is correct.
- */
-public void testCreateEmptyInterface() {
- IDOMType type= this.domFactory.createType();
- type.setName("Foo");
- type.setClass(false);
- assertSourceEquals(
- "source code incorrect",
- "public interface Foo {\n" +
- "}\n",
- type.getContents());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java
deleted file mode 100644
index 3b45dec..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.text.Collator;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ArrayType;
-import org.eclipse.jdt.core.dom.BodyDeclaration;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.Initializer;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.QualifiedName;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.util.CompilationUnitSorter;
-
-/**
- * The class <code>DefaultJavaElementComparator</code> is a standard
- * implementation of a comparator.
- * <p>
- * <ul>
- * <li>static fields, arranged alphabetically by name and access modifier
- * (public, protected, private, default)</li>
- * <li>static initializers in order of appearance</li>
- * <li>instance fields, arranged alphabetically by name and access modifier
- * (public, protected, private, default)</li>
- * <li>instance initializers in order of appearance</li>
- * <li>type declarations, arranged alphabetically by name and access modifier
- * (public, protected, private, default)</li>
- * <li>constructors, arranged by parameter order and access modifier
- * (public, protected, private, default)</li>
- * <li>methods, arranged by alphabetically by name and parameter order and
- * access modifier (public, protected, private, default)</li>
- * </p>
- */
-class DefaultJavaElementComparator implements Comparator {
-
- private static final int STATIC_TYPE_CATEGORY = 0;
- private static final int STATIC_FIELD_CATEGORY = 1;
- private static final int STATIC_INITIALIZER_CATEGORY = 2;
- private static final int STATIC_METHOD_CATEGORY = 3;
- private static final int TYPE_CATEGORY = 4;
- private static final int FIELD_CATEGORY = 5;
- private static final int INITIALIZER_CATEGORY = 6;
- private static final int CONSTRUCTOR_CATEGORY = 7;
- private static final int METHOD_CATEGORY = 8;
-
- private Collator collator;
-
- private int[] categories;
-
- /**
- * Creates an instance that sorts the various categories of body
- * declarations in the following order:
- * <ol>
- * <li>static types</li>
- * <li>static fields </li>
- * <li>static initializers</li>
- * <li>non-static fields</li>
- * <li>instance initializers</li>
- * <li>types</li>
- * <li>static methods</li>
- * <li>constructors</li>
- * <li>non-static methods</li>
- * </ol>
- */
- public DefaultJavaElementComparator() {
- // initialize default categories
- this.categories = new int[] {
- 1, // static type
- 2, // static field
- 3, // static initializer
- 7, // static method
- 6, // type
- 4, // field
- 5, // initializer
- 8, // constructor
- 9 // method
- };
- this.collator = Collator.getInstance();
- }
-
- /**
- * Creates an instance that arranges the various categories of body
- * declarations.
- * This constructor is used to specify customized values for the different categories.
- * They are a convinient way to distinguish AST nodes.
- * The lower a value is, the higher the node will appear in the sorted
- * compilation unit.
- * <p>
- * There are nine categories with theirs default values:
- * <ol>
- * <li>static types (1)</li>
- * <li>static fields (2)</li>
- * <li>static initializers (3)</li>
- * <li>fields (4) </li>
- * <li>initializers (5)</li>
- * <li>types (6)</li>
- * <li>static methods (7)</li>
- * <li>constructors (8)</li>
- * <li>methods (9)</li>
- * </ol>
- * </p>
- *
- * @param staticTypeCategory the given value for the static type category
- * @param staticFieldCategory the given value for the static field category
- * @param staticInitializerCategory the given value for the static initializer category
- * @param staticMethodCategory the given value for static the method category
- * @param typeCategory the given value for the type category
- * @param fieldCategory the given value for field category
- * @param initializerCategory the given value for initializer category
- * @param constructorCategory the given value for constructor category
- * @param methodCategory the given value for method category
- */
- public DefaultJavaElementComparator(
- int staticTypeCategory,
- int staticFieldCategory,
- int staticInitializerCategory,
- int staticMethodCategory,
- int typeCategory,
- int fieldCategory,
- int initializerCategory,
- int constructorCategory,
- int methodCategory) {
- this.categories = new int[] {
- staticTypeCategory,
- staticFieldCategory,
- staticInitializerCategory,
- staticMethodCategory,
- typeCategory,
- fieldCategory,
- initializerCategory,
- constructorCategory,
- methodCategory
- };
- this.collator = Collator.getInstance();
- }
-
- /**
- * This method is used to retrieve the category for a body declaration node according to the
- * preferences passed at the creation of the comparator.
- *
- * @param node the given node
- * @return the category corresponding to the given node
- *
- * @since 2.1
- */
- private int getCategory(BodyDeclaration node) {
- switch(node.getNodeType()) {
- case ASTNode.METHOD_DECLARATION :
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- if (methodDeclaration.isConstructor()) {
- return this.categories[CONSTRUCTOR_CATEGORY];
- }
- if (Flags.isStatic(methodDeclaration.getModifiers())) {
- return this.categories[STATIC_METHOD_CATEGORY];
- } else {
- return this.categories[METHOD_CATEGORY];
- }
- case ASTNode.FIELD_DECLARATION :
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- if (Flags.isStatic(fieldDeclaration.getModifiers())) {
- return this.categories[STATIC_FIELD_CATEGORY];
- } else {
- return this.categories[FIELD_CATEGORY];
- }
- case ASTNode.TYPE_DECLARATION :
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- if (Flags.isStatic(typeDeclaration.getModifiers())) {
- return this.categories[STATIC_TYPE_CATEGORY];
- } else {
- return this.categories[TYPE_CATEGORY];
- }
- case ASTNode.INITIALIZER :
- Initializer initializer = (Initializer) node;
- if (Flags.isStatic(initializer.getModifiers())) {
- return this.categories[STATIC_INITIALIZER_CATEGORY];
- } else {
- return this.categories[INITIALIZER_CATEGORY];
- }
- }
- return 0;
- }
-
- /**
- * The <code>DefaultJavaElementComparator</code> implementation of this
- * <code>java.util.Comparator</code> method can only be used to compare
- * instances of <code>org.eclipse.jdt.core.dom.BodyDeclaration</code>.
- * <p>
- * The categories of each body declaration are compared. If they are
- * in different categories, they are ordered based on their category.
- * Body declarations within the same category are ordered by signature
- * string. Body declarations with the same signature string are ordered
- * by their original relative positions.
- * </p>
- */
- public int compare(Object o1, Object o2) {
- if (!(o1 instanceof BodyDeclaration) && !(o2 instanceof BodyDeclaration)) {
- throw new ClassCastException();
- }
- BodyDeclaration node1 = (BodyDeclaration) o1;
- BodyDeclaration node2 = (BodyDeclaration) o2;
- int category1 = getCategory(node1);
- int category2 = getCategory(node2);
-
- if (category1 != category2) {
- return category1 - category2;
- }
- if (o1 == o2) {
- return 0;
- }
- String node1Signature = buildSignature(node1);
- String node2Signature = buildSignature(node2);
- if (node1Signature.length() != 0 && node2Signature.length() != 0) {
- int compare = this.collator.compare(node1Signature, node2Signature);
- if (compare != 0) {
- return compare;
- }
- }
- int sourceStart1 = ((Integer) node1.getProperty(CompilationUnitSorter.RELATIVE_ORDER)).intValue();
- int sourceStart2 = ((Integer) node2.getProperty(CompilationUnitSorter.RELATIVE_ORDER)).intValue();
- return sourceStart1 - sourceStart2;
- }
-
- private String buildSignature(BodyDeclaration node) {
- switch(node.getNodeType()) {
- case ASTNode.METHOD_DECLARATION :
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- StringBuffer buffer = new StringBuffer();
- buffer.append(methodDeclaration.getName().getIdentifier());
- final List parameters = methodDeclaration.parameters();
- int length1 = parameters.size();
- for (int i = 0; i < length1; i++) {
- SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(i);
- buffer.append(parameter.getName().getIdentifier());
- Type type = parameter.getType();
- buffer.append(buildSignature(type));
- }
- return buffer.toString();
- case ASTNode.FIELD_DECLARATION :
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- return ((VariableDeclarationFragment) fieldDeclaration.fragments().get(0)).getName().getIdentifier();
- case ASTNode.INITIALIZER :
- return ((Integer) node.getProperty(CompilationUnitSorter.RELATIVE_ORDER)).toString();
- case ASTNode.TYPE_DECLARATION :
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- return typeDeclaration.getName().getIdentifier();
- }
- return null;
- }
-
- private String buildSignature(Type type) {
- switch(type.getNodeType()) {
- case ASTNode.PRIMITIVE_TYPE :
- PrimitiveType.Code code = ((PrimitiveType) type).getPrimitiveTypeCode();
- return code.toString();
- case ASTNode.ARRAY_TYPE :
- ArrayType arrayType = (ArrayType) type;
- StringBuffer buffer = new StringBuffer();
- buffer.append(buildSignature(arrayType.getElementType()));
- int dimensions = arrayType.getDimensions();
- for (int j = 0; j < dimensions; j++) {
- buffer.append("[]"); //$NON-NLS-1$
- }
- return buffer.toString();
- case ASTNode.SIMPLE_TYPE :
- SimpleType simpleType = (SimpleType) type;
- return buildSignature(simpleType.getName());
- }
- return null; // should never happen
- }
-
- private String buildSignature(Name name) {
- if (name.isSimpleName()) {
- return ((SimpleName) name).getIdentifier();
- } else {
- QualifiedName qualifiedName = (QualifiedName) name;
- return buildSignature(qualifiedName.getQualifier()) + "." + buildSignature(qualifiedName.getName()); //$NON-NLS-1$
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/EncodingTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/EncodingTests.java
deleted file mode 100644
index 77e172d..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/EncodingTests.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.Util;
-
-/**
- * @author oliviert
- */
-public class EncodingTests extends ModifyingResourceTests {
-
-
- public EncodingTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new Suite(EncodingTests.class.getName());
- suite.addTest(new EncodingTests("testCreateCompilationUnitAndImportContainer"));
- return suite;
- }
-
-
-
- /**
- * Check that the compilation unit is saved with the proper encoding.
- */
- public void testCreateCompilationUnitAndImportContainer() throws JavaModelException, CoreException {
- String savedEncoding = null;
- try {
- Preferences preferences = ResourcesPlugin.getPlugin().getPluginPreferences();
-
- savedEncoding = preferences.getString(ResourcesPlugin.PREF_ENCODING);
- preferences.setValue(ResourcesPlugin.PREF_ENCODING, "UTF-8");
-
- ResourcesPlugin.getPlugin().savePluginPreferences();
-
- IJavaProject javaProject = createJavaProject("P", new String[] { "" }, "");
- IPackageFragment pkg = getPackageFragment("P", "", "");
- ICompilationUnit cu= pkg.createCompilationUnit("A.java",
- ("public class A {\r\n" +
- " public static main(String[] args) {\r\n" +
- " System.out.println(\"é\");\r\n" +
- " }\r\n" +
- "}"), false, new NullProgressMonitor());
- assertCreation(cu);
- cu.rename("B.java", true, new NullProgressMonitor());
- cu = pkg.getCompilationUnit("B.java");
- cu.rename("A.java", true, new NullProgressMonitor());
- cu = pkg.getCompilationUnit("A.java");
- byte[] tab = new byte[90];
- tab[0]=112;
- tab[1]=117;
- tab[2]=98;
- tab[3]=108;
- tab[4]=105;
- tab[5]=99;
- tab[6]=32;
- tab[7]=99;
- tab[8]=108;
- tab[9]=97;
- tab[10]=115;
- tab[11]=115;
- tab[12]=32;
- tab[13]=65;
- tab[14]=32;
- tab[15]=123;
- tab[16]=13;
- tab[17]=10;
- tab[18]=9;
- tab[19]=112;
- tab[20]=117;
- tab[21]=98;
- tab[22]=108;
- tab[23]=105;
- tab[24]=99;
- tab[25]=32;
- tab[26]=115;
- tab[27]=116;
- tab[28]=97;
- tab[29]=116;
- tab[30]=105;
- tab[31]=99;
- tab[32]=32;
- tab[33]=109;
- tab[34]=97;
- tab[35]=105;
- tab[36]=110;
- tab[37]=40;
- tab[38]=83;
- tab[39]=116;
- tab[40]=114;
- tab[41]=105;
- tab[42]=110;
- tab[43]=103;
- tab[44]=91;
- tab[45]=93;
- tab[46]=32;
- tab[47]=97;
- tab[48]=114;
- tab[49]=103;
- tab[50]=115;
- tab[51]=41;
- tab[52]=32;
- tab[53]=123;
- tab[54]=13;
- tab[55]=10;
- tab[56]=9;
- tab[57]=9;
- tab[58]=83;
- tab[59]=121;
- tab[60]=115;
- tab[61]=116;
- tab[62]=101;
- tab[63]=109;
- tab[64]=46;
- tab[65]=111;
- tab[66]=117;
- tab[67]=116;
- tab[68]=46;
- tab[69]=112;
- tab[70]=114;
- tab[71]=105;
- tab[72]=110;
- tab[73]=116;
- tab[74]=108;
- tab[75]=110;
- tab[76]=40;
- tab[77]=34;
- tab[78]=-61;
- tab[79]=-87;
- tab[80]=34;
- tab[81]=41;
- tab[82]=59;
- tab[83]=13;
- tab[84]=10;
- tab[85]=9;
- tab[86]=125;
- tab[87]=13;
- tab[88]=10;
- tab[89]=125;
- byte[] encodedContents = Util.getResourceContentsAsByteArray(javaProject.getProject().getWorkspace().getRoot().getFile(cu.getPath()));
- assertTrue("wrong size of encoded string", tab.length == encodedContents.length);
- for (int i = 0, max = tab.length; i < max; i++) {
- assertTrue("wrong size of encoded character at" + i, tab[i] == encodedContents[i]);
- }
- } finally {
- deleteProject("P");
-
- Preferences preferences = ResourcesPlugin.getPlugin().getPluginPreferences();
-
- preferences.setValue(ResourcesPlugin.PREF_ENCODING, savedEncoding);
-
- ResourcesPlugin.getPlugin().savePluginPreferences();
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExclusionPatternsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExclusionPatternsTests.java
deleted file mode 100644
index 6b48529..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExclusionPatternsTests.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-
-import junit.framework.Test;
-
-public class ExclusionPatternsTests extends ModifyingResourceTests {
- IJavaProject project;
-public ExclusionPatternsTests(String name) {
- super(name);
-}
-protected void setClasspath(String[] sourceFoldersAndExclusionPatterns) throws JavaModelException {
- this.project.setRawClasspath(createClasspath(sourceFoldersAndExclusionPatterns), null);
-}
-protected void setUp() throws Exception {
- super.setUp();
- this.project = this.createJavaProject("P", new String[] {"src"}, "bin");
- startDeltas();
-}
-
-public static Test suite() {
- if (false) {
- Suite suite = new Suite(ExclusionPatternsTests.class.getName());
- suite.addTest(new ExclusionPatternsTests("testSearchPotentialMatchInOutput"));
- return suite;
- }
- return new Suite(ExclusionPatternsTests.class);
-}
-
-protected void tearDown() throws Exception {
- stopDeltas();
- this.deleteProject("P");
- super.tearDown();
-}
-/*
- * Ensure that adding an exclusion on a compilation unit
- * makes it disappears from the children of its package and it is added to the non-java resources.
- */
-public void testAddExclusionOnCompilationUnit() throws CoreException {
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- clearDeltas();
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
-
- IPackageFragment pkg = getPackage("/P/src/p");
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- pkg.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "A.java",
- pkg.getNonJavaResources());
-}
-/*
- * Ensure that adding an exclusion on a folder directly under a project (and prj=src)
- * makes it appears as a non-java resources.
- * (regression test for bug 29374 Excluded folder on project not returned by Java Model)
- */
-public void testAddExclusionOnFolderUnderProject() throws CoreException {
- try {
- IJavaProject javaProject = this.createJavaProject("P1", new String[] {""}, "");
- this.createFolder("/P1/doc");
-
- clearDeltas();
- javaProject.setRawClasspath(createClasspath(new String[] {"/P1", "doc/"}), null);
-
- assertDeltas(
- "Unexpected deltas",
- "P1[*]: {CHILDREN}\n" +
- " [project root][*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P1/.classpath)[*]"
- );
-
- IPackageFragmentRoot root = getPackageFragmentRoot("/P1");
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources of project",
- ".classpath\n" +
- ".project\n" +
- "doc",
- javaProject.getNonJavaResources());
- } finally {
- this.deleteProject("P1");
- }
-}
-/*
- * Ensure that adding an exclusion on a package
- * makes it disappears from the children of its package fragment root
- * and it is added to the non-java resources.
- */
-public void testAddExclusionOnPackage() throws CoreException {
- this.createFolder("/P/src/p");
-
- clearDeltas();
- this.setClasspath(new String[] {"/P/src", "p/"});
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
-
- IPackageFragmentRoot root = getPackageFragmentRoot("/P/src");
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "p",
- root.getNonJavaResources());
-}
-/*
- * Ensure that adding a file to a folder that is excluded reports the correct delta.
- * (regression test for bug 29621 Wrong Delta When Adding to Filtered Folder)
- */
-public void testAddToExcludedFolder() throws CoreException {
- this.createFolder("/P/src/icons");
-
- // exclude folder and its contents
- this.setClasspath(new String[] {"/P/src", "icons/"});
-
- clearDeltas();
- this.createFile("/P/src/icons/my.txt", "");
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/icons)[*]"
- );
-
- clearDeltas();
- this.deleteFile("/P/src/icons/my.txt");
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/icons)[*]"
- );
-}
-/*
- * Ensure that creating an excluded compilation unit
- * doesn't make it appear as a child of its package but it is a non-java resource.
- */
-public void testCreateExcludedCompilationUnit() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
- this.createFolder("/P/src/p");
- IPackageFragment pkg = getPackage("/P/src/p");
-
- clearDeltas();
- pkg.createCompilationUnit(
- "A.java",
- "package p;\n" +
- "public class A {\n" +
- "}",
- false,
- null);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/p/A.java)[+]"
- );
-
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- pkg.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "A.java",
- pkg.getNonJavaResources());
-}
-/*
- * Ensure that crearing an excluded package
- * doesn't make it appear as a child of its package fragment root but it is a non-java resource.
- */
-public void testCreateExcludedPackage() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "p/"});
- IPackageFragmentRoot root = getPackageFragmentRoot("/P/src");
-
- clearDeltas();
- root.createPackageFragment("p", false, null);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/p)[+]"
- );
-
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "p",
- root.getNonJavaResources());
-}
-/*
- * Ensure that creating a file that corresponds to an excluded compilation unit
- * doesn't make it appear as a child of its package but it is a non-java resource.
- */
-public void testCreateResourceExcludedCompilationUnit() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
- this.createFolder("/P/src/p");
-
- clearDeltas();
- this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/p/A.java)[+]"
- );
-
- IPackageFragment pkg = getPackage("/P/src/p");
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- pkg.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "A.java",
- pkg.getNonJavaResources());
-}
-/*
- * Ensure that creating a folder that corresponds to an excluded package
- * doesn't make it appear as a child of its package fragment root but it is a non-java resource.
- */
-public void testCreateResourceExcludedPackage() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "p/"});
-
- clearDeltas();
- this.createFolder("/P/src/p");
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/p)[+]"
- );
-
- IPackageFragmentRoot root = getPackageFragmentRoot("/P/src");
- assertSortedElementsEqual(
- "Unexpected children",
- "",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "p",
- root.getNonJavaResources());
-}
-/*
- * Ensures that a cu that is not excluded is on the classpath of the project.
- */
-public void testIsOnClasspath1() throws CoreException {
- this.setClasspath(new String[] {"/P/src", ""});
- this.createFolder("/P/src/p");
- IFile file = this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
- assertTrue("Resource should be on classpath", project.isOnClasspath(file));
-
- ICompilationUnit cu = getCompilationUnit("/P/src/p/A.java");
- assertTrue("CU should be on classpath", project.isOnClasspath(cu));
-}
-/*
- * Ensures that a cu that is excluded is not on the classpath of the project.
- */
-public void testIsOnClasspath2() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
- this.createFolder("/P/src/p");
- IFile file = this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
- assertTrue("Resource should not be on classpath", !project.isOnClasspath(file));
-
- ICompilationUnit cu = getCompilationUnit("/P/src/p/A.java");
- assertTrue("CU should not be on classpath", !project.isOnClasspath(cu));
-}
-/*
- * Ensures that a non-java resource that is not excluded is on the classpath of the project.
- */
-public void testIsOnClasspath3() throws CoreException {
- this.setClasspath(new String[] {"/P/src", ""});
- this.createFolder("/P/src/p");
- IFile file = this.createFile("/P/src/p/readme.txt", "");
- assertTrue("Resource should be on classpath", project.isOnClasspath(file));
-}
-/*
- * Ensures that a non-java resource that is excluded is not on the classpath of the project.
- */
-public void testIsOnClasspath4() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "p/**"});
- this.createFolder("/P/src/p");
- IFile file = this.createFile("/P/src/p/readme.txt", "");
- assertTrue("Resource should not be on classpath", !project.isOnClasspath(file));
-}
-/*
- * Ensures that an excluded nested source folder doesn't appear as a non-java resource of the outer folder.
- * (regression test for bug 28115 Ubiquitous resource in the JavaModel)
- *
- */
-public void testNestedSourceFolder1() throws CoreException {
- this.setClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
- this.createFolder("/P/src1/src2");
- IPackageFragmentRoot root1 = getPackageFragmentRoot("/P/src1");
- assertResourcesEqual(
- "Unexpected non-java resources for /P/src1",
- "",
- root1.getNonJavaResources());
-}
-/*
- * Ensures that adding a .java file in a nested source folder reports
- * a delta on the nested source folder and not on the outer one.
- */
-public void testNestedSourceFolder2() throws CoreException {
- this.setClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
- this.createFolder("/P/src1/src2");
-
- this.clearDeltas();
- this.createFile(
- "/P/src1/src2/A.java",
- "public class A {\n" +
- "}"
- );
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1/src2[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " A.java[+]: {}"
- );
-}
-/*
- * Ensures that adding a .txt file in a nested source folder reports
- * a resource delta on the nested source folder and not on the outer one.
- */
-public void testNestedSourceFolder3() throws CoreException {
- this.setClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
- this.createFolder("/P/src1/src2");
-
- this.clearDeltas();
- this.createFile("/P/src1/src2/readme.txt", "");
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1/src2[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src1/src2/readme.txt)[+]"
- );
-}
-/*
- * Ensures that adding a folder in a nested source folder reports
- * a delta on the nested source folder and not on the outer one.
- */
-public void testNestedSourceFolder4() throws CoreException {
- this.setClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
- this.createFolder("/P/src1/src2");
-
- this.clearDeltas();
- this.createFolder("/P/src1/src2/p");
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1/src2[*]: {CHILDREN}\n" +
- " p[+]: {}"
- );
-}
-/*
- * Ensures that adding a folder in a outer source folder reports
- * a delta on the outer source folder and not on the nested one.
- */
-public void testNestedSourceFolder5() throws CoreException {
- this.setClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
- this.createFolder("/P/src1/src2");
-
- this.clearDeltas();
- this.createFolder("/P/src1/p");
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1[*]: {CHILDREN}\n" +
- " p[+]: {}"
- );
-}
-/*
- * Ensures that moving a package from an outer source folder to a nested
- * source folder reports a move delta.
- */
-public void testNestedSourceFolder6() throws CoreException {
- this.setClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
- this.createFolder("/P/src1/src2");
- this.createFolder("/P/src1/p");
-
- this.clearDeltas();
- this.moveFolder("/P/src1/p", "/P/src1/src2/p");
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1[*]: {CHILDREN}\n" +
- " p[-]: {MOVED_TO(p [in src1/src2 [in P]])}\n" +
- " src1/src2[*]: {CHILDREN}\n" +
- " p[+]: {MOVED_FROM(p [in src1 [in P]])}"
- );
-}
-/*
- * Ensure that renaming an excluded compilation unit so that it is not excluded any longer
- * makes it appears as a child of its package and it is removed from the non-java resources.
- */
-public void testRenameExcludedCompilationUnit() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
- this.createFolder("/P/src/p");
- IFile file = this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- clearDeltas();
- file.move(new Path("/P/src/p/B.java"), false, null);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CHILDREN | CONTENT}\n" +
- " B.java[+]: {}\n" +
- " ResourceDelta(/P/src/p/A.java)[-]"
- );
-
- IPackageFragment pkg = getPackage("/P/src/p");
- assertSortedElementsEqual(
- "Unexpected children",
- "B.java",
- pkg.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "",
- pkg.getNonJavaResources());
-}
-/*
- * Ensure that renaming an excluded package so that it is not excluded any longer
- * makes it appears as a child of its package fragment root
- * and it is removed from the non-java resources.
- */
-public void testRenameExcludedPackage() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "p/"});
- IPackageFragmentRoot root = getPackageFragmentRoot("/P/src");
- IPackageFragment pkg = root.createPackageFragment("p", false, null);
-
- clearDeltas();
- pkg.rename("q", false, null);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN | CONTENT}\n" +
- " q[+]: {}\n" +
- " ResourceDelta(/P/src/p)[-]"
- );
-
- assertSortedElementsEqual(
- "Unexpected children",
- "\n" + // default package
- "q",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "",
- root.getNonJavaResources());
-}
-/*
- * Ensure that renaming a file that corresponds to an excluded compilation unit so that it is not excluded any longer
- * makes it appears as a child of its package and it is removed from the non-java resources.
- */
-public void testRenameResourceExcludedCompilationUnit() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
- this.createFolder("/P/src/p");
- IFile file = this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- clearDeltas();
- file.move(new Path("/P/src/p/B.java"), false, null);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CHILDREN | CONTENT}\n" +
- " B.java[+]: {}\n" +
- " ResourceDelta(/P/src/p/A.java)[-]"
- );
-
- IPackageFragment pkg = getPackage("/P/src/p");
- assertSortedElementsEqual(
- "Unexpected children",
- "B.java",
- pkg.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "",
- pkg.getNonJavaResources());
-}
-/*
- * Ensure search doesn't find matches in an excluded compilation unit.
- */
-public void testSearchWithExcludedCompilationUnit1() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "**/A.java"});
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- JavaSearchTests.JavaSearchResultCollector resultCollector = new JavaSearchTests.JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "A",
- IJavaSearchConstants.TYPE,
- IJavaSearchConstants.DECLARATIONS,
- SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("P")}),
- resultCollector);
- assertEquals(
- "Unexpected matches found",
- "",
- resultCollector.toString());
-}
-/*
- * Ensure search find matches in a compilation unit that was excluded but that is not any longer.
- */
-public void testSearchWithExcludedCompilationUnit2() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "A.java"});
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- this.setClasspath(new String[] {"/P/src", ""});
- JavaSearchTests.JavaSearchResultCollector resultCollector = new JavaSearchTests.JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "A",
- IJavaSearchConstants.TYPE,
- IJavaSearchConstants.DECLARATIONS,
- SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("P")}),
- resultCollector);
- assertEquals(
- "Unexpected matches found",
- "src/p/A.java p.A [A]",
- resultCollector.toString());
-}
-/*
- * Ensure that renaming a folder that corresponds to an excluded package
- * so that it is not excluded any longer
- * makes it appears as a child of its package fragment root
- * and it is removed from the non-java resources.
- */
-public void testRenameResourceExcludedPackage() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "p/"});
- IFolder folder = this.createFolder("/P/src/p");
-
- clearDeltas();
- folder.move(new Path("/P/src/q"), false, null);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN | CONTENT}\n" +
- " q[+]: {}\n" +
- " ResourceDelta(/P/src/p)[-]"
- );
-
- IPackageFragmentRoot root = getPackageFragmentRoot("/P/src");
- assertSortedElementsEqual(
- "Unexpected children",
- "\n" + // default package
- "q",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "",
- root.getNonJavaResources());
-}
-/*
- * Ensure that a potential match in the output folder is not indexed.
- * (regression test for bug 32041 Multiple output folders fooling Java Model)
- */
-public void testSearchPotentialMatchInOutput() throws CoreException {
- try {
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IJavaProject javaProject = createJavaProject("P2", new String[] {}, "bin");
- javaProject.setRawClasspath(createClasspath(new String[] {"/P2", "src/", "/P2/src", ""}), null);
- createFile(
- "/P2/bin/X.java",
- "public class X {\n" +
- "}"
- );
- }
- }, null);
-
- JavaSearchTests.JavaSearchResultCollector resultCollector = new JavaSearchTests.JavaSearchResultCollector();
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {getJavaProject("P")});
- new SearchEngine().search(
- getWorkspace(),
- "X",
- IJavaSearchConstants.TYPE,
- IJavaSearchConstants.DECLARATIONS,
- scope,
- resultCollector);
- assertEquals("", resultCollector.toString());
- } finally {
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that removing the exclusion on a compilation unit
- * makes it appears as a child of its package and it is removed from the non-java resources.
- */
-public void testRemoveExclusionOnCompilationUnit() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "A.java"});
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/A.java",
- "package p;\n" +
- "public class A {\n" +
- "}"
- );
-
- clearDeltas();
- this.setClasspath(new String[] {"/P/src", ""});
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
-
- IPackageFragment pkg = getPackage("/P/src/p");
- assertSortedElementsEqual(
- "Unexpected children",
- "A.java",
- pkg.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "",
- pkg.getNonJavaResources());
-}
-/*
- * Ensure that removing the exclusion on a package
- * makes it appears as a child of its package fragment root
- * and it is removed from the non-java resources.
- */
-public void testRemoveExclusionOnPackage() throws CoreException {
- this.setClasspath(new String[] {"/P/src", "p"});
- this.createFolder("/P/src/p");
-
- clearDeltas();
- this.setClasspath(new String[] {"/P/src", ""});
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
-
- IPackageFragmentRoot root = getPackageFragmentRoot("/P/src");
- assertSortedElementsEqual(
- "Unexpected children",
- "\n" + // default package
- "p",
- root.getChildren());
-
- assertResourcesEqual(
- "Unexpected non-java resources",
- "",
- root.getNonJavaResources());
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExistenceTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExistenceTests.java
deleted file mode 100644
index 07158a0..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExistenceTests.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-public class ExistenceTests extends ModifyingResourceTests {
-public ExistenceTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- return new Suite(ExistenceTests.class);
-}
-protected void assertCorrespondingResourceFails(IJavaElement element) {
- boolean gotException = false;
- try {
- element.getCorrespondingResource();
- } catch (JavaModelException e) {
- if (e.isDoesNotExist()) {
- gotException = true;
- }
- }
- assertTrue("Should not be able to get corresponding resource", gotException);
-}
-protected void assertOpenFails(IOpenable openable) {
- boolean gotException = false;
- try {
- openable.open(null);
- } catch (JavaModelException e) {
- if (e.isDoesNotExist()) {
- gotException = true;
- }
- }
- assertTrue("Should not be able to open element", gotException);
-}
-protected void assertUnderlyingResourceFails(IJavaElement element) {
- boolean gotException = false;
- try {
- element.getUnderlyingResource();
- } catch (JavaModelException e) {
- if (e.isDoesNotExist()) {
- gotException = true;
- }
- }
- assertTrue("Should not be able to get underlying resource", gotException);
-}
-public void testClassFileInBinary() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile("P/bin/X.class", "");
- IClassFile classFile = this.getClassFile("P/bin/X.class");
- assertTrue(!classFile.exists());
- } finally {
- this.deleteProject("P");
- }
-}
-public void testClassFileInLibrary() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, new String[] {"lib"}, "bin");
- this.createFile("P/lib/X.class", "");
- IClassFile classFile = this.getClassFile("P/lib/X.class");
- assertTrue(classFile.exists());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that an IClassFile handle created on a .class file in a source folder
- * doesn't not exist.
- * (regression test for bug 36499 exists() returns true for a source file inside a classfolder)
- */
-public void testClassFileInSource1() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile("P/src/X.class", "");
- IClassFile classFile = this.getClassFile("P/src/X.class");
- assertTrue("Class file should not exist", !classFile.exists());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that an IClassFile handle created on a .class file in a source folder
- * cannot be opened.
- * (regression test for bug 36499 exists() returns true for a source file inside a classfolder)
- */
- public void testClassFileInSource2() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile("P/src/X.class", "");
- IClassFile classFile = this.getClassFile("P/src/X.class");
- assertOpenFails((IOpenable)classFile);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that an ICompilationUnit handle created on a .java file in a library folder
- * doesn't not exist.
- * (regression test for bug 36499 exists() returns true for a source file inside a classfolder)
- */
-public void testCompilationUnitInLibrary1() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, new String[] {"lib"}, "bin");
- this.createFile(
- "P/lib/X.java",
- "public class X {}"
- );
- ICompilationUnit cu = this.getCompilationUnit("P/lib/X.java");
- assertTrue("Ccompilation unit should not exist", !cu.exists());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that an ICompilationUnit handle created on a .java file in a library folder
- *cannot be opened.
- * (regression test for bug 36499 exists() returns true for a source file inside a classfolder)
- */
-public void testCompilationUnitInLibrary2() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, new String[] {"lib"}, "bin");
- this.createFile(
- "P/lib/X.java",
- "public class X {}"
- );
- ICompilationUnit cu = this.getCompilationUnit("P/lib/X.java");
- assertOpenFails((IOpenable)cu);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a non-existing class file cannot be opened.
- */
-public void testNonExistingClassFile() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, new String[] {"lib"}, "bin");
- IClassFile classFile = getClassFile("/P/lib/X.class");
- assertOpenFails(classFile);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a non-existing compilation unit cannot be opened.
- */
-public void testNonExistingCompilationUnit() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- ICompilationUnit cu = getCompilationUnit("/P/src/X.java");
- assertOpenFails(cu);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a non-existing package fragment cannot be opened.
- */
-public void testNonExistingPackageFragment() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- IPackageFragment pkg = this.getPackage("/P/src/x");
- assertOpenFails(pkg);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a non-Java project doesn't exist.
- * (regression test for bug 28545 JavaProject.exists() returns true if project doesn't have Java nature)
- */
-public void testNonJavaProject() throws CoreException {
- try {
- this.createProject("P");
- IProject project = this.getProject("P");
- IJavaProject javaProject = JavaCore.create(project);
-
- assertTrue("Simple project should not exist", !javaProject.exists());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that a package fragment root that is not on the classpath cannot be opened.
- */
-public void testPkgFragmentRootNotInClasspath() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IFolder folder = this.createFolder("/P/otherRoot");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(folder);
- assertTrue("Root should not exist", !root.exists());
- boolean gotException = false;
- try {
- root.open(null);
- } catch (JavaModelException e) {
- if (e.isDoesNotExist()) {
- gotException = true;
- }
- }
- assertTrue("Should not be able to open root", gotException);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing class file.
- */
-public void testCorrespondingResourceNonExistingClassFile() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, new String[] {"lib"}, "bin");
- IClassFile classFile = this.getClassFile("/P/lib/X.class");
- assertCorrespondingResourceFails(classFile);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing compilation unit.
- */
-public void testCorrespondingResourceNonExistingCompilationUnit() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- ICompilationUnit compilationUnit = this.getCompilationUnit("/P/src/X.java");
- assertCorrespondingResourceFails(compilationUnit);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing jar package fragment root.
- */
-public void testCorrespondingResourceNonExistingJarPkgFragmentRoot() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IPackageFragmentRoot root = project.getPackageFragmentRoot("/nonExisting.jar");
- assertCorrespondingResourceFails(root);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing package fragment.
- */
-public void testCorrespondingResourceNonExistingPkgFragment() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- IPackageFragment pkg = this.getPackage("/P/src/nonExisting");
- assertCorrespondingResourceFails(pkg);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing package fragment root.
- */
-public void testCorrespondingResourceNonExistingPkgFragmentRoot() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IFolder folder = this.createFolder("/P/nonExistingRoot");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(folder);
- assertCorrespondingResourceFails(root);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing java project.
- */
-public void testCorrespondingResourceNonExistingProject() throws CoreException {
- IProject nonExistingProject = ResourcesPlugin.getWorkspace().getRoot().getProject("NonExisting");
- IJavaProject javaProject = JavaCore.create(nonExistingProject);
- assertCorrespondingResourceFails(javaProject);
-}
-/*
- * Ensures that one cannot get the corresponding resource of a non-existing type.
- */
-public void testCorrespondingResourceNonExistingType() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile(
- "/P/src/X.java",
- "public class X{\n" +
- "}"
- );
- IType type = getCompilationUnit("/P/src/X.java").getType("NonExisting");
- assertCorrespondingResourceFails(type);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing class file.
- */
-public void testUnderlyingResourceNonExistingClassFile() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, new String[] {"lib"}, "bin");
- IClassFile classFile = this.getClassFile("/P/lib/X.class");
- assertUnderlyingResourceFails(classFile);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing compilation unit.
- */
-public void testUnderlyingResourceNonExistingCompilationUnit() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- ICompilationUnit compilationUnit = this.getCompilationUnit("/P/src/X.java");
- assertUnderlyingResourceFails(compilationUnit);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing jar package fragment root.
- */
-public void testUnderlyingResourceNonExistingJarPkgFragmentRoot() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IPackageFragmentRoot root = project.getPackageFragmentRoot("/nonExisting.jar");
- assertUnderlyingResourceFails(root);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing package fragment.
- */
-public void testUnderlyingResourceNonExistingPkgFragment() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- IPackageFragment pkg = this.getPackage("/P/src/nonExisting");
- assertUnderlyingResourceFails(pkg);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing package fragment root.
- */
-public void testUnderlyingResourceNonExistingPkgFragmentRoot() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- IFolder folder = this.createFolder("/P/nonExistingRoot");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(folder);
- assertUnderlyingResourceFails(root);
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing java project.
- */
-public void testUnderlyingResourceNonExistingProject() throws CoreException {
- IProject nonExistingProject = ResourcesPlugin.getWorkspace().getRoot().getProject("NonExisting");
- IJavaProject javaProject = JavaCore.create(nonExistingProject);
- assertUnderlyingResourceFails(javaProject);
-}
-/*
- * Ensures that one cannot get the underlying resource of a non-existing type.
- */
-public void testUnderlyingResourceNonExistingType() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile(
- "/P/src/X.java",
- "public class X{\n" +
- "}"
- );
- IType type = getCompilationUnit("/P/src/X.java").getType("NonExisting");
- assertUnderlyingResourceFails(type);
- } finally {
- this.deleteProject("P");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalJarDeltaTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalJarDeltaTests.java
deleted file mode 100644
index 8db80d8..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalJarDeltaTests.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-/**
- * These test ensure that modifications in external jar are correctly reported as
- * IJavaEllementDeltas after a JavaModel#refreshExternalArchives().
- */
-public class ExternalJarDeltaTests extends ModifyingResourceTests {
-
-public ExternalJarDeltaTests(String name) {
- super(name);
-}
-
-
-
-public static Test suite() {
- TestSuite suite = new Suite(ExternalJarDeltaTests.class.getName());
-
- suite.addTest(new ExternalJarDeltaTests("testExternalJar0"));
-
- suite.addTest(new ExternalJarDeltaTests("testExternalJarChanged1"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarChanged2"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarChanged3"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarAdded1"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarAdded2"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarAdded3"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarRemoved1"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarRemoved2"));
- suite.addTest(new ExternalJarDeltaTests("testExternalJarRemoved3"));
-
- suite.addTest(new ExternalJarDeltaTests("testExternalJarInternalExternalJar"));
-
- return suite;
-}
-
-private String getExternalPath() {
- return EXTERNAL_JAR_DIR_PATH;
-}
-
-private String getLibraryPath() {
- return getPluginDirectoryPath().substring(1).replace(File.separatorChar,'/')+"/LIB";
-}
-
-/**
- * Test if a modification is detected without doing a refresh.
- * Currently no modification are detected.
- */
-public void testExternalJar0() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p1Path = libPath+"/p1.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f1 = new File(p1Path);
- File f2 = new File(p2Path);
-
- copy(f1, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
-
- assertDeltas(
- "Unexpected delta",
- ""
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-
-/**
- * Refresh the JavaModel after a modification of an external jar.
- */
-public void testExternalJarChanged1() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p1Path = libPath+"/p1.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f1 = new File(p1Path);
- File f2 = new File(p2Path);
-
- copy(f1, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(null,null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[*]: {CONTENT | ARCHIVE CONTENT CHANGED}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh a JavaProject after a modification of an external jar.
- */
-public void testExternalJarChanged2() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p1Path = libPath+"/p1.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f1 = new File(p1Path);
- File f2 = new File(p2Path);
-
- copy(f1, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(new IJavaElement[]{project},null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[*]: {CONTENT | ARCHIVE CONTENT CHANGED}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh an external jar after a modification of this jar.
- */
-public void testExternalJarChanged3() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p1Path = libPath+"/p1.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f1 = new File(p1Path);
- File f2 = new File(p2Path);
-
- copy(f1, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
-
- IPackageFragmentRoot root = project.getPackageFragmentRoot(pPath);
- this.getJavaModel().refreshExternalArchives(new IJavaElement[]{root},null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[*]: {CONTENT | ARCHIVE CONTENT CHANGED}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh the JavaModel after an addition of an external jar.
- */
-public void testExternalJarAdded1() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/pAdded1.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f2 = new File(p2Path);
-
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(null,null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[+]: {}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh a JavaProject after an addition of an external jar.
- */
-public void testExternalJarAdded2() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/pAdded2.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f2 = new File(p2Path);
-
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(new IJavaElement[]{project},null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[+]: {}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh an external jar after an addition of this jar.
- */
-public void testExternalJarAdded3() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath =getLibraryPath();
- String pPath = getExternalPath()+"/pAdded3.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f2 = new File(p2Path);
-
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- copy(f2, f);
- IPackageFragmentRoot root = project.getPackageFragmentRoot(pPath);
- this.getJavaModel().refreshExternalArchives(new IJavaElement[]{root},null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[+]: {}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh the JavaModel after a removal of an external jar.
- */
-public void testExternalJarRemoved1() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f2 = new File(p2Path);
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- deleteFile(f);
- this.getJavaModel().refreshExternalArchives(null,null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[-]: {}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh a JavaProject after a removal of an external jar.
- */
-public void testExternalJarRemoved2() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f2 = new File(p2Path);
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- deleteFile(f);
- this.getJavaModel().refreshExternalArchives(new IJavaElement[]{project},null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[-]: {}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * Refresh an external jar after a removal of this jar.
- */
-public void testExternalJarRemoved3() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String pPath = getExternalPath()+"/p.jar";
- String p2Path = libPath+"/p2.jar";
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
-
- f = new File(pPath);
- File f2 = new File(p2Path);
-
- copy(f2, f);
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- deleteFile(f);
- IPackageFragmentRoot root = project.getPackageFragmentRoot(pPath);
- this.getJavaModel().refreshExternalArchives(new IJavaElement[]{root},null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " "+pPath+"[-]: {}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-/**
- * - add an internal jar to claspath
- * - remove internal jar and the same jar as external jar
- * - refresh the JavaModel
- */
-public void testExternalJarInternalExternalJar() throws CoreException {
- File f = null;
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- String libPath = getLibraryPath();
- String p1Path = libPath+"/p1.jar";
- String p2Path = libPath+"/p2.jar";
- File f1= new File(p1Path);
- File f2 = new File(p2Path);
-
- String internalFooPath = "/P/foo.jar";
- IFile fooIFile = this.createFile(internalFooPath, read(f1));
-
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(internalFooPath), null, null)});
- this.getJavaModel().refreshExternalArchives(null,null);
- this.startDeltas();
-
- IPath externalFooPath = fooIFile.getLocation();
- setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(externalFooPath, null, null)});
-
- f = new File(externalFooPath.toString());
- copy(f2, f);
-
- this.getJavaModel().refreshExternalArchives(null,null);
-
- String deltaPath = externalFooPath.toString();
- deltaPath = Character.toUpperCase(deltaPath.charAt(0)) + deltaPath.substring(1);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n"+
- " foo.jar[*]: {REMOVED FROM CLASSPATH}\n"+
- " "+deltaPath.replace('/', File.separatorChar)+"[*]: {ADDED TO CLASSPATH}\n"+
- " ResourceDelta(/P/.classpath)[*]\n"+
- "\n"+
- "P[*]: {CHILDREN}\n"+
- " "+deltaPath+"[*]: {CONTENT | ARCHIVE CONTENT CHANGED}"
- );
- } catch (IOException e) {
- } finally {
- if(f != null) {
- deleteFile(f);
- }
- this.deleteProject("P");
- this.stopDeltas();
- }
-}
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/FactoryTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/FactoryTests.java
deleted file mode 100644
index ffb8b45..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/FactoryTests.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jdt.core.*;
-import junit.framework.Test;
-public class FactoryTests extends ModifyingResourceTests {
-public FactoryTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- return new Suite(FactoryTests.class);
-}
-/**
- * Ensures that a Java model element can be created from a IFile that
- * is a class file.
- */
-public void testCreateBinaryToolObject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, new String[] {"lib"}, "bin");
- IFile file = this.createFile("/P/lib/X.class", "");
-
- IJavaElement object = JavaCore.create(file);
- assertTrue("tooling object not created", object != null);
- assertTrue("class file does not exist", object.exists());
- assertTrue("wrong object created", object instanceof IClassFile);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that a Java model element can be created from a IFile that
- * is a Java file. Ensures that any two model elements created will share
- * the same project.
- */
-public void testCreateCompilationUnits() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("/P/src/x/y/z");
- IFile fileA = this.createFile(
- "/P/src/x/y/z/A.java",
- "package x.y.z;\n" +
- "public class A {\n" +
- "}"
- );
- IFile fileB = this.createFile(
- "/P/src/x/y/B.java",
- "package x.y;\n" +
- "public class B {\n" +
- "}"
- );
-
- IJavaElement objectA = JavaCore.create(fileA);
- assertTrue("tooling object A not created", objectA != null);
- assertTrue("wrong object A created", objectA instanceof ICompilationUnit);
- assertTrue("compilation unit A does not exist", objectA.exists());
-
- IJavaElement objectB = JavaCore.create(fileB);
- assertTrue("tooling object B not created", objectB != null);
- assertTrue("wrong object B created", objectB instanceof ICompilationUnit);
- assertTrue("compilation unit B does not exist", objectB.exists());
-
- assertEquals("should share project", ((ICompilationUnit)objectA).getJavaProject(), ((ICompilationUnit)objectB).getJavaProject());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that a Java model element can be created from a IFile that
- * is a Java file. Even if not on the classpath (in this case it should not exist).
- */
-public void testCreateCompilationUnitsNotOnClasspath() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("/P/other/nested");
- IFile fileA = this.createFile("/P/other/A.java", "public class A {}");
- IFile fileB = this.createFile("/P/other/nested/B.java", "public class B {}");
- IFile fileC = this.createFile("/P/C.java", "public class C {}");
-
- IJavaElement objectA = JavaCore.create(fileA);
- assertTrue("tooling object A not created", objectA != null);
- assertTrue("wrong object A created", objectA instanceof ICompilationUnit);
- assertTrue("compilation unit A should not exist", !objectA.exists());
-
- IJavaElement objectB = JavaCore.create(fileB);
- assertTrue("tooling object B not created", objectB != null);
- assertTrue("wrong object B created", objectB instanceof ICompilationUnit);
- assertTrue("compilation unit B should not exist", !objectB.exists());
-
- assertEquals("should share project", ((ICompilationUnit)objectA).getJavaProject(), ((ICompilationUnit)objectB).getJavaProject());
-
- IJavaElement objectC = JavaCore.create(fileC);
- assertTrue("tooling object C not created", objectC != null);
- assertTrue("wrong object C created", objectC instanceof ICompilationUnit);
- assertTrue("compilation unit C should not exist", !objectC.exists());
-
- IPackageFragment pkg= (IPackageFragment)objectA.getParent() ;
- IPackageFragmentRoot root= (IPackageFragmentRoot)pkg.getParent();
- assertEquals("pkg should be default", "", pkg.getElementName());
- assertEquals("unexpected parent's folder", this.getFolder("/P/other"), pkg.getResource());
- assertEquals("unexpected root", this.getFolder("/P/other"), root.getResource());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that a Java model element can be created from a IFolder.
- * Test that no elements are created if there is no classpath.
- * Ensure that the correct Java model element is created based on the
- * classpath.
- */
-public void testCreateFolderToolObjects() throws CoreException {
- try {
- IJavaProject javaProject = this.createJavaProject("P", new String[] {}, "bin");
- this.createFolder("/P/src/x/y/z");
-
- IFolder src =this.getFolder("/P/src");
- IFolder res = src.getFolder("x");
- IJavaElement object = JavaCore.create(res);
- assertTrue("tooling object 1 should not be created", object == null);
-
- //set a classpath
- IClasspathEntry[] classpath= new IClasspathEntry[] {JavaCore.newSourceEntry(src.getFullPath())};
- javaProject.setRawClasspath(classpath, null);
-
- //test with a class path
- object = JavaCore.create(src);
- assertTrue("tooling object 2 should be created", object != null);
- assertTrue("tooling object 2 should be a IPackageFragmentRoot", object instanceof IPackageFragmentRoot);
- assertEquals("IPackageFragmentRoot 2 name is incorrect", "src", object.getElementName());
- assertTrue("root 'src' does not exist", object.exists());
-
- object = JavaCore.create(res);
- assertTrue("tooling object 3 should be created", object != null);
- assertTrue("tooling object 3 should be a IPackageFragment", object instanceof IPackageFragment);
- assertEquals("IPackageFragment 3 name is incorrect", "x", object.getElementName());
- assertTrue("package 'com' does not exist", object.exists());
-
- IFolder subFolder= ((IFolder)res).getFolder("y");
- object= JavaCore.create(subFolder);
- assertTrue("tooling object 'x.y' should be created", object != null);
- assertTrue("tooling object 'x.y' should be a IPackageFragment", object instanceof IPackageFragment);
- assertEquals("IPackageFragment 'x.y' name is incorrect", "x.y", object.getElementName());
- assertTrue("package 'x.y' does not exist", object.exists());
-
- //not on or below the class path
- IFolder bin = this.getFolder("/P/bin");
- object = JavaCore.create(bin);
- assertTrue("tooling object 4 should not be created", object == null);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that the factory correctly handles empty java files
- */
-public void testCreateFromEmptyJavaFile() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- IFile file = this.createFile("/P/src/X.java", "");
-
- IJavaElement cu = JavaCore.create(file);
- assertTrue("does not handle empty Java files", cu != null);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that the factory correctly handles files without extensions
- */
-public void testCreateFromFileWithoutExtension() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- IFile file = this.createFile("/P/src/FileWithoutExtension", "public class X {}");
-
- IJavaElement cu = JavaCore.create(file);
- assertTrue("invalid file not detected", cu == null);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that factory correctly handles invalid mementos.
- */
-public void testCreateFromInvalidMemento() throws JavaModelException {
- assertTrue("invalid parameter not detected", JavaCore.create((String) null) == null);
- assertTrue("should return the java model", JavaCore.create("") != null);
-}
-/**
- * Ensures that a Java model element can be created from a IFile
- * that is a zip or jar.
- */
-public void testCreateJarToolObject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, new String[] {"/P/lib.jar"}, "");
- IFile file = this.createFile("/P/lib.jar", "");
-
- IJavaElement jar = JavaCore.create(file);
- assertTrue("tooling object not created", jar != null);
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that a Java model element can be created from a class folder library that is in the project's output.
- * (regression test for bug 25538 Conflict of classfolder and outputfolder not reported)
-*/
-public void testCreateLibInOutput() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, new String[] {"/P/lib"}, "");
- IFolder folder = this.createFolder("/P/lib");
-
- IJavaElement lib = JavaCore.create(folder);
- assertTrue("tooling object not created", lib != null);
- } finally {
- this.deleteProject("P");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/HierarchyOnWorkingCopiesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/HierarchyOnWorkingCopiesTests.java
deleted file mode 100644
index eb0f7dc..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/HierarchyOnWorkingCopiesTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.IWorkingCopy;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class HierarchyOnWorkingCopiesTests extends WorkingCopyTests {
-
-public HierarchyOnWorkingCopiesTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- TestSuite suite = new Suite(HierarchyOnWorkingCopiesTests.class.getName());
-
- suite.addTest(new HierarchyOnWorkingCopiesTests("testSimpleSuperTypeHierarchy"));
- suite.addTest(new HierarchyOnWorkingCopiesTests("testSimpleSubTypeHierarchy"));
-
- return suite;
-}
-/**
- */
-public void testSimpleSubTypeHierarchy() throws CoreException {
- String newContents =
- "package x.y;\n" +
- "public class A extends B {\n" +
- "}";
- this.copy.getBuffer().setContents(newContents);
- this.copy.reconcile();
-
- IFile file = null;
- try {
- file = this.createFile(
- "P/src/x/y/B.java",
- "package x.y;\n" +
- "public class B {\n" +
- "}");
-
- IType type = this.getCompilationUnit("P/src/x/y/B.java").getType("B");
- ITypeHierarchy h = type.newTypeHierarchy(new IWorkingCopy[] {this.copy}, null);
-
- assertEquals(
- "Unexpected hierarchy",
- "Focus: x.y.B\n" +
- "Super types:\n" +
- " B [in B.java [in x.y [in src [in P]]]]\n" +
- " Object [in Object.class [in java.lang [in " + this.getExternalJCLPath() + " [in P]]]]\n" +
- "Sub types:\n" +
- " B [in B.java [in x.y [in src [in P]]]]\n" +
- " A [in [Working copy] A.java [in x.y [in src [in P]]]]\n",
- h.toString());
- } finally {
- if (file != null) {
- this.deleteResource(file);
- }
- }
-}
-/**
- */
-public void testSimpleSuperTypeHierarchy() throws CoreException {
- String newContents =
- "package x.y;\n" +
- "public class A {\n" +
- "}\n" +
- "class B {\n" +
- "}";
- this.copy.getBuffer().setContents(newContents);
- this.copy.reconcile();
-
- IFile file = null;
- try {
- file = this.createFile(
- "P/src/x/y/C.java",
- "package x.y;\n" +
- "public class C extends B {\n" +
- "}");
-
- IType type = this.getCompilationUnit("P/src/x/y/C.java").getType("C");
- ITypeHierarchy h = type.newSupertypeHierarchy(new IWorkingCopy[] {this.copy}, null);
-
- assertEquals(
- "Unexpected hierarchy",
- "Focus: x.y.C\n" +
- "Super types:\n" +
- " C [in C.java [in x.y [in src [in P]]]]\n" +
- " B [in [Working copy] A.java [in x.y [in src [in P]]]]\n" +
- " Object [in Object.class [in java.lang [in " + this.getExternalJCLPath() + " [in P]]]]\n" +
- "Sub types:\n" +
- " C [in C.java [in x.y [in src [in P]]]]\n",
- h.toString());
- } finally {
- if (file != null) {
- this.deleteResource(file);
- }
- }
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java
deleted file mode 100644
index 40f7eaa..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.jdt.core.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JavaConventionTests extends AbstractJavaModelTests {
-public JavaConventionTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- TestSuite suite = new Suite(JavaConventionTests.class.getName());
-
- suite.addTest(new JavaConventionTests("testInvalidImportDeclaration1"));
- suite.addTest(new JavaConventionTests("testInvalidImportDeclaration2"));
- suite.addTest(new JavaConventionTests("testInvalidImportDeclaration3"));
- suite.addTest(new JavaConventionTests("testPackageFragmentRootOverlap"));
- suite.addTest(new JavaConventionTests("testValidCompilationUnitName"));
- suite.addTest(new JavaConventionTests("testValidIdentifier"));
- suite.addTest(new JavaConventionTests("testInvalidIdentifier"));
- suite.addTest(new JavaConventionTests("testValidFieldName"));
- suite.addTest(new JavaConventionTests("testValidImportDeclaration"));
- suite.addTest(new JavaConventionTests("testValidMethodName"));
- suite.addTest(new JavaConventionTests("testValidPackageName"));
- suite.addTest(new JavaConventionTests("testValidTypeName"));
- suite.addTest(new JavaConventionTests("testValidUnicodeImportDeclaration"));
- suite.addTest(new JavaConventionTests("testValidUnicodePackageName"));
-
- return suite;
-}
-/**
- * @see JavaConventions
- */
-public void testInvalidIdentifier() {
- String[] invalidIds = new String[] {"", "1java", "Foo Bar", "#@$!", "Foo-Bar", "if", "InvalidEscapeSequence\\g", "true", "false", "null", null, " untrimmmed "};
- for (int i = 0; i < invalidIds.length; i++) {
- assertTrue("identifier not recognized as invalid: " + invalidIds[i], !JavaConventions.validateIdentifier(invalidIds[i]).isOK());
- }
-}
-/**
- * @see JavaNamingConventions
- */
-public void testInvalidImportDeclaration1() {
- assertTrue("import not reconized as invalid; java.math.", !JavaConventions.validateImportDeclaration("java.math.").isOK());
-}
-/**
- * @see JavaNamingConventions
- */
-public void testInvalidImportDeclaration2() {
- assertTrue("import not reconized as invalid; java.math*", !JavaConventions.validateImportDeclaration("java.math*").isOK());
-}
-/**
- * @see JavaNamingConventions
- */
-public void testInvalidImportDeclaration3() {
- assertTrue("import not reconized as invalid; empty string", !JavaConventions.validateImportDeclaration("").isOK());
-}
-/**
- * Test for package fragment root overlap
- * @deprecated isOverlappingRoots is deprecated
- */
-public void testPackageFragmentRootOverlap() throws Exception {
- try {
- IJavaProject project = this.createJavaProject("P1", new String[] {"src"}, new String[] {"/P1/jclMin.jar"}, "bin");
- this.copy(new java.io.File(getExternalJCLPathString()), new java.io.File(getWorkspaceRoot().getLocation().toOSString() + java.io.File.separator + "P1" + java.io.File.separator + "jclMin.jar"));
- project.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
-
- IPackageFragmentRoot p1Zip= getPackageFragmentRoot("P1", "jclMin.jar");
- IPackageFragmentRoot p1Src= getPackageFragmentRoot("P1", "src");
-
- assertTrue("zip should not overlap source root",
- !JavaConventions.isOverlappingRoots(p1Zip.getUnderlyingResource().getFullPath(), p1Src.getUnderlyingResource().getFullPath()));
-
- this.createJavaProject("P2", new String[] {"src"}, "bin");
-
- IPackageFragmentRoot p2Src= getPackageFragmentRoot("P2", "src");
- assertTrue("source roots in different projects should not overlap ",
- !JavaConventions.isOverlappingRoots(p1Src.getUnderlyingResource().getFullPath(), p2Src.getUnderlyingResource().getFullPath()));
-
- assertTrue("The same root should overlap", JavaConventions.isOverlappingRoots(p2Src.getUnderlyingResource().getFullPath(), p2Src.getUnderlyingResource().getFullPath()));
-
- assertTrue("isOverLappingRoot does not handle null arguments", !JavaConventions.isOverlappingRoots(p2Src.getUnderlyingResource().getFullPath(), null));
- assertTrue("isOverLappingRoot does not handle null arguments", !JavaConventions.isOverlappingRoots(null, null));
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/**
- * @see JavaConventions
- */
-public void testValidCompilationUnitName() {
- String[] invalidNames = new String[] {"java/lang/Object.java", "Object.class", ".java", "Object.javaaa", "A.B.java"};
- for (int i = 0; i < invalidNames.length; i++) {
- assertTrue("compilation unit name not recognized as invalid: " + invalidNames[i], !JavaConventions.validateCompilationUnitName(invalidNames[i]).isOK());
- }
- String[] validNames = new String[] {"Object.JaVa"};
- for (int i = 0; i < validNames.length; i++) {
- assertTrue("compilation unit name not recognized as valid: " + validNames[i], JavaConventions.validateCompilationUnitName(validNames[i]).isOK());
- }
-}
-/**
- * @see JavaNamingConventions
- */
-public void testValidFieldName() {
- assertTrue("unicode field name not handled", JavaConventions.validateFieldName("s\\u0069ze").isOK());
-}
-/**
- * @see JavaConventions
- */
-public void testValidIdentifier() {
- String[] validIds = new String[] {"s\\u0069ze", "Object", "An_Extremly_Long_Class_Name_With_Words_Separated_By_Undescores"};
- for (int i = 0; i < validIds.length; i++) {
- assertTrue("identifier not recognized as valid: " + validIds[i], JavaConventions.validateIdentifier(validIds[i]).isOK());
- }
-}
-/**
- * @see JavaConventions
- */
-public void testValidImportDeclaration() {
- assertTrue("import not reconized as valid", JavaConventions.validateImportDeclaration("java.math.*").isOK());
-}
-/**
- * @see JavaNamingConventions
- */
-public void testValidMethodName() {
- assertTrue("unicode method name not handled", JavaConventions.validateMethodName("getSiz\\u0065").isOK());
-}
-/**
- * @see JavaNamingConventions
- */
-public void testValidPackageName() {
-
- String pkgName= "org.eclipse.jdt.core.t\\u0065sts.MyPackage";
- assertTrue("unicode package name not handled", JavaConventions.validatePackageName(pkgName).isOK());
-
- assertTrue("package name not recognized as invalid1", !JavaConventions.validatePackageName("").isOK());
- assertTrue("package name not recognized as valid1", JavaConventions.validatePackageName("java . lang").isOK());
- assertTrue("package name not recognized as invalid2", !JavaConventions.validatePackageName(" java . lang").isOK());
- assertTrue("package name not recognized as invalid3", !JavaConventions.validatePackageName("java . lang ").isOK());
- assertTrue("package name not recognized as invalid4", !JavaConventions.validatePackageName(null).isOK());
- assertTrue("package name not recognized as unconventional1", JavaConventions.validatePackageName("Java.lang").getSeverity() == IStatus.WARNING);
- assertTrue("package name not recognized as valid2", JavaConventions.validatePackageName("java.Lang").isOK());
-}
-/**
- * @see JavaNamingConventions
- */
-public void testValidTypeName() {
- // regression tests for 1G5HVPB: ITPJCORE:WINNT - validateJavaTypeName accepts type names ending with \
- assertTrue("type name should not contain slashes (1)", JavaConventions.validateJavaTypeName("Object\\").getSeverity() == IStatus.ERROR);
- assertTrue("type name should not contain slashes (2)", JavaConventions.validateJavaTypeName("Object/").getSeverity() == IStatus.ERROR);
- assertTrue("type name should not contain slashes (3)", JavaConventions.validateJavaTypeName("\\Object").getSeverity() == IStatus.ERROR);
- assertTrue("type name should not contain slashes (4)", JavaConventions.validateJavaTypeName("java\\lang\\Object").getSeverity() == IStatus.ERROR);
-
- // regression test for 1G52ZIF: ITPJUI:WINNT - Wizards should strongly discourage the use of non-standard names
- assertTrue("discouraged type names not handled", JavaConventions.validateJavaTypeName("alowercasetypename").getSeverity() == IStatus.WARNING);
-
- // other tests
- assertTrue("unicode type name not handled", JavaConventions.validateJavaTypeName("P\\u0065a").getSeverity() == IStatus.OK);
- assertTrue("qualified type names not handled", JavaConventions.validateJavaTypeName("java . lang\t.Object").getSeverity() == IStatus.OK);
- assertTrue("simple qualified type names not handled", JavaConventions.validateJavaTypeName("java.lang.Object").getSeverity() == IStatus.OK);
- assertTrue("simple type names not handled", JavaConventions.validateJavaTypeName("Object").getSeverity() == IStatus.OK);
- assertTrue("discouraged type names not handled", JavaConventions.validateJavaTypeName("Object$SubType").getSeverity() == IStatus.WARNING);
- assertTrue("invalid type name not recognized", JavaConventions.validateJavaTypeName("==?==").getSeverity() == IStatus.ERROR);
-}
-/**
- * @see JavaNamingConventions
- */
-public void testValidUnicodeImportDeclaration() {
-
- String pkgName= "com.\\u0069bm.jdt.core.tests.MyPackag\\u0065";
- assertTrue("import not reconized as valid", JavaConventions.validateImportDeclaration(pkgName).isOK());
-
-}
-/**
- * @see JavaNamingConventions
- */
-public void testValidUnicodePackageName() {
-
- String pkgName= "com.\\u0069bm.jdt.core.tests.MyPackag\\u0065";
- assertTrue("unicode package name not handled", JavaConventions.validatePackageName(pkgName).isOK());
- assertTrue("Parameter modified", pkgName.equals("com.\\u0069bm.jdt.core.tests.MyPackag\\u0065"));
-
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
deleted file mode 100644
index fdadb3b..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
+++ /dev/null
@@ -1,2352 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IElementChangedListener;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IWorkingCopy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.core.DeltaProcessor;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.JavaProject;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * These test ensure that modifications in Java projects are correctly reported as
- * IJavaElementDeltas.
- */
-public class JavaElementDeltaTests extends ModifyingResourceTests {
-
- public class DeltaListener implements IElementChangedListener {
- ArrayList deltas;
- int eventType;
-
- public DeltaListener() {
- DeltaListener.this.deltas = new ArrayList();
- DeltaListener.this.eventType = -1;
- }
- public DeltaListener(int eventType) {
- DeltaListener.this.deltas = new ArrayList();
- DeltaListener.this.eventType = eventType;
- }
- public void elementChanged(ElementChangedEvent event) {
- if (DeltaListener.this.eventType == -1 || event.getType() == DeltaListener.this.eventType) {
- DeltaListener.this.deltas.add(event.getDelta());
- }
- }
- public void flush() {
- DeltaListener.this.deltas = new ArrayList();
- }
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = DeltaListener.this.deltas.size(); i < length; i++) {
- IJavaElementDelta delta = (IJavaElementDelta)this.deltas.get(i);
- IJavaElementDelta[] children = delta.getAffectedChildren();
- if (children.length > 0) {
- for (int j=0, childrenLength=children.length; j<childrenLength; j++) {
- buffer.append(children[j]);
- if (j != childrenLength-1) {
- buffer.append("\n");
- }
- }
- } else {
- buffer.append(delta);
- }
- if (i != length-1) {
- buffer.append("\n\n");
- }
- }
- return buffer.toString();
- }
- }
-
-
-
-public static Test suite() {
- TestSuite suite = new Suite(JavaElementDeltaTests.class.getName());
-
- // add/remove/open/close projects
- suite.addTest(new JavaElementDeltaTests("testAddJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testRemoveJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testRemoveAddJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testRemoveAddBinaryProject"));
- suite.addTest(new JavaElementDeltaTests("testAddJavaNature"));
- suite.addTest(new JavaElementDeltaTests("testRemoveJavaNature"));
- suite.addTest(new JavaElementDeltaTests("testOpenJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testCloseJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testAddTwoJavaProjects"));
- suite.addTest(new JavaElementDeltaTests("testAddTwoJavaProjectsWithExtraSetClasspath"));
- suite.addTest(new JavaElementDeltaTests("testDeleteProjectSetCPAnotherProject"));
-
- suite.addTest(new JavaElementDeltaTests("testRenameJavaProject"));
-
- // non-java projects
- suite.addTest(new JavaElementDeltaTests("testAddNonJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testRemoveNonJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testRemoveNonJavaProjectUpdateDependent1"));
- suite.addTest(new JavaElementDeltaTests("testRemoveNonJavaProjectUpdateDependent2"));
- suite.addTest(new JavaElementDeltaTests("testRemoveNonJavaProjectUpdateDependent3"));
- suite.addTest(new JavaElementDeltaTests("testOpenNonJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testCloseNonJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testCloseNonJavaProjectUpdateDependent"));
- suite.addTest(new JavaElementDeltaTests("testRenameNonJavaProject"));
-
- // package fragment roots
- suite.addTest(new JavaElementDeltaTests("testDeleteInnerJar"));
- suite.addTest(new JavaElementDeltaTests("testNestedRootParentMove"));
- suite.addTest(new JavaElementDeltaTests("testPackageFragmentRootRemoveAndAdd"));
-
- // packages
- suite.addTest(new JavaElementDeltaTests("testAddPackageSourceIsBin"));
- suite.addTest(new JavaElementDeltaTests("testRenameOuterPkgFragment"));
- suite.addTest(new JavaElementDeltaTests("testPackageFragmentAddAndRemove"));
- suite.addTest(new JavaElementDeltaTests("testPackageFragmentMove"));
-
- // compilation units
- suite.addTest(new JavaElementDeltaTests("testAddCuInDefaultPkg1"));
- suite.addTest(new JavaElementDeltaTests("testAddCuInDefaultPkg2"));
- suite.addTest(new JavaElementDeltaTests("testMoveCuInEnclosingPkg"));
- suite.addTest(new JavaElementDeltaTests("testCompilationUnitRemoveAndAdd"));
-
- // commit/save working copies
- suite.addTest(new JavaElementDeltaTests("testModifyMethodBodyAndSave"));
- suite.addTest(new JavaElementDeltaTests("testRenameMethodAndSave"));
- suite.addTest(new JavaElementDeltaTests("testSaveWorkingCopy"));
- suite.addTest(new JavaElementDeltaTests("testWorkingCopyCommit"));
- suite.addTest(new JavaElementDeltaTests("testAddCommentAndCommit"));
-
- // managed working copies
- suite.addTest(new JavaElementDeltaTests("testCreateWorkingCopy"));
- suite.addTest(new JavaElementDeltaTests("testDestroyWorkingCopy"));
- suite.addTest(new JavaElementDeltaTests("testCreateSharedWorkingCopy"));
- suite.addTest(new JavaElementDeltaTests("testDestroySharedWorkingCopy"));
-
- // non-java resources
- suite.addTest(new JavaElementDeltaTests("testMoveResInDotNamedFolder"));
- suite.addTest(new JavaElementDeltaTests("testMoveTwoResInRoot"));
- suite.addTest(new JavaElementDeltaTests("testMergeResourceDeltas"));
- suite.addTest(new JavaElementDeltaTests("testAddFileToNonJavaProject"));
- suite.addTest(new JavaElementDeltaTests("testDeleteNonJavaFolder"));
- suite.addTest(new JavaElementDeltaTests("testAddInvalidSubfolder"));
- suite.addTest(new JavaElementDeltaTests("testCUNotOnClasspath"));
- suite.addTest(new JavaElementDeltaTests("testNonJavaResourceRemoveAndAdd"));
-
- // listeners
- suite.addTest(new JavaElementDeltaTests("testListenerAutoBuild"));
- suite.addTest(new JavaElementDeltaTests("testListenerReconcile"));
- suite.addTest(new JavaElementDeltaTests("testListenerPostChange"));
-
- // classpath
- suite.addTest(new JavaElementDeltaTests("testSetClasspathVariable1"));
- suite.addTest(new JavaElementDeltaTests("testSetClasspathVariable2"));
- suite.addTest(new JavaElementDeltaTests("testChangeRootKind"));
- suite.addTest(new JavaElementDeltaTests("testOverwriteClasspath"));
- suite.addTest(new JavaElementDeltaTests("testRemoveCPEntryAndRoot1"));
- suite.addTest(new JavaElementDeltaTests("testRemoveCPEntryAndRoot2"));
- suite.addTest(new JavaElementDeltaTests("testRemoveCPEntryAndRoot3"));
- suite.addTest(new JavaElementDeltaTests("testAddDotClasspathFile"));
- suite.addTest(new JavaElementDeltaTests("testSetClasspathOnFreshProject"));
-
- // batch operations
- suite.addTest(new JavaElementDeltaTests("testBatchOperation"));
- suite.addTest(new JavaElementDeltaTests("testModifyProjectDescriptionAndRemoveFolder"));
-
- // build
- suite.addTest(new JavaElementDeltaTests("testBuildProjectUsedAsLib"));
-
- // output locations
- suite.addTest(new JavaElementDeltaTests("testModifyOutputLocation1"));
- suite.addTest(new JavaElementDeltaTests("testModifyOutputLocation2"));
- suite.addTest(new JavaElementDeltaTests("testModifyOutputLocation3"));
- suite.addTest(new JavaElementDeltaTests("testModifyOutputLocation4"));
- suite.addTest(new JavaElementDeltaTests("testChangeCustomOutput"));
-
- return suite;
-}
-
-public JavaElementDeltaTests(String name) {
- super(name);
-}
-/**
- * Ensures that adding a comment to a working copy and commiting it triggers an empty fine grained
- * delta with the kind set for PRE_AUTO_BUILD listeners.
- * (regression test for bug 32937 Kind not set for empty fine-grained delta)
- */
-public void testAddCommentAndCommit() throws CoreException {
- DeltaListener listener = new DeltaListener(ElementChangedEvent.PRE_AUTO_BUILD);
- ICompilationUnit copy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit unit = this.getCompilationUnit("P", "", "", "X.java");
- copy = (ICompilationUnit)unit.getWorkingCopy(null, null, null);
-
- // add comment to working copy
- copy.getBuffer().setContents(
- "public class X {\n" +
- " // some comment\n" +
- "}");
-
- // commit working copy
- JavaCore.addElementChangedListener(listener, ElementChangedEvent.PRE_AUTO_BUILD);
- copy.commit(true, null);
- assertEquals(
- "Unexpected delta after committing working copy",
- "X.java[*]: {CONTENT | FINE GRAINED}",
- listener.toString());
- } finally {
- JavaCore.removeElementChangedListener(listener);
- if (copy != null) copy.destroy();
- this.deleteProject("P");
- }
-}
-
-/*
- * Add cu in default package test (proj=src=bin).
- */
-public void testAddCuInDefaultPkg1() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.startDeltas();
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Add cu in default package test (proj!=src!=bin).
- */
-public void testAddCuInDefaultPkg2() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.startDeltas();
- this.createFile("P/src/X.java",
- "public class X {\n" +
- "}");
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Add the .classpath file to a Java project that was missing it.
- * (regression test for bug 26128 packages don't appear in package explorer view)
- */
-public void testAddDotClasspathFile() throws CoreException {
- try {
- this.createProject("P");
- this.createFolder("/P/src");
-
- // add Java nature
- this.editFile(
- "/P/.project",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<projectDescription>\n" +
- " <name>Test</name>\n" +
- " <comment></comment>\n" +
- " <projects>\n" +
- " </projects>\n" +
- " <buildSpec>\n" +
- " <buildCommand>\n" +
- " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
- " <arguments>\n" +
- " </arguments>\n" +
- " </buildCommand>\n" +
- " </buildSpec>\n" +
- " <natures>\n" +
- " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
- " </natures>\n" +
- "</projectDescription>"
- );
-
- this.startDeltas();
- this.createFile(
- "P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {REMOVED FROM CLASSPATH}\n" +
- " src[*]: {ADDED TO CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[+]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource delta is fired when a file is added to a non-java project.
- * (regression test for bug 18698 Seeing non-java projects in package view)
- */
-public void testAddFileToNonJavaProject() throws CoreException {
- try {
- this.createProject("P");
- this.startDeltas();
- this.createFile("/P/toto.txt", "");
- assertDeltas(
- "Unexpected delta",
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource delta is fired when a .name folder is added to a java project where prj=src.
- * (regression test for bug 31383 Strange rendering of of link resources when link points to Eclipse workspace)
- */
-public void testAddInvalidSubfolder() throws CoreException {
- try {
- this.createJavaProject("P");
- this.startDeltas();
- this.createFolder("/P/p/.folder");
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " p[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Add the java nature to an existing project.
- */
-public void testAddJavaNature() throws CoreException {
- try {
- this.createProject("P");
- this.startDeltas();
- this.addJavaNature("P");
- assertDeltas(
- "Unexpected delta",
- "P[+]: {}\n" +
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Add a java project.
- */
-public void testAddJavaProject() throws CoreException {
- try {
- this.startDeltas();
- this.createJavaProject("P", new String[] {""}, "");
- assertDeltas(
- "Unexpected delta",
- "P[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Add a non-java project.
- */
-public void testAddNonJavaProject() throws CoreException {
- try {
- this.startDeltas();
- this.createProject("P");
- assertDeltas(
- "Should get a non-Java resource delta",
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-public void testAddPackageSourceIsBin() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "src");
- this.startDeltas();
- this.createFolder("P/src/x");
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " x[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Add 2 java projects in an IWorkspaceRunnable.
- */
-public void testAddTwoJavaProjects() throws CoreException {
- try {
- this.startDeltas();
- ResourcesPlugin.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- createJavaProject("P1", new String[] {""}, "");
- createJavaProject("P2", new String[] {"src"}, "bin");
- }
- },
- null);
- assertEquals(
- "Unexpected delta",
- "P1[+]: {}\n" +
- "P2[+]: {}",
- this.getSortedByProjectDeltas());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-
-/*
- * Add 2 java projects in an IWorkspaceRunnable.
- */
-public void testAddTwoJavaProjectsWithExtraSetClasspath() throws CoreException {
- try {
- this.startDeltas();
- ResourcesPlugin.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IJavaProject p1 = createJavaProject("P1", new String[] {""}, "");
- // should be a no-op and no extra delta volley should be fired
- p1.setRawClasspath(p1.getRawClasspath(), p1.getOutputLocation(), null);
- createJavaProject("P2", new String[] {"src"}, "bin");
- }
- },
- null);
- assertEquals(
- "Unexpected delta",
- "P1[+]: {}\n" +
- "P2[+]: {}",
- this.getSortedByProjectDeltas());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Batch operation test.
- */
-public void testBatchOperation() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("P/src/x");
- this.createFile(
- "P/src/x/A.java",
- "package x;\n" +
- "public class A {\n" +
- "}");
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ICompilationUnit unit = getCompilationUnit("P/src/x/A.java");
- unit.createType("class B {}", null, false, monitor);
- unit.getType("A").createField("int i;", null, false, monitor);
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " x[*]: {CHILDREN}\n" +
- " A.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " B[+]: {}\n" +
- " A[*]: {CHILDREN | FINE GRAINED}\n" +
- " i[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that if a project's output folder is used as a lib folder in another project, building
- * the first project results in the correct delta in the other project.
- */
-public void testBuildProjectUsedAsLib() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src1"}, new String[] {"JCL_LIB"}, "bin1");
- this.createJavaProject("P2", new String[] {"src2"}, new String[] {"/P1/bin1"}, "bin2");
- this.createFile(
- "/P1/src1/X.java",
- "public class X {\n" +
- "}"
- );
-
- // force opening of project to avoid external jar delta
- p1.open(null);
-
- this.startDeltas();
-
- // full build
- p1.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
- assertDeltas(
- "Unexpected delta (1)",
- "P2[*]: {CHILDREN}\n" +
- " /P1/bin1[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.class[+]: {}"
- );
-
- this.editFile(
- "/P1/src1/X.java",
- "public class X {\n" +
- " void foo() {}\n" +
- "}\n" +
- "class Y {\n" +
- "}"
- );
- this.clearDeltas();
-
- // incremental buid
- p1.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
- assertDeltas(
- "Unexpected delta (2)",
- "P2[*]: {CHILDREN}\n" +
- " /P1/bin1[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.class[*]: {CONTENT}\n" +
- " Y.class[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-
-/**
- * Ensures that changing the custom output folder of a source entry
- * triggers a F_REMOVED_FROM_CLASSPATH and F_ADDED_TO_CLASSPATH delta.
- */
-public void testChangeCustomOutput() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin", new String[] {"bin1"});
- this.startDeltas();
- this.setClasspath(
- proj,
- new IClasspathEntry[] {
- JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], new Path("/P/bin2"))
- });
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that the setting the classpath with a library entry
- * triggers a F_REMOVED_FROM_CLASSPATH and F_ADDED_TO_CLASSPATH delta.
- */
-public void testChangeRootKind() throws CoreException {
- try {
- IJavaProject proj = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.startDeltas();
- this.setClasspath(
- proj,
- new IClasspathEntry[] {
- JavaCore.newLibraryEntry(new Path("/P/src"), null, null, false)
- });
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Close a java project.
- */
-public void testCloseJavaProject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- IProject project = this.getProject("P");
- this.startDeltas();
- project.close(null);
- assertDeltas(
- "Unexpected delta",
- "P[-]: {}\n" +
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Close a non-java project.
- */
-public void testCloseNonJavaProject() throws CoreException {
- try {
- this.createProject("P");
- IProject project = this.getProject("P");
- this.startDeltas();
- project.close(null);
- assertDeltas(
- "Unexpected delta",
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Closing a non-java project that contains a jar referenced in another project should produce
- * a delta on this other project.
- * (regression test for bug 19058 Closing non-java project doesn't remove root from java project)
- */
-public void testCloseNonJavaProjectUpdateDependent() throws CoreException {
- try {
- this.createProject("SP");
- this.createFile("/SP/x.jar", "");
- this.createJavaProject("JP", new String[] {""}, new String[] {"/SP/x.jar"}, "");
- IProject project = this.getProject("SP");
- this.startDeltas();
- project.close(null);
- assertDeltas(
- "Unexpected delta",
- "JP[*]: {CHILDREN}\n" +
- " /SP/x.jar[-]: {}\n" +
- "ResourceDelta(/SP)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("SP");
- this.deleteProject("JP");
- }
-}
-/**
- * Test that deltas are generated when a compilation unit is added
- * and removed from a package via core API.
- */
-public void testCompilationUnitRemoveAndAdd() throws CoreException {
- try {
- createJavaProject("P");
- createFolder("/P/p");
- IFile file = createFile(
- "/P/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
-
- // delete cu
- startDeltas();
- deleteResource(file);
- assertDeltas(
- "Unexpected delta after deleting /P/p/X.java",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " p[*]: {CHILDREN}\n" +
- " X.java[-]: {}"
- );
-
- // add cu
- clearDeltas();
- createFile(
- "/P/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- assertDeltas(
- "Unexpected delta after adding /P/p/X.java",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " p[*]: {CHILDREN}\n" +
- " X.java[+]: {}"
- );
- } finally {
- stopDeltas();
- deleteProject("P");
- }
-}
-
-public void testCreateSharedWorkingCopy() throws CoreException {
- IWorkingCopy copy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit unit = this.getCompilationUnit("P", "", "", "X.java");
- this.startDeltas();
- copy = (IWorkingCopy)unit.getSharedWorkingCopy(null, null, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[+]: {}"
- );
- } finally {
- this.stopDeltas();
- if (copy != null) copy.destroy();
- this.deleteProject("P");
- }
-}
-public void testCreateWorkingCopy() throws CoreException {
- IWorkingCopy copy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit unit = this.getCompilationUnit("P", "", "", "X.java");
- this.startDeltas();
- copy = (IWorkingCopy)unit.getWorkingCopy();
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[+]: {}"
- );
- } finally {
- this.stopDeltas();
- if (copy != null) copy.destroy();
- this.deleteProject("P");
- }
-}
-/**
- * Test that deltas are generated when a compilation unit not on the classpath is added
- * and removed from a package via core API.
- */
-public void testCUNotOnClasspath() throws CoreException {
- try {
- createJavaProject("P", new String[] {}, "bin");
- createFolder("/P/src/p");
- IFile file = createFile(
- "/P/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
-
- startDeltas();
- deleteResource(file);
- assertDeltas(
- "Unexpected delta after deletion of /P/src/p/X.java",
- "P[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src)[*]"
- );
-
- clearDeltas();
- createFile(
- "/P/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- assertDeltas(
- "Unexpected delta after addition of /P/src/p/X.java",
- "P[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src)[*]"
- );
- } finally {
- stopDeltas();
- deleteProject("P");
- }
-}
-/*
- * Ensure that deleting a jar that is in a folder and that is on the classpath reports
- * a removed pkg fragment root delta.
- * (regression test for bug 27068 Elements in the Package Explorer are displayed but don't more exist [package explorer])
- *
- */
-public void testDeleteInnerJar() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, new String[] {"/P/lib/x.jar"}, "bin");
- this.createFolder("/P/lib");
- IFile file = this.createFile("/P/lib/x.jar", "");
- this.startDeltas();
- deleteResource(file);
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN | CONTENT}\n" +
- " lib/x.jar[-]: {}\n" +
- " ResourceDelta(/P/lib)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that deleting a non-Java folder that contains a source root folder reports
- * a removed root delta as well as a resource delta for the removed folder.
- * (regression test for bug 24045 Error deleting parent folder of source folder)
- */
-public void testDeleteNonJavaFolder() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"foo/bar"}, "bin");
- IFolder folder = this.getFolder("/P/foo");
- this.startDeltas();
- deleteResource(folder);
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN | CONTENT}\n" +
- " foo/bar[-]: {}\n" +
- " ResourceDelta(/P/foo)[-]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that deleting a project and setting the classpath on another project
- * in an IWorkspaceRunnable doesn't throw a NullPointerException
- * (regression test for bug 25197 NPE importing external plugins)
- */
-public void testDeleteProjectSetCPAnotherProject() throws CoreException {
- final IJavaProject project = this.createJavaProject("P1", new String[] {"src"}, "bin");
- this.createJavaProject("P2", new String[] {}, "");
-
- try {
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- deleteProject("P2");
- project.setRawClasspath(
- new IClasspathEntry[] {
- JavaCore.newSourceEntry(project.getPath())
- },
- null);
- }
- },
- null);
- assertDeltas(
- "Unexpected deltas",
- "P1[*]: {CHILDREN}\n" +
- " src[*]: {REMOVED FROM CLASSPATH}\n" +
- " [project root][*]: {ADDED TO CLASSPATH}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[-]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-public void testDestroySharedWorkingCopy() throws CoreException {
- IWorkingCopy copy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit unit = this.getCompilationUnit("P", "", "", "X.java");
- copy = (IWorkingCopy)unit.getSharedWorkingCopy(null, null, null);
- this.startDeltas();
- copy.destroy();
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[-]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-public void testDestroyWorkingCopy() throws CoreException {
- IWorkingCopy copy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit unit = this.getCompilationUnit("P", "", "", "X.java");
- copy = (IWorkingCopy)unit.getWorkingCopy();
- this.startDeltas();
- copy.destroy();
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[-]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that a delta listener that asks for PRE_AUTO_BUILD events gets those events
- * and no others.
- */
-public void testListenerAutoBuild() throws CoreException {
- DeltaListener listener = new DeltaListener(ElementChangedEvent.PRE_AUTO_BUILD);
- ICompilationUnit wc = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- JavaCore.addElementChangedListener(listener, ElementChangedEvent.PRE_AUTO_BUILD);
-
- // cu creation
- IPackageFragment pkg = this.getPackage("P");
- ICompilationUnit cu = pkg.createCompilationUnit(
- "X.java",
- "public class X {\n" +
- "}",
- false,
- null);
- assertEquals(
- "Unexpected delta after creating CU",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}",
- listener.toString());
- listener.flush();
-
- // type creation
- cu.createType(
- "class A {\n" +
- "}",
- cu.getType("X"),
- false,
- null);
- assertEquals(
- "Unexpected delta after creating type",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " A[+]: {}",
- listener.toString());
- listener.flush();
-
- // non-java resource creation
- this.createFile("P/readme.txt", "");
- assertEquals(
- "Unexpected delta after creating non-java resource",
- "",
- listener.toString());
- listener.flush();
-
- // shared working copy creation
- wc = (ICompilationUnit)cu.getSharedWorkingCopy(null, null, null);
- assertEquals(
- "Unexpected delta after creating shared working copy",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[+]: {}",
- listener.toString());
- listener.flush();
-
- // reconcile
- wc.getBuffer().setContents(
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- wc.reconcile();
- assertEquals(
- "Unexpected delta after reconciling working copy",
- "",
- listener.toString());
- listener.flush();
-
- // commit
- wc.commit(false, null);
- assertEquals(
- "Unexpected delta after committing working copy",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}\n" +
- "A[-]: {}",
- listener.toString());
- listener.flush();
-
- // shared working copy destruction
- wc.destroy();
- assertEquals(
- "Unexpected delta after destroying shared working copy",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[-]: {}",
- listener.toString());
- listener.flush();
- wc = null;
-
-
- } finally {
- if (wc != null) wc.destroy();
- JavaCore.removeElementChangedListener(listener);
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that a delta listener that asks for POST_CHANGE events gets those events
- * and no others.
- */
-public void testListenerPostChange() throws CoreException {
- DeltaListener listener = new DeltaListener(ElementChangedEvent.POST_CHANGE);
- ICompilationUnit wc = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- JavaCore.addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE);
-
- // cu creation
- IPackageFragment pkg = this.getPackage("P");
- ICompilationUnit cu = pkg.createCompilationUnit(
- "X.java",
- "public class X {\n" +
- "}",
- false,
- null);
- assertEquals(
- "Unexpected delta after creating CU",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}",
- listener.toString());
- listener.flush();
-
- // type creation
- cu.createType(
- "class A {\n" +
- "}",
- cu.getType("X"),
- false,
- null);
- assertEquals(
- "Unexpected delta after creating type",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " A[+]: {}",
- listener.toString());
- listener.flush();
-
- // non-java resource creation
- this.createFile("P/readme.txt", "");
- assertEquals(
- "Unexpected delta after creating non-java resource",
- "P[*]: {CONTENT}\n" +
- " ResourceDelta(/P/readme.txt)[+]",
- listener.toString());
- listener.flush();
-
- // shared working copy creation
- wc = (ICompilationUnit)cu.getSharedWorkingCopy(null, null, null);
- assertEquals(
- "Unexpected delta after creating shared working copy",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[+]: {}",
- listener.toString());
- listener.flush();
-
- // reconcile
- wc.getBuffer().setContents(
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- wc.reconcile();
- assertEquals(
- "Unexpected delta after reconciling working copy",
- "",
- listener.toString());
- listener.flush();
-
- // commit
- wc.commit(false, null);
- assertEquals(
- "Unexpected delta after committing working copy",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}\n" +
- " A[-]: {}",
- listener.toString());
- listener.flush();
-
- // shared working copy destruction
- wc.destroy();
- assertEquals(
- "Unexpected delta after destroying shared working copy",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " [Working copy] X.java[-]: {}",
- listener.toString());
- listener.flush();
- wc = null;
-
-
- } finally {
- if (wc != null) wc.destroy();
- JavaCore.removeElementChangedListener(listener);
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that a delta listener that asks for POST_RECONCILE events gets those events
- * and no others.
- */
-public void testListenerReconcile() throws CoreException {
- DeltaListener listener = new DeltaListener(ElementChangedEvent.POST_RECONCILE);
- ICompilationUnit wc = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- JavaCore.addElementChangedListener(listener, ElementChangedEvent.POST_RECONCILE);
-
- // cu creation
- IPackageFragment pkg = this.getPackage("P");
- ICompilationUnit cu = pkg.createCompilationUnit(
- "X.java",
- "public class X {\n" +
- "}",
- false,
- null);
- assertEquals(
- "Unexpected delta after creating CU",
- "",
- listener.toString());
- listener.flush();
-
- // type creation
- cu.createType(
- "class A {\n" +
- "}",
- cu.getType("X"),
- false,
- null);
- assertEquals(
- "Unexpected delta after creating type",
- "",
- listener.toString());
- listener.flush();
-
- // non-java resource creation
- this.createFile("P/readme.txt", "");
- assertEquals(
- "Unexpected delta after creating non-java resource",
- "",
- listener.toString());
- listener.flush();
-
- // shared working copy creation
- wc = (ICompilationUnit)cu.getSharedWorkingCopy(null, null, null);
- assertEquals(
- "Unexpected delta after creating shared working copy",
- "",
- listener.toString());
- listener.flush();
-
- // reconcile
- wc.getBuffer().setContents(
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- wc.reconcile();
- assertEquals(
- "Unexpected delta after reconciling working copy",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}\n" +
- "A[-]: {}",
- listener.toString());
- listener.flush();
-
- // commit
- wc.commit(false, null);
- assertEquals(
- "Unexpected delta after committing working copy",
- "",
- listener.toString());
- listener.flush();
-
- // shared working copy destruction
- wc.destroy();
- assertEquals(
- "Unexpected delta after destroying shared working copy",
- "",
- listener.toString());
- listener.flush();
- wc = null;
-
-
- } finally {
- if (wc != null) wc.destroy();
- JavaCore.removeElementChangedListener(listener);
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that merging a java delta with another one that contains a resource delta
- * results in a java delta with the resource delta.
- * (regression test for 11210 ResourceDeltas are lost when merging deltas)
- */
-public void testMergeResourceDeltas() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.startDeltas();
- ResourcesPlugin.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // an operation that creates a java delta without firing it
- IPackageFragment pkg = getPackageFragment("P", "", "");
- pkg.createCompilationUnit(
- "X.java",
- "public class X {\n" +
- "}",
- true,
- null);
-
- // an operation that generates a non java resource delta
- createFile("P/Y.txt", "");
- }
- },
- null
- );
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}\n" +
- " ResourceDelta(/P/Y.txt)[+]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-
-
-}
-public void testModifyMethodBodyAndSave() throws CoreException {
- ICompilationUnit workingCopy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/x/y");
- this.createFile("P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- ICompilationUnit cu = this.getCompilationUnit("P/x/y/A.java");
- workingCopy = (ICompilationUnit)cu.getWorkingCopy();
- workingCopy.getBuffer().setContents(
- "package x.y;\n" +
- "public class A {\n" +
- " public void foo() {\n" +
- " // method body change \n" +
- " }\n" +
- "}");
-
- this.startDeltas();
- workingCopy.commit(true, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " x.y[*]: {CHILDREN}\n" +
- " A.java[*]: {CONTENT | FINE GRAINED}"
- );
- } finally {
- this.stopDeltas();
- if (workingCopy != null) {
- workingCopy.destroy();
- }
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that modifying the project output location (i.e. simulate a build) doesn't report any delta.
- */
-public void testModifyOutputLocation1() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
-
- this.startDeltas();
- this.createFile("/P/bin/X.class", "");
- assertDeltas(
- "Unexpected delta",
- ""
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that modifying a custom output location (i.e. simulate a build) doesn't report any delta.
- * (regression test for bug 27494 Source folder output folder shown in Package explorer)
- */
-public void testModifyOutputLocation2() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin1", new String[] {"bin2"});
-
- this.startDeltas();
- this.createFile("/P/bin2/X.class", "");
- assertDeltas(
- "Unexpected delta",
- ""
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that modifying a custom output location (i.e. simulate a build) doesn't report any delta.
- * (regression test for bug 27494 Source folder output folder shown in Package explorer)
- */
-public void testModifyOutputLocation3() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src1", "src2"}, "bin", new String[] {"src1", null});
-
- this.startDeltas();
- this.createFile("/P/bin/X.class", "");
- assertDeltas(
- "Unexpected delta",
- ""
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that modifying a custom output location (i.e. simulate a build) doesn't report any delta.
- * (regression test for bug 32629 DeltaProcessor walking some binary output)
- */
-public void testModifyOutputLocation4() throws CoreException {
- try {
- this.createJavaProject("P");
- this.editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry excluding=\"src/\" kind=\"src\" output=\"bin1\" path=\"\"/>\n" +
- " <classpathentry kind=\"src\" output=\"bin2\" path=\"src\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- this.createFolder("/P/bin2");
-
- this.startDeltas();
- this.createFile("/P/bin2/X.class", "");
- assertDeltas(
- "Unexpected delta",
- ""
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * bug 18953
- */
-public void testModifyProjectDescriptionAndRemoveFolder() throws CoreException {
- try {
- IJavaProject project = createJavaProject("P");
- final IProject projectFolder = project.getProject();
- final IFolder folder = createFolder("/P/folder");
-
- startDeltas();
- getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IProjectDescription desc = projectFolder.getDescription();
- desc.setComment("A comment");
- projectFolder.setDescription(desc, null);
- deleteResource(folder);
- }
- },
- null);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN | CONTENT}\n"+
- " [project root][*]: {CHILDREN}\n"+
- " folder[-]: {}\n"+
- " ResourceDelta(/P/.project)[*]"
- );
- } finally {
- stopDeltas();
- deleteProject("P");
- }
-}
-/*
- * Move a cu from a package to its enclosing package.
- * (regression test for bug 7033 Stale packages view after moving compilation units)
- */
-public void testMoveCuInEnclosingPkg() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/x/y");
- this.createFile("P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}");
- ICompilationUnit cu = this.getCompilationUnit("P/x/y/A.java");
- IPackageFragment pkg = this.getPackage("P/x");
-
- this.startDeltas();
- cu.move(pkg, null, null, true, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " x.y[*]: {CHILDREN}\n" +
- " A.java[-]: {MOVED_TO(A.java [in x [in [project root] [in P]]])}\n" +
- " x[*]: {CHILDREN}\n" +
- " A.java[+]: {MOVED_FROM(A.java [in x.y [in [project root] [in P]]])}"
- );
- assertEquals(
- "Unexpected children for package x",
- "x\n" +
- " A.java\n" +
- " package x\n" +
- " class A",
- this.expandAll(pkg));
- assertEquals(
- "Unexpected children for package x.y",
- "x.y",
- this.expandAll(this.getPackage("P/x/y")));
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Move a non-java resources that is under a dot-named folder.
- * (regression test for bug 6687 Wrong JavaModel refresh after drag and drop outside folder with dot in name)
- */
-public void testMoveResInDotNamedFolder() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, "");
- IProject project = this.getProject("P");
- this.createFolder("P/x.y");
- IFile file = this.createFile("P/x.y/test.txt", "");
-
- this.startDeltas();
- file.move(project.getFullPath().append("test.txt"), true, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CONTENT}\n" +
- " ResourceDelta(/P/test.txt)[+]\n" +
- " ResourceDelta(/P/x.y)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Move 2 non-java resources that were outside classpath to a package fragment root.
- * (regression test for bug 28583 Missing one unit in package view)
- */
-public void testMoveTwoResInRoot() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- final IFile f1 = this.createFile("P/X.java", "public class X {}");
- final IFile f2 = this.createFile("P/Y.java", "public class Y {}");
-
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- f1.move(new Path("/P/src/X.java"), true, null);
- f2.move(new Path("/P/src/Y.java"), true, null);
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN | CONTENT}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[+]: {}\n" +
- " Y.java[+]: {}\n" +
- " ResourceDelta(/P/X.java)[-]\n" +
- " ResourceDelta(/P/Y.java)[-]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Test that deltas are generated when a nested package fragment root is removed
- * and added via core API.
- */
-public void testNestedRootParentMove() throws CoreException {
- try {
- createJavaProject("P", new String[] {"nested2/src", "nested/src"}, "bin");
- deleteFolder("/P/nested2/src");
-
- startDeltas();
- IFolder folder = getFolder("/P/nested/src");
- folder.move(new Path("/P/nested2/src"), false, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN | CONTENT}\n" +
- " nested/src[-]: {MOVED_TO(nested2/src [in P])}\n" +
- " nested2/src[+]: {MOVED_FROM(nested/src [in P])}\n" +
- " ResourceDelta(/P/nested)[*]\n" +
- " ResourceDelta(/P/nested2)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Test that deltas are generated when a non-java file is
- * removed and added
- */
-public void testNonJavaResourceRemoveAndAdd() throws CoreException {
- try {
- createJavaProject("P", new String[] {"src"}, "bin");
- IFile file = createFile("/P/src/read.txt", "");
-
- startDeltas();
- deleteResource(file);
- assertDeltas(
- "Unexpected delta after deleting /P/src/read.txt",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/read.txt)[-]"
- );
-
- clearDeltas();
- createFile("/P/src/read.txt", "");
- assertDeltas(
- "Unexpected delta after creating /P/src/read.txt",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
- " ResourceDelta(/P/src/read.txt)[+]"
- );
-
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-
-/*
- * Open a java project.
- */
-public void testOpenJavaProject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- IProject project = this.getProject("P");
- project.close(null);
- this.startDeltas();
- project.open(null);
- assertDeltas(
- "Unexpected delta",
- "P[+]: {}\n" +
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-/*
- * Open a non-java project.
- */
-public void testOpenNonJavaProject() throws CoreException {
- try {
- this.createProject("P");
- IProject project = this.getProject("P");
- project.close(null);
- this.startDeltas();
- project.open(null);
- assertDeltas(
- "Unexpected delta",
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that .classpath overwrite is taken into account.
- * (regression test for bug 21420 Changing .classpath doesn't update JDT)
- */
-public void testOverwriteClasspath() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/src");
- this.createFolder("P/bin");
- final IFile newCP = this.createFile(
- "P/.classpath2",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" path=\"src\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>");
- this.startDeltas();
- IWorkspaceRunnable run = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IFile oldCP = newCP.getParent().getFile(new Path(".classpath"));
- deleteResource(oldCP);
- newCP.move(new Path("/P/.classpath"), true, null);
- }
- };
- this.getWorkspace().run(run, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {REMOVED FROM CLASSPATH}\n" +
- " src[*]: {ADDED TO CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]\n" +
- " ResourceDelta(/P/.classpath2)[-]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Test that deltas are generated when package fragments are added
- * and removed from a root via core API.
- */
-public void testPackageFragmentAddAndRemove() throws CoreException {
- try {
- createJavaProject("P", new String[] {"src"}, "bin");
-
- startDeltas();
- IFolder folder = createFolder("/P/src/p");
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[+]: {}"
- );
-
- clearDeltas();
- deleteResource(folder);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[-]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Test that deltas are generated when a package fragment is moved
- * via core API.
- */
-public void testPackageFragmentMove() throws CoreException {
- try {
- createJavaProject("P", new String[] {"src"}, "bin");
- IFolder folder = createFolder("/P/src/p");
-
- startDeltas();
- folder.move(new Path("/P/src/p2"), false, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[-]: {MOVED_TO(p2 [in src [in P]])}\n" +
- " p2[+]: {MOVED_FROM(p [in src [in P]])}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Test that deltas are generated when a package fragment root is removed
- * and added via core API.
- */
-public void testPackageFragmentRootRemoveAndAdd() throws CoreException {
- try {
- createJavaProject("P", new String[] {"src"}, "bin");
-
- startDeltas();
- deleteFolder("/P/src");
- assertDeltas(
- "Unexpected delta after deleting /P/src",
- "P[*]: {CHILDREN}\n" +
- " src[-]: {}"
- );
-
- clearDeltas();
- createFolder("/P/src");
- assertDeltas(
- "Unexpected delta after creating /P/src",
- "P[*]: {CHILDREN}\n" +
- " src[+]: {}"
- );
- } finally {
- stopDeltas();
- deleteProject("P");
- }
-}
-/*
- * Remove then add a binary project (in a workspace runnable).
- * (regression test for 24775 Wrong delta when replacing binary project with source project)
- */
-public void testRemoveAddBinaryProject() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/lib.jar", "");
- project.setRawClasspath(
- new IClasspathEntry[] {
- JavaCore.newLibraryEntry(new Path("/P/lib.jar"), null, null)
- },
- null
- );
-
- this.startDeltas();
- getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- deleteProject("P");
- createJavaProject("P", new String[] {""}, "");
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " lib.jar[-]: {}\n" +
- " [project root][*]: {ADDED TO CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]\n" +
- " ResourceDelta(/P/.project)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Remove then add a java project (in a workspace runnable).
- */
-public void testRemoveAddJavaProject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.startDeltas();
- getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- deleteProject("P");
- createJavaProject("P", new String[] {""}, "");
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CONTENT}\n" +
- " ResourceDelta(/P/.classpath)[*]\n" +
- " ResourceDelta(/P/.project)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Change the .classpath file so as to remove a classpath entry and remove the corresponding resource.
- * (regression test for bug 24517 type view does not notice when jar disappears)
-
- */
-public void testRemoveCPEntryAndRoot1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
-
- // ensure that the project is open (there are clients of the delta only if the project is open)
- project.open(null);
-
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>");
- deleteFolder("/P/src");
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[-]: {}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Remove a classpath entry and remove the corresponding resource.
- * (regression test for bug 24517 type view does not notice when jar disappears)
-
- */
-public void testRemoveCPEntryAndRoot2() throws CoreException {
- try {
- final IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
-
- // ensure that the project is open (there are clients of the delta only if the project is open)
- project.open(null);
-
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.setRawClasspath(new IClasspathEntry[] {}, null);
- deleteFolder("/P/src");
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[-]: {}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Remove the resource of a classpath entry and remove the classpath entry.
- * (regression test for bug 24517 type view does not notice when jar disappears)
-
- */
-public void testRemoveCPEntryAndRoot3() throws CoreException {
- try {
- final IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
-
- // ensure that the project is open (there are clients of the delta only if the project is open)
- project.open(null);
-
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- deleteFolder("/P/src");
- project.setRawClasspath(new IClasspathEntry[] {}, null);
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[-]: {}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-
-
-/*
- * Remove the java nature of an existing java project.
- */
-public void testRemoveJavaNature() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.startDeltas();
- this.removeJavaNature("P");
- assertDeltas(
- "Unexpected delta",
- "P[-]: {}\n" +
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-public void testRemoveJavaProject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.startDeltas();
- this.deleteProject("P");
- assertDeltas(
- "Unexpected delta",
- "P[-]: {}"
- );
- } finally {
- this.stopDeltas();
- }
-}
-/*
- * Remove a non-java project.
- */
-public void testRemoveNonJavaProject() throws CoreException {
- try {
- this.createProject("P");
- this.startDeltas();
- this.deleteProject("P");
- assertDeltas(
- "Should get a non-Java resource delta",
- "ResourceDelta(/P)"
- );
- } finally {
- this.stopDeltas();
- }
-}
-/*
- * Removing a non-java project that contains a jar referenced in another project should produce
- * a delta on this other project.
- * (regression test for bug 19058 Closing non-java project doesn't remove root from java project)
- */
-public void testRemoveNonJavaProjectUpdateDependent1() throws CoreException {
- try {
- this.createProject("SP");
- this.createFile("/SP/x.jar", "");
- this.createJavaProject("JP", new String[] {""}, new String[] {"/SP/x.jar"}, "");
- this.startDeltas();
- this.deleteProject("SP");
- assertDeltas(
- "Unexpected delta",
- "JP[*]: {CHILDREN}\n" +
- " /SP/x.jar[-]: {}\n" +
- "ResourceDelta(/SP)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("SP");
- this.deleteProject("JP");
- }
-}
-/*
- * Removing a non-java project and another project reference a non exiting folder in the deleted project
- * should not produce a delta on this other project (and no null pointer exception)
- * (regression test for bug 19131 NPE when removing a project containing missing classfile folder)
- */
-public void testRemoveNonJavaProjectUpdateDependent2() throws CoreException {
- try {
- this.createProject("SP");
- this.createJavaProject("JP", new String[] {""}, new String[] {"/SP/missing"}, "");
- this.startDeltas();
- this.deleteProject("SP");
- assertDeltas(
- "Unexpected delta",
- "ResourceDelta(/SP)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("SP");
- this.deleteProject("JP");
- }
-}
-/*
- * Removing a non-java project that contains a jar referenced in another project should produce
- * a delta on this other project. Case of the removal being done right after start-up.
- * (regression test for bug 31377 NullPointerException on binary import)
- */
-public void testRemoveNonJavaProjectUpdateDependent3() throws CoreException {
- try {
- this.createProject("SP");
- this.createFile("/SP/x.jar", "");
- this.createJavaProject("JP", new String[] {""}, new String[] {"/SP/x.jar"}, "");
-
- // simulate start-up state of DeltaProcessor
- DeltaProcessor deltaProcessor = JavaModelManager.getJavaModelManager().deltaProcessor;
- deltaProcessor.oldRoots = null;
- deltaProcessor.roots = null;
- deltaProcessor.rootsAreStale = true;
-
- this.startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- deleteProject("SP");
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "JP[*]: {CHILDREN}\n" +
- " /SP/x.jar[-]: {}\n" +
- "ResourceDelta(/SP)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("SP");
- this.deleteProject("JP");
- }
-}
-/*
- * Rename a java project.
- * (regression test for bug 7030 IllegalArgumentException renaming project)
- */
-public void testRenameJavaProject() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.startDeltas();
- this.renameProject("P", "P1");
- assertDeltas(
- "Unexpected delta",
- "P[-]: {MOVED_TO(P1)}\n" +
- "P1[+]: {MOVED_FROM(P)}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- this.deleteProject("P1");
- }
-}
-public void testRenameMethodAndSave() throws CoreException {
- ICompilationUnit workingCopy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/x/y");
- this.createFile("P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- " public void foo1() {\n" +
- " }\n" +
- "}");
- ICompilationUnit cu = this.getCompilationUnit("P/x/y/A.java");
- workingCopy = (ICompilationUnit)cu.getWorkingCopy();
- workingCopy.getBuffer().setContents(
- "package x.y;\n" +
- "public class A {\n" +
- " public void foo2() {\n" +
- " }\n" +
- "}");
-
- this.startDeltas();
- workingCopy.commit(true, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " x.y[*]: {CHILDREN}\n" +
- " A.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " A[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo2[+]: {}\n" +
- " foo1[-]: {}"
- );
- } finally {
- this.stopDeltas();
- if (workingCopy != null) {
- workingCopy.destroy();
- }
- this.deleteProject("P");
- }
-}
-/*
- * Rename a non-java project.
- * (regression test for bug 30224 No JavaElement delta when renaming non-Java project)
- */
-public void testRenameNonJavaProject() throws CoreException {
- try {
- this.createProject("P");
- this.startDeltas();
- this.renameProject("P", "P1");
- assertDeltas(
- "Unexpected delta",
- "ResourceDelta(/P)\n" +
- "ResourceDelta(/P1)"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- this.deleteProject("P1");
- }
-}
-/*
- * Rename an outer pkg fragment.
- * (regression test for bug 24685 Inner package fragments gets deleted - model out of synch)
- */
-public void testRenameOuterPkgFragment() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/x/y");
- this.createFile(
- "P/x/y/X.java",
- "package x.y;\n" +
- "public class X {\n" +
- "}");
- this.startDeltas();
- IPackageFragment pkg = getPackageFragment("P", "", "x");
- pkg.rename("z", false, null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " z[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/**
- * Ensures that saving a working copy doesn't change the underlying resource.
- * (only commit should do so)
- */
-public void testSaveWorkingCopy() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFile("P/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit unit = this.getCompilationUnit("P", "", "", "X.java");
- copy = (ICompilationUnit)unit.getWorkingCopy(null, null, null);
- copy.getType("X").createMethod("void foo() {}", null, true, null);
- this.startDeltas();
- copy.save(null, true);
- assertDeltas(
- "Unexpected delta after saving working copy",
- ""
- );
- copy.commit(true, null);
- assertDeltas(
- "Unexpected delta after committing working copy",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}"
- );
- } finally {
- this.stopDeltas();
- if (copy != null) copy.destroy();
- this.deleteProject("P");
- }
-}
-
-
-
-/**
- * Ensure that a classpath change is detected even on a project which got closed
- */
-public void testSetClasspathOnFreshProject() throws CoreException {
- try {
- this.createProject("LibProj");
- this.createFile("LibProj/mylib.jar", "");
- JavaProject p1 = (JavaProject)this.createJavaProject("P1", new String[] {""}, "bin");
- this.createFolder("P1/src2");
-
- p1.getProject().close(null);
- p1.getProject().open(null);
-
- this.startDeltas();
-
- IClasspathEntry[] classpath =
- new IClasspathEntry[] {
- JavaCore.newSourceEntry(new Path("/P1/src2")),
- JavaCore.newLibraryEntry(new Path("/LibProj/mylib.jar"), null, null)
- };
- p1.setRawClasspath(classpath, null);
- assertDeltas(
- "Should notice src2 and myLib additions to the classpath",
- "P1[*]: {CHILDREN}\n" +
- " [project root][*]: {REMOVED FROM CLASSPATH}\n" +
- " src2[*]: {ADDED TO CLASSPATH}\n" +
- " /LibProj/mylib.jar[*]: {ADDED TO CLASSPATH}\n" +
- " ResourceDelta(/P1/.classpath)[*]");
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("LibProj");
- }
-}
-/**
- * Ensures that setting a classpath variable when there is exactly one project
- * triggers a java element delta.
- */
-public void testSetClasspathVariable1() throws CoreException {
- try {
- this.createProject("LibProj");
- this.createFile("LibProj/mylib.jar", "");
- this.createFile("LibProj/otherlib.jar", "");
- JavaCore.setClasspathVariables(new String[] {"LIB"}, new IPath[] {new Path("/LibProj/mylib.jar")}, null);
- this.createJavaProject("P", new String[] {""}, new String[] {"LIB"}, "");
- this.startDeltas();
- JavaCore.setClasspathVariables(new String[] {"LIB"}, new IPath[] {new Path("/LibProj/otherlib.jar")}, null);
- assertDeltas(
- "Unexpected delta after setting classpath variable",
- "P[*]: {CHILDREN}\n" +
- " /LibProj/mylib.jar[*]: {REMOVED FROM CLASSPATH}\n" +
- " /LibProj/otherlib.jar[*]: {ADDED TO CLASSPATH}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- this.deleteProject("LibProj");
- }
-}
-/**
- * Ensures that setting a classpath variable when there are more than one project
- * triggers a java element delta.
- */
-public void testSetClasspathVariable2() throws CoreException {
- try {
- this.createProject("LibProj");
- this.createFile("LibProj/mylib.jar", "");
- this.createFile("LibProj/otherlib.jar", "");
- JavaCore.setClasspathVariables(new String[] {"LIB"}, new IPath[] {new Path("/LibProj/mylib.jar")}, null);
- this.createJavaProject("P1", new String[] {""}, new String[] {"LIB"}, "");
- this.createJavaProject("P2", new String[] {""}, new String[] {"LIB"}, "");
- this.startDeltas();
- JavaCore.setClasspathVariables(new String[] {"LIB"}, new IPath[] {new Path("/LibProj/otherlib.jar")}, null);
- assertEquals(
- "Unexpected delta after setting classpath variable",
- "P1[*]: {CHILDREN}\n" +
- " /LibProj/mylib.jar[*]: {REMOVED FROM CLASSPATH}\n" +
- " /LibProj/otherlib.jar[*]: {ADDED TO CLASSPATH}\n" +
- "P2[*]: {CHILDREN}\n" +
- " /LibProj/mylib.jar[*]: {REMOVED FROM CLASSPATH}\n" +
- " /LibProj/otherlib.jar[*]: {ADDED TO CLASSPATH}",
- this.getSortedByProjectDeltas());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- this.deleteProject("LibProj");
- }
-}
-
-/**
- * Ensures that committing a working copy fires a fine grained delta.
- */
-public void testWorkingCopyCommit() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("P/x/y");
- this.createFile("P/x/y/A.java",
- "package x.y;\n" +
- "public class A {\n" +
- "}");
- ICompilationUnit cu = this.getCompilationUnit("P/x/y/A.java");
- ICompilationUnit copy = (ICompilationUnit) cu.getWorkingCopy();
- copy.getBuffer().setContents(
- "package x.y;\n" +
- "public class A {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- copy.save(null, false);
- this.startDeltas();
- copy.commit(true, null);
- assertDeltas(
- "Unexpected delta after commit",
- "P[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " x.y[*]: {CHILDREN}\n" +
- " A.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " A[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}"
- );
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelTests.java
deleted file mode 100644
index 981bb94..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelTests.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-
-import junit.framework.Test;
-/**
- * Tests IJavaModel API.
- */
-public class JavaModelTests extends ModifyingResourceTests {
-
-public static Test suite() {
- return new Suite(JavaModelTests.class);
-}
-public JavaModelTests(String name) {
- super(name);
-}
-protected int indexOf(String projectName, IJavaProject[] projects) {
- for (int i = 0, length = projects.length; i < length; i++) {
- if (projects[i].getElementName().equals(projectName)) {
- return i;
- }
- }
- return -1;
-}
-/*
- * Ensure that a java project is not added to the list of known java project
- * when a file is added to a non-java project.
- * (regression test for bug 18698 Seeing non-java projects in package view)
- */
-public void testAddFileToNonJavaProject() throws CoreException {
- IJavaModel model = this.getJavaModel();
- IJavaProject[] projects = model.getJavaProjects();
- assertTrue(
- "Project P should not be present already",
- this.indexOf("P", projects) == -1
- );
- try {
- this.createProject("P");
- this.createFile("/P/toto.txt", "");
- projects = model.getJavaProjects();
- assertTrue(
- "Project P should not be present",
- this.indexOf("P", projects) == -1
- );
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource belonging to the Java model is known to be contained in the Java model.
- * Case of non-accessible resources
- */
-public void testContains1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
-
- // .java file
- IFile file = this.getFile("/P/X.java");
- assertTrue("/P/X.java should be in model", getJavaModel().contains(file));
-
- // .class file
- file = this.getFile("/P/X.class");
- assertTrue("/P/X.class should not be in model", !getJavaModel().contains(file));
-
- // non-Java resource
- file = this.getFile("/P/read.txt");
- assertTrue("/P/read.txt should be in model", getJavaModel().contains(file));
-
- // package
- IFolder folder = this.getFolder("/P/p");
- assertTrue("/P/p should be in model", getJavaModel().contains(folder));
-
- // resource in closed project
- file = this.createFile("/P/X.java", "");
- project.getProject().close(null);
- assertTrue("/P/X.java should be in model (even if project is closed)", getJavaModel().contains(file));
-
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource belonging to the Java model is known to be contained in the Java model.
- * Case of projects
- */
-public void testContains2() throws CoreException {
- try {
- // Java project
- IProject project = this.createJavaProject("P1", new String[] {""}, "").getProject();
- assertTrue("/P1 should be in model", getJavaModel().contains(project));
-
- // non-Java project
- project = this.createProject("P2");
- assertTrue("/P2 should be in model", getJavaModel().contains(project));
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that a resource belonging to the Java model is known to be contained in the Java model.
- * Case of prj=src=bin
- */
-public void testContains3() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "");
-
- // .java file
- IFile file = this.createFile("/P/X.java", "");
- assertTrue("/P/X.java should be in model", getJavaModel().contains(file));
-
- // .class file
- file = this.createFile("/P/X.class", "");
- assertTrue("/P/X.class should not be in model", !getJavaModel().contains(file));
-
- // non-Java resource
- file = this.createFile("/P/read.txt", "");
- assertTrue("/P/read.txt should be in model", getJavaModel().contains(file));
-
- // package
- IFolder folder = this.createFolder("/P/p");
- assertTrue("/P/p should be in model", getJavaModel().contains(folder));
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource belonging to the Java model is known to be contained in the Java model.
- * Case of empty classpath.
- */
-public void testContains4() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {}, "bin");
-
- // .java file
- IFile file = this.createFile("/P/X.java", "");
- assertTrue("/P/X.java should be in model", getJavaModel().contains(file));
-
- // .class file
- file = this.createFile("/P/X.class", "");
- assertTrue("/P/X.class should be in model", getJavaModel().contains(file));
-
- // non-Java resource file
- file = this.createFile("/P/read.txt", "");
- assertTrue("/P/read.txt should be in model", getJavaModel().contains(file));
-
- // non-Java resource folder
- IFolder folder = this.createFolder("/P/p");
- assertTrue("/P/p should be in model", getJavaModel().contains(folder));
-
- // bin folder
- folder = this.getFolder("/P/bin");
- assertTrue("/P/bin should not be in model", !getJavaModel().contains(folder));
-
- // classfile in bin folder
- file = this.createFile("/P/bin/X.class", "");
- assertTrue("/P/bin/X.class should not be in model", !getJavaModel().contains(file));
-
- // resource file in bin folder
- this.createFolder("/P/bin/image");
- file = this.createFile("/P/bin/image/ok.gif", "");
- assertTrue("/P/bin/image/ok.gif should not be in model", !getJavaModel().contains(file));
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource belonging to the Java model is known to be contained in the Java model.
- * Case of src != bin
- */
-public void testContains5() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
-
- // .java file
- IFile file = this.createFile("/P/src/X.java", "");
- assertTrue("/P/src/X.java should be in model", getJavaModel().contains(file));
-
- // resource file in src
- this.createFolder("/P/src/image");
- file = this.createFile("/P/src/image/ok.gif", "");
- assertTrue("/P/src/image/ok.gif should not be in model", getJavaModel().contains(file));
-
- // .class file in bin
- file = this.createFile("/P/bin/X.class", "");
- assertTrue("/P/bin/X.class should not be in model", !getJavaModel().contains(file));
-
- // resource file in bin
- this.createFolder("/P/bin/image");
- file = this.createFile("/P/bin/image/ok.gif", "");
- assertTrue("/P/bin/image/ok.gif should not be in model", !getJavaModel().contains(file));
-
- // .class file in src
- file = this.createFile("/P/src/X.class", "");
- assertTrue("/P/src/X.class should not be in model", !getJavaModel().contains(file));
-
- // non-Java resource
- file = this.createFile("/P/src/read.txt", "");
- assertTrue("/P/src/read.txt should be in model", getJavaModel().contains(file));
-
- // package
- IFolder folder = this.createFolder("/P/src/p");
- assertTrue("/P/src/p should be in model", getJavaModel().contains(folder));
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a resource belonging to the Java model is known to be contained in the Java model.
- * Case of prj==src and separate bin
- */
-public void testContains6() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {""}, "bin");
-
- // .java file
- IFile file = this.createFile("/P/X.java", "");
- assertTrue("/P/X.java should be in model", getJavaModel().contains(file));
-
- // resource file in src
- this.createFolder("/P/image");
- file = this.createFile("/P/image/ok.gif", "");
- assertTrue("/P/image/ok.gif should not be in model", getJavaModel().contains(file));
-
- // .class file in bin
- file = this.createFile("/P/bin/X.class", "");
- assertTrue("/P/bin/X.class should not be in model", !getJavaModel().contains(file));
-
- // resource file in bin
- this.createFolder("/P/bin/image");
- file = this.createFile("/P/bin/image/ok.gif", "");
- assertTrue("/P/bin/image/ok.gif should not be in model", !getJavaModel().contains(file));
-
- // .class file in src
- file = this.createFile("/P/X.class", "");
- assertTrue("/P/X.class should not be in model", !getJavaModel().contains(file));
-
- // non-Java resource
- file = this.createFile("/P/read.txt", "");
- assertTrue("/P/read.txt should be in model", getJavaModel().contains(file));
-
- // package
- IFolder folder = this.createFolder("/P/p");
- assertTrue("/P/p should be in model", getJavaModel().contains(folder));
- } finally {
- this.deleteProject("P");
- }
-}
-
-/**
- * Test that a model has no project.
- */
-public void testGetJavaProject() throws JavaModelException {
- IJavaModel model= getJavaModel();
- assertTrue("project should be null", model.getJavaProject() == null);
-}
-/*
- * Ensure that a java project that is added appears in the list of known java project,
- * and that it is removed from this list when deleted.
- */
-public void testGetJavaProjects1() throws CoreException {
- IJavaModel model = this.getJavaModel();
- IJavaProject[] projects = model.getJavaProjects();
- assertTrue(
- "Project P should not be present already",
- this.indexOf("P", projects) == -1
- );
- try {
- this.createJavaProject("P", new String[] {}, "");
- projects = model.getJavaProjects();
- assertTrue(
- "Project P should be present",
- this.indexOf("P", projects) != -1
- );
- this.deleteProject("P");
- projects = model.getJavaProjects();
- assertTrue(
- "Project P should not be present any longer",
- this.indexOf("P", projects) == -1
- );
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a non-java project that is added does not appears in the list of known java project.
- */
-public void testGetJavaProjects2() throws CoreException {
- IJavaModel model = this.getJavaModel();
- IJavaProject[] projects = model.getJavaProjects();
- assertTrue(
- "Project P should not be present already",
- this.indexOf("P", projects) == -1
- );
- try {
- this.createProject("P");
- projects = model.getJavaProjects();
- assertTrue(
- "Project P should not be present",
- this.indexOf("P", projects) == -1
- );
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Test retrieving non-Java projects.
- */
-public void testGetNonJavaResources() throws CoreException {
- try {
- IJavaModel model = this.getJavaModel();
-
- this.createJavaProject("JP", new String[]{}, "");
- assertResourcesEqual(
- "Unexpected non-Java resources",
- "",
- model.getNonJavaResources());
-
- this.createProject("SP1");
- assertResourcesEqual(
- "Unexpected non-Java resources after creation of SP1",
- "SP1",
- model.getNonJavaResources());
-
- this.createProject("SP2");
- assertResourcesEqual(
- "Unexpected non-Java resources after creation of SP2",
- "SP1\n" +
- "SP2",
- model.getNonJavaResources());
-
- this.deleteProject("SP1");
- assertResourcesEqual(
- "Unexpected non-Java resources after deletion of SP1",
- "SP2",
- model.getNonJavaResources());
- } finally {
- this.deleteProject("SP1");
- this.deleteProject("SP2");
- this.deleteProject("JP");
- }
-}
-
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
deleted file mode 100644
index 37734b4..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
+++ /dev/null
@@ -1,950 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
-import org.eclipse.jdt.internal.core.Util;
-
-public class JavaProjectTests extends ModifyingResourceTests {
-public JavaProjectTests(String name) {
- super(name);
-}
-protected void assertResources(String message, String expected, IResource[] resources) {
- // sort in alphabetical order
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- IResource resourceA = (IResource)a;
- IResource resourceB = (IResource)b;
- return resourceA.getFullPath().toString().compareTo(resourceB.getFullPath().toString());
- }
- };
- Util.sort(resources, comparer);
-
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = resources.length; i < length; i++) {
- buffer.append(((IResource)resources[i]).getFullPath());
- if (i != length-1) {
- buffer.append("\n");
- }
- }
-
- String actual = buffer.toString();
- if (!expected.equals(actual)) {
- System.out.println(org.eclipse.jdt.core.tests.util.Util.displayString(buffer.toString(), 2));
- }
-
- assertEquals(message, expected, actual);
-}
-public static Test suite() {
-
- if (false) {
- TestSuite suite = new Suite(JavaProjectTests.class.getName());
- suite.addTest(new JavaProjectTests("testPackageFragmentRootRawEntryWhenDuplicate"));
- return suite;
- }
- TestSuite suite = new Suite(JavaProjectTests.class.getName());
- suite.addTest(new JavaProjectTests("testPackageFragmentRootRawEntry"));
- suite.addTest(new JavaProjectTests("testPackageFragmentRootRawEntryWhenDuplicate"));
- suite.addTest(new JavaProjectTests("testProjectGetChildren"));
- suite.addTest(new JavaProjectTests("testProjectGetPackageFragments"));
- suite.addTest(new JavaProjectTests("testRootGetPackageFragments"));
- suite.addTest(new JavaProjectTests("testRootGetPackageFragments2"));
- suite.addTest(new JavaProjectTests("testInternalArchiveCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testExternalArchiveCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testProjectCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testPackageFragmentCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testPackageFragmentHasSubpackages"));
- suite.addTest(new JavaProjectTests("testIsDefaultPackage"));
- suite.addTest(new JavaProjectTests("testPackageFragmentRootCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testJarPackageFragmentCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testCompilationUnitCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testClassFileCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testArchiveClassFileCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testBinaryTypeCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testSourceMethodCorrespondingResource"));
- suite.addTest(new JavaProjectTests("testOutputLocationNotAddedAsPackageFragment"));
- suite.addTest(new JavaProjectTests("testOutputLocationNestedInRoot"));
- suite.addTest(new JavaProjectTests("testChangeOutputLocation"));
- suite.addTest(new JavaProjectTests("testFindElementPackage"));
- suite.addTest(new JavaProjectTests("testFindElementClassFile"));
- suite.addTest(new JavaProjectTests("testFindElementCompilationUnit"));
- suite.addTest(new JavaProjectTests("testFindElementCompilationUnitDefaultPackage"));
- suite.addTest(new JavaProjectTests("testFindElementInvalidPath"));
- suite.addTest(new JavaProjectTests("testFindElementPrereqSimpleProject"));
- suite.addTest(new JavaProjectTests("testProjectClose"));
- suite.addTest(new JavaProjectTests("testPackageFragmentRenameAndCreate"));
- suite.addTest(new JavaProjectTests("testFolderWithDotName"));
- suite.addTest(new JavaProjectTests("testPackageFragmentNonJavaResources"));
- suite.addTest(new JavaProjectTests("testPackageFragmentRootNonJavaResources"));
- suite.addTest(new JavaProjectTests("testAddNonJavaResourcePackageFragmentRoot"));
- suite.addTest(new JavaProjectTests("testFindPackageFragmentRootFromClasspathEntry"));
- suite.addTest(new JavaProjectTests("testGetClasspathOnClosedProject"));
- suite.addTest(new JavaProjectTests("testGetRequiredProjectNames"));
- suite.addTest(new JavaProjectTests("testGetNonJavaResources1"));
- suite.addTest(new JavaProjectTests("testGetNonJavaResources2"));
- suite.addTest(new JavaProjectTests("testGetNonJavaResources3"));
- suite.addTest(new JavaProjectTests("testGetNonJavaResources4"));
- suite.addTest(new JavaProjectTests("testSourceFolderWithJarName"));
- suite.addTest(new JavaProjectTests("testJdkLevelRoot"));
-
- // The following test must be at the end as it deletes a package and this would have side effects
- // on other tests
- suite.addTest(new JavaProjectTests("testDeletePackageWithAutobuild"));
- return suite;
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- setUpJavaProject("JavaProjectTests");
- setUpJavaProject("JavaProjectSrcTests");
- setUpJavaProject("JavaProjectLibTests");
-}
-public void tearDownSuite() throws Exception {
- deleteProject("JavaProjectTests");
- deleteProject("JavaProjectSrcTests");
- deleteProject("JavaProjectLibTests");
- super.tearDownSuite();
-}
-
-
-/**
- * Test adding a non-java resource in a package fragment root that correspond to
- * the project.
- * (Regression test for PR #1G58NB8)
- */
-public void testAddNonJavaResourcePackageFragmentRoot() throws JavaModelException, CoreException {
- // get resources of source package fragment root at project level
- IPackageFragmentRoot root = getPackageFragmentRoot("JavaProjectTests", "");
- Object[] resources = root.getNonJavaResources();
- assertEquals("incorrect number of non java resources", 2, resources.length); // .classpath and .project files
- assertTrue("resource should be an IFile", resources[0] instanceof IFile);
- IFile resource = (IFile)resources[0];
- IPath newPath = root.getUnderlyingResource().getFullPath().append("TestNonJavaResource.abc");
- try {
- // copy and rename resource
- resource.copy(
- newPath,
- true,
- null);
-
- // ensure the new resource is present
- resources = root.getNonJavaResources();
- assertResources(
- "incorrect non java resources",
- "/JavaProjectTests/.classpath\n" +
- "/JavaProjectTests/.project\n" +
- "/JavaProjectTests/TestNonJavaResource.abc",
- (IResource[])resources);
- } finally {
- // clean up
- deleteResource(resource.getWorkspace().getRoot().getFile(newPath));
- }
-}
-/**
- * Test that a class file in a jar has no corresponding resource.
- */
-public void testArchiveClassFileCorrespondingResource() throws JavaModelException {
- IPackageFragmentRoot root = getPackageFragmentRoot("JavaProjectTests", "lib.jar");
- IPackageFragment element = root.getPackageFragment("p");
- IClassFile cf= element.getClassFile("X.class");
- IResource corr = cf.getCorrespondingResource();
- assertTrue("incorrect corresponding resource", corr == null);
-}
-/**
- * Test that a binary type
- * has a corresponding resource.
- */
-public void testBinaryTypeCorrespondingResource() throws CoreException {
- IClassFile element= getClassFile("/JavaProjectLibTests/lib/p/Y.class");
- IType type= element.getType();
- IResource corr= type.getCorrespondingResource();
- assertTrue("incorrect corresponding resource", corr == null);
-}
-/**
- * When the output location is changed, package fragments can be added/removed
- */
-public void testChangeOutputLocation() throws JavaModelException, CoreException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IContainer underLyingResource = (IContainer)project.getUnderlyingResource();
- IFolder folder= underLyingResource.getFolder(new Path("output"));
-
- try {
- startDeltas();
- project.setOutputLocation(folder.getFullPath(), null);
- assertDeltas(
- "Unexpected delta 1",
- "JavaProjectTests[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " bin[+]: {}\n" +
- " ResourceDelta(/JavaProjectTests/.classpath)[*]"
- );
- } finally {
- stopDeltas();
- try {
- startDeltas();
- folder= underLyingResource.getFolder(new Path("bin"));
- project.setOutputLocation(folder.getFullPath(), null);
- assertDeltas(
- "Unexpected delta 2",
- "JavaProjectTests[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " bin[-]: {}\n" +
- " ResourceDelta(/JavaProjectTests/.classpath)[*]"
- );
- } finally {
- stopDeltas();
- }
- }
-}
-/**
- * Test that a class file
- * has a corresponding resource.
- */
-public void testClassFileCorrespondingResource() throws JavaModelException {
- IClassFile element= getClassFile("JavaProjectLibTests", "lib", "p", "Y.class");
- IResource corr= element.getCorrespondingResource();
- IResource res= getWorkspace().getRoot().getProject("JavaProjectLibTests").getFolder("lib").getFolder("p").getFile("Y.class");
- assertTrue("incorrect corresponding resource", corr.equals(res));
-}
-/**
- * Test that a compilation unit
- * has a corresponding resource.
- */
-public void testCompilationUnitCorrespondingResource() throws JavaModelException {
- ICompilationUnit element= getCompilationUnit("JavaProjectTests", "", "q", "A.java");
- IResource corr= element.getCorrespondingResource();
- IResource res= getWorkspace().getRoot().getProject("JavaProjectTests").getFolder("q").getFile("A.java");
- assertTrue("incorrect corresponding resource", corr.equals(res));
- assertEquals("Project is incorrect for the compilation unit", "JavaProjectTests", corr.getProject().getName());
-}
-/**
- * Tests the fix for "1FWNMKD: ITPJCORE:ALL - Package Fragment Removal not reported correctly"
- */
-public void testDeletePackageWithAutobuild() throws JavaModelException, CoreException, IOException {
- // close all project except JavaProjectTests so as to avoid side effects while autobuilding
- IProject[] projects = getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- if (project.getName().equals("JavaProjectTests")) continue;
- project.close(null);
- }
-
- // turn autobuilding on
- IWorkspace workspace = getWorkspace();
- boolean autoBuild = workspace.isAutoBuilding();
- IWorkspaceDescription description = workspace.getDescription();
- description.setAutoBuilding(true);
- workspace.setDescription(description);
-
- startDeltas();
- IPackageFragment frag = getPackageFragment("JavaProjectTests", "", "x.y");
- IFolder folder = (IFolder) frag.getUnderlyingResource();
- try {
- deleteResource(folder);
- assertDeltas(
- "Unexpected delta",
- "JavaProjectTests[*]: {CHILDREN}\n" +
- " [project root][*]: {CHILDREN}\n" +
- " x.y[-]: {}"
- );
- } finally {
- stopDeltas();
-
- // turn autobuild off
- description.setAutoBuilding(autoBuild);
- workspace.setDescription(description);
-
- // reopen projects
- projects = getWorkspaceRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- if (project.getName().equals("JavaProjectTests")) continue;
- project.open(null);
- }
- }
-}
-/**
- * Test that an (external) jar
- * has no corresponding resource.
- */
-public void testExternalArchiveCorrespondingResource() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IPackageFragmentRoot element= project.getPackageFragmentRoot(getExternalJCLPathString());
- IResource corr= element.getCorrespondingResource();
- assertTrue("incorrect corresponding resource", corr == null);
-}
-/**
- * Test that a compilation unit can be found for a binary type
- */
-public void testFindElementClassFile() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IJavaElement element= project.findElement(new Path("java/lang/Object.java"));
- assertTrue("CU not found" , element != null && element.getElementType() == IJavaElement.CLASS_FILE
- && element.getElementName().equals("Object.class"));
-}
-/**
- * Test that a compilation unit can be found
- */
-public void testFindElementCompilationUnit() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IJavaElement element= project.findElement(new Path("x/y/Main.java"));
- assertTrue("CU not found" , element != null && element.getElementType() == IJavaElement.COMPILATION_UNIT
- && element.getElementName().equals("Main.java"));
-}
-/**
- * Test that a compilation unit can be found in a default package
- */
-public void testFindElementCompilationUnitDefaultPackage() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IJavaElement element= project.findElement(new Path("B.java"));
- assertTrue("CU not found" , element != null && element.getElementType() == IJavaElement.COMPILATION_UNIT
- && element.getElementName().equals("B.java"));
-}
-/**
- * Test that an invlaid path throws an exception
- */
-public void testFindElementInvalidPath() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- boolean failed= false;
- try {
- project.findElement(null);
- } catch (JavaModelException e) {
- failed= true;
- assertTrue("wrong status code" , e.getStatus().getCode() == IJavaModelStatusConstants.INVALID_PATH);
- }
- assertTrue("Shold have failed", failed);
-
- failed = false;
- try {
- project.findElement(new Path("/something/absolute"));
- } catch (JavaModelException e) {
- failed= true;
- assertTrue("wrong status code" , e.getStatus().getCode() == IJavaModelStatusConstants.INVALID_PATH);
- }
- assertTrue("Shold have failed", failed);
-
- IJavaElement element= project.findElement(new Path("does/not/exist/HelloWorld.java"));
- assertTrue("should get no element", element == null);
-}
-/**
- * Test that a package can be found
- */
-public void testFindElementPackage() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IJavaElement element= project.findElement(new Path("x/y"));
- assertTrue("package not found" , element != null && element.getElementType() == IJavaElement.PACKAGE_FRAGMENT
- && element.getElementName().equals("x.y"));
-}
-/**
- * Test that a class can be found even if the project prereq a simple project
- * (regression test for bug 28434 Open Type broken when workspace has build path problems)
- */
-public void testFindElementPrereqSimpleProject() throws CoreException {
- try {
- this.createProject("R");
- IJavaProject project = this.createJavaProject("J", new String[] {"src"}, new String[] {}, new String[] {"/R"}, "bin");
- this.createFile(
- "J/src/X.java",
- "public class X {\n" +
- "}"
- );
- assertTrue("X.java not found", project.findElement(new Path("X.java")) != null);
- } finally {
- this.deleteProject("R");
- this.deleteProject("J");
- }
-}
-/**
- * Test that a package fragment root can be found from a classpath entry.
- */
-public void testFindPackageFragmentRootFromClasspathEntry() throws JavaModelException {
- IJavaProject project = getJavaProject("JavaProjectTests");
-
- // existing classpath entry
- IClasspathEntry entry = JavaCore.newLibraryEntry(new Path("/JavaProjectTests/lib.jar"), null, null);
- IPackageFragmentRoot[] roots = project.findPackageFragmentRoots(entry);
- assertEquals("Unexpected number of roots for existing entry", 1, roots.length);
- assertEquals("Unexpected root", "/JavaProjectTests/lib.jar", roots[0].getPath().toString());
-
- // non-existing classpath entry
- entry = JavaCore.newSourceEntry(new Path("/JavaProjectTests/nonExisting"));
- roots = project.findPackageFragmentRoots(entry);
- assertEquals("Unexpected number of roots for non existing entry", 0, roots.length);
-
-}
-/**
- * Test that a folder with a dot name does not relate to a package fragment
- */
-public void testFolderWithDotName() throws JavaModelException, CoreException {
- IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectTests", "");
- IContainer folder= (IContainer)root.getCorrespondingResource();
- try {
- startDeltas();
- folder.getFolder(new Path("org.eclipse")).create(false, true, null);
- assertTrue("should be one Java Delta", this.deltaListener.deltas.length == 1);
-
- stopDeltas();
- IJavaElement[] children = root.getChildren();
- IPackageFragment bogus = root.getPackageFragment("org.eclipse");
- for (int i = 0; i < children.length; i++) {
- assertTrue("org.eclipse should not be present as child", !children[i].equals(bogus));
- }
- assertTrue("org.eclipse should not exist", !bogus.exists());
- } finally {
- deleteResource(folder.getFolder(new Path("org.eclipse")));
- }
-}
-/*
- * Ensures that getting the classpath on a closed project throws a JavaModelException
- * (regression test for bug 25358 Creating a new Java class - Browse for parent)
- */
-public void testGetClasspathOnClosedProject() throws CoreException {
- IProject project = getProject("JavaProjectTests");
- try {
- project.close(null);
- boolean gotException = false;
- IJavaProject javaProject = JavaCore.create(project);
- try {
- javaProject.getRawClasspath();
- } catch (JavaModelException e) {
- if (e.isDoesNotExist()) {
- gotException = true;
- }
- }
- assertTrue("Should get a not present exception for getRawClasspath()", gotException);
- gotException = false;
- try {
- javaProject.getResolvedClasspath(true);
- } catch (JavaModelException e) {
- if (e.isDoesNotExist()) {
- gotException = true;
- }
- }
- assertTrue("Should get a not present exception for getResolvedClasspath(true)", gotException);
- } finally {
- project.open(null);
- }
-}
-/*
- * Ensures that the non-java resources for a project do not contain the project output location.
- */
-public void testGetNonJavaResources1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- assertResources(
- "Unexpected non-java resources for project",
- "/P/.classpath\n" +
- "/P/.project",
- (IResource[])project.getNonJavaResources());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that the non-java resources for a project do not contain a custom output location.
- * (regression test for 27494 Source folder output folder shown in Package explorer)
- */
-public void testGetNonJavaResources2() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin1", new String[] {"bin2"});
- assertResources(
- "Unexpected non-java resources for project",
- "/P/.classpath\n" +
- "/P/.project",
- (IResource[])project.getNonJavaResources());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that the non-java resources for a project do not contain a folder that should be a package fragment.
- */
-public void testGetNonJavaResources3() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
- this.createFolder("/P/p1");
- assertResources(
- "Unexpected non-java resources for project",
- "/P/.classpath\n" +
- "/P/.project",
- (IResource[])project.getNonJavaResources());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that the non-java resources for a project contain a folder that have an invalid name for a package fragment.
- * (regression test for bug 31757 Folder with invalid pkg name should be non-Java resource)
- */
-public void testGetNonJavaResources4() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P");
- this.createFolder("/P/x.y");
- assertResources(
- "Unexpected non-java resources for project",
- "/P/.classpath\n" +
- "/P/.project\n" +
- "/P/x.y",
- (IResource[])project.getNonJavaResources());
- } finally {
- this.deleteProject("P");
- }
-}
-/*
- * Ensures that getRequiredProjectNames() returns the project names in the classpath order
- * (regression test for bug 25605 [API] someJavaProject.getRequiredProjectNames(); API should specify that the array is returned in ClassPath order)
- */
-public void testGetRequiredProjectNames() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject(
- "P",
- new String[] {},
- new String[] {},
- new String[] {"/JavaProjectTests", "/P1", "/P0", "/P2", "/JavaProjectSrcTests"},
- "");
- String[] requiredProjectNames = project.getRequiredProjectNames();
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = requiredProjectNames.length; i < length; i++) {
- buffer.append(requiredProjectNames[i]);
- if (i != length-1) {
- buffer.append(", ");
- }
- }
- assertEquals(
- "Unexpected required project names",
- "JavaProjectTests, P1, P0, P2, JavaProjectSrcTests",
- buffer.toString());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Test that an (internal) jar
- * has a corresponding resource.
- */
-public void testInternalArchiveCorrespondingResource() throws JavaModelException {
- IPackageFragmentRoot element= getPackageFragmentRoot("JavaProjectTests", "lib.jar");
- IResource corr= element.getCorrespondingResource();
- IResource res= getWorkspace().getRoot().getProject("JavaProjectTests").getFile("lib.jar");
- assertTrue("incorrect corresponding resource", corr.equals(res));
-}
-/**
- * Test IJavaPackageFragment.isDefaultPackage().
- */
-public void testIsDefaultPackage() throws JavaModelException {
- IPackageFragment def = getPackageFragment("JavaProjectTests", "", "");
- assertTrue("should be default package", def.isDefaultPackage());
- IPackageFragment y =
- getPackageFragment("JavaProjectTests", "", "x.y");
- assertTrue("x.y should not be default pakackage", !y.isDefaultPackage());
-
- IPackageFragment def2 = getPackageFragment("JavaProjectTests", "lib.jar", "");
- assertTrue("lib.jar should have default package", def2.isDefaultPackage());
- IPackageFragment p =
- getPackageFragment("JavaProjectTests", "lib.jar", "p");
- assertTrue("p should not be default package", !p.isDefaultPackage());
-}
-/**
- * Test that a package fragment in a jar has no corresponding resource.
- */
-public void testJarPackageFragmentCorrespondingResource() throws JavaModelException {
- IPackageFragmentRoot root = getPackageFragmentRoot("JavaProjectTests", "lib.jar");
- IPackageFragment element = root.getPackageFragment("p");
- IResource corr = element.getCorrespondingResource();
- assertTrue("incorrect corresponding resource", corr == null);
-}
-/**
- * Test that an output location can't be set to a location inside a package fragment
- * root, except the root project folder.
- */
-public void testOutputLocationNestedInRoot() throws JavaModelException, CoreException {
- IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectSrcTests", "src");
- IFolder folder= (IFolder) root.getUnderlyingResource();
- IJavaProject project= getJavaProject("JavaProjectSrcTests");
- folder= folder.getFolder("x");
- boolean failed= false;
- try {
- project.setOutputLocation(folder.getFullPath(), null);
- } catch (JavaModelException e) {
- assertTrue("should be an invalid classpath", e.getStatus().getCode() == IJavaModelStatusConstants.INVALID_CLASSPATH);
- failed= true;
- }
- assertTrue("should have failed", failed);
-
-}
-/**
- * Test that an output location folder is not created as a package fragment.
- */
-public void testOutputLocationNotAddedAsPackageFragment() throws JavaModelException, CoreException {
- IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectTests", "");
- IJavaElement[] packages= root.getChildren();
- assertEquals("unepected number of packages", 4, packages.length);
- assertTrue("should be default", packages[0].getElementName().equals(""));
-
-
- // create a nested folder in the output location and make sure it does not appear
- // as a package fragment
- IContainer underLyingResource = (IContainer)root.getUnderlyingResource();
- IFolder newFolder= underLyingResource.getFolder(new Path("bin")).getFolder(new Path("nested"));
- try {
- startDeltas();
- newFolder.create(false, true, null);
- assertTrue("should be one delta (resource deltas)", this.deltaListener.deltas != null || this.deltaListener.deltas.length == 1);
- } finally {
- stopDeltas();
- deleteResource(newFolder);
- }
-}
-/**
- * Test that a package fragment (non-external, non-jar, non-default)
- * has a corresponding resource.
- */
-public void testPackageFragmentCorrespondingResource() throws JavaModelException {
- IPackageFragment element= getPackageFragment("JavaProjectTests", "", "x.y");
- IResource corr= element.getCorrespondingResource();
- IResource res= getWorkspace().getRoot().getProject("JavaProjectTests").getFolder("x").getFolder("y");
- assertTrue("incorrect corresponding resource", corr.equals(res));
-}
-/**
- * Test that a package fragment (non-external, non-jar, non-default)
- * has a corresponding resource.
- */
-public void testPackageFragmentHasSubpackages() throws JavaModelException {
- IPackageFragment def= getPackageFragment("JavaProjectTests", "", "");
- IPackageFragment x= getPackageFragment("JavaProjectTests", "", "x");
- IPackageFragment y= getPackageFragment("JavaProjectTests", "", "x.y");
- assertTrue("default should have subpackages", def.hasSubpackages());
- assertTrue("x should have subpackages", x.hasSubpackages());
- assertTrue("x.y should NOT have subpackages", !y.hasSubpackages());
-
- IPackageFragment java = getPackageFragment("JavaProjectTests", getExternalJCLPathString(), "java");
- IPackageFragment lang= getPackageFragment("JavaProjectTests", getExternalJCLPathString(), "java.lang");
-
- assertTrue("java should have subpackages", java.hasSubpackages());
- assertTrue("java.lang should NOT have subpackages", !lang.hasSubpackages());
-}
-/**
- * Test getting the non-java resources from a package fragment.
- */
-public void testPackageFragmentNonJavaResources() throws JavaModelException {
- // regular source package with resources
- IPackageFragment pkg = getPackageFragment("JavaProjectTests", "", "x");
- Object[] resources = pkg.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 1)", 2, resources.length);
-
- // regular source package without resources
- pkg = getPackageFragment("JavaProjectTests", "", "x.y");
- resources = pkg.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 2)", 0, resources.length);
-
- // source default package with potentialy resources
- pkg = getPackageFragment("JavaProjectTests", "", "");
- resources = pkg.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 3)", 0, resources.length);
-
- // regular zip package with resources
- // TO DO
-
- // regular zip package without resources
- pkg = getPackageFragment("JavaProjectTests", "lib.jar", "p");
- resources = pkg.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 5)", 0, resources.length);
-
- // zip default package with potentialy resources
- // TO DO
-
- // zip default package with potentialy no resources
- pkg = getPackageFragment("JavaProjectTests", "lib.jar", "");
- resources = pkg.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 7)", 0, resources.length);
-
-}
-/**
- * Tests that after a package "foo" has been renamed into "bar", it is possible to recreate
- * a "foo" package.
- * @see 1FWX0HY: ITPCORE:WIN98 - Problem after renaming a Java package
- */
-public void testPackageFragmentRenameAndCreate() throws JavaModelException, CoreException {
- IPackageFragment y = getPackageFragment("JavaProjectTests", "", "x.y");
- IFolder yFolder = (IFolder) y.getUnderlyingResource();
- IPath yPath = yFolder.getFullPath();
- IPath fooPath = yPath.removeLastSegments(1).append("foo");
-
- yFolder.move(fooPath, true, null);
- try {
- yFolder.create(true, true, null);
- } catch (Throwable e) {
- e.printStackTrace();
- assertTrue("should be able to recreate the y folder", false);
- }
- // restore the original state
- deleteResource(yFolder);
- IPackageFragment foo = getPackageFragment("JavaProjectTests", "", "x.foo");
- IFolder fooFolder = (IFolder) foo.getUnderlyingResource();
- fooFolder.move(yPath, true, null);
-}
-/**
- * Test that a package fragment root (non-external, non-jar, non-default root)
- * has a corresponding resource.
- */
-public void testPackageFragmentRootCorrespondingResource() throws JavaModelException {
- IPackageFragmentRoot element= getPackageFragmentRoot("JavaProjectTests", "");
- IResource corr= element.getCorrespondingResource();
- IResource res= getWorkspace().getRoot().getProject("JavaProjectTests");
- assertTrue("incorrect corresponding resource", corr.equals(res));
- assertEquals("Project incorrect for folder resource", "JavaProjectTests", corr.getProject().getName());
-}
-/**
- * Test getting the non-java resources from a package fragment root.
- */
-public void testPackageFragmentRootNonJavaResources() throws JavaModelException {
- // source package fragment root with resources
- IPackageFragmentRoot root = getPackageFragmentRoot("JavaProjectTests", "");
- Object[] resources = root.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 1)", 2, resources.length);
-
- // source package fragment root without resources
- root = getPackageFragmentRoot("JavaProjectSrcTests", "src");
- resources = root.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 2)", 0, resources.length);
-
- // zip package fragment root with resources
- // TO DO
-
- // zip package fragment root without resources
- root = getPackageFragmentRoot("JavaProjectTests", "lib.jar");
- resources = root.getNonJavaResources();
- assertEquals("incorrect number of non java resources (test case 4)", 0, resources.length);
-}
-/**
- * Test raw entry inference performance for package fragment root
- */
-public void testPackageFragmentRootRawEntry() throws CoreException, IOException {
- File libDir = null;
- try {
- String libPath = EXTERNAL_JAR_DIR_PATH + File.separator + "lib";
- JavaCore.setClasspathVariable("MyVar", new Path(libPath), null);
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin");
- libDir = new File(libPath);
- libDir.mkdirs();
- final int length = 200;
- IClasspathEntry[] classpath = new IClasspathEntry[length];
- for (int i = 0; i < length; i++){
- File libJar = new File(libDir, "lib"+i+".jar");
- libJar.createNewFile();
- classpath[i] = JavaCore.newVariableEntry(new Path("/MyVar/lib"+i+".jar"), null, null);
- }
- proj.setRawClasspath(classpath, null);
-
- IPackageFragmentRoot[] roots = proj.getPackageFragmentRoots();
- assertEquals("wrong number of entries:", length, roots.length);
- long start = System.currentTimeMillis();
- for (int i = 0; i < roots.length; i++){
- IClasspathEntry rawEntry = roots[i].getRawClasspathEntry();
- assertEquals("unexpected root raw entry:", classpath[i], rawEntry);
- }
- System.out.println((System.currentTimeMillis() - start)+ "ms for "+roots.length+" roots");
- } finally {
- if (libDir != null) {
- String[] libJars = libDir.list();
- if (libJars != null) {
- for (int i = 0, length = libJars.length; i < length; i++) {
- new File(libDir, libJars[i]).delete();
- }
- }
- libDir.delete();
- }
- this.deleteProject("P");
- JavaCore.removeClasspathVariable("MyVar", null);
- }
-}
-/**
- * Test raw entry inference performance for package fragment root in case
- * original classpath had duplicate entries pointing to it: first raw entry should be found
- */
-public void testPackageFragmentRootRawEntryWhenDuplicate() throws CoreException, IOException {
- File libDir = null;
- try {
- String libPath = EXTERNAL_JAR_DIR_PATH + File.separator + "lib";
- JavaCore.setClasspathVariable("MyVar", new Path(EXTERNAL_JAR_DIR_PATH), null);
- IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin");
- libDir = new File(libPath);
- libDir.mkdirs();
- IClasspathEntry[] classpath = new IClasspathEntry[2];
- File libJar = new File(libDir, "lib.jar");
- libJar.createNewFile();
- classpath[0] = JavaCore.newLibraryEntry(new Path(libPath).append("lib.jar"), null, null);
- classpath[1] = JavaCore.newVariableEntry(new Path("/MyVar").append("lib.jar"), null, null);
- proj.setRawClasspath(classpath, null);
- JavaCore.setClasspathVariable("MyVar", new Path(libPath), null); // change CP var value to cause collision
-
- IPackageFragmentRoot[] roots = proj.getPackageFragmentRoots();
- assertEquals("wrong number of entries:", 1, roots.length);
- IClasspathEntry rawEntry = roots[0].getRawClasspathEntry();
- assertEquals("unexpected root raw entry:", classpath[0], rawEntry); // ensure first entry is associated to the root
- } finally {
- if (libDir != null) {
- String[] libJars = libDir.list();
- if (libJars != null) {
- for (int i = 0, length = libJars.length; i < length; i++) {
- new File(libDir, libJars[i]).delete();
- }
- }
- libDir.delete();
- }
- this.deleteProject("P");
- JavaCore.removeClasspathVariable("MyVar", null);
- }
-}
-/**
- * Tests that closing and opening a project triggers the correct deltas.
- */
-public void testProjectClose() throws JavaModelException, CoreException {
- IJavaProject jproject= getJavaProject("JavaProjectTests");
- IPackageFragmentRoot[] originalRoots = jproject.getPackageFragmentRoots();
- IProject project= jproject.getProject();
-
- try {
- startDeltas();
- project.close(null);
- assertDeltas(
- "Unexpected delta 1",
- "JavaProjectTests[-]: {}\n" +
- "ResourceDelta(/JavaProjectTests)"
- );
- } finally {
- try {
- clearDeltas();
-
- project.open(null);
- assertDeltas(
- "Unexpected delta 2",
- "JavaProjectTests[+]: {}\n" +
- "ResourceDelta(/JavaProjectTests)"
- );
-
- IPackageFragmentRoot[] openRoots = jproject.getPackageFragmentRoots();
- assertTrue("should have same number of roots", openRoots.length == originalRoots.length);
- for (int i = 0; i < openRoots.length; i++) {
- assertTrue("root not the same", openRoots[i].equals(originalRoots[i]));
- }
- } finally {
- stopDeltas();
- }
- }
-}
-/**
- * Test that a project has a corresponding resource.
- */
-public void testProjectCorrespondingResource() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IResource corr= project.getCorrespondingResource();
- IResource res= getWorkspace().getRoot().getProject("JavaProjectTests");
- assertTrue("incorrect corresponding resource", corr.equals(res));
-}
-/**
- * Test that the correct children exist in a project
- */
-public void testProjectGetChildren() throws JavaModelException {
- IJavaProject project = getJavaProject("JavaProjectTests");
- IJavaElement[] roots= project.getChildren();
- assertTrue("should be package 3 package fragment root children in 'JavaProjectTests', were " + roots.length , roots.length == 3);
-}
-/**
- * Test that the correct package fragments exist in the project.
- */
-public void testProjectGetPackageFragments() throws JavaModelException {
- IJavaProject project= getJavaProject("JavaProjectTests");
- IPackageFragment[] fragments= project.getPackageFragments();
- assertTrue("should be package 12 package fragments in 'JavaProjectTests', were " + fragments.length , fragments.length == 11);
-}
-/**
- * Test that the correct package fragments exist in the project.
- */
-public void testRootGetPackageFragments() throws JavaModelException {
- IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectTests", "");
- IJavaElement[] fragments= root.getChildren();
- assertTrue("should be package 5 package fragments in source root, were " + fragments.length , fragments.length == 4);
-
- root= getPackageFragmentRoot("JavaProjectTests", "lib.jar");
- fragments= root.getChildren();
- assertTrue("should be package 3 package fragments in lib.jar, were " + fragments.length , fragments.length == 3);
-}
-/**
- * Test that the correct package fragments exist in the project.
- * (regression test for bug 32041 Multiple output folders fooling Java Model)
- */
-public void testRootGetPackageFragments2() throws CoreException {
- try {
- this.createJavaProject("P");
- this.createFolder("/P/bin");
- this.createFolder("/P/bin2");
- this.editFile(
- "/P/.classpath",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<classpath>\n" +
- " <classpathentry kind=\"src\" output=\"bin2\" path=\"\"/>\n" +
- " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
- "</classpath>"
- );
- IPackageFragmentRoot root = getPackageFragmentRoot("/P");
- assertElementsEqual(
- "Unexpected packages",
- "",
- root.getChildren());
- } finally {
- this.deleteProject("P");
- }
-}
-/**
- * Ensure a source folder can have a name ending with ".jar"
- */
-public void testSourceFolderWithJarName() throws CoreException {
- try {
- this.createJavaProject("P", new String[] {"src.jar"}, "bin");
- IFile file = createFile("/P/src.jar/X.java", "class X {}");
- ICompilationUnit unit = (ICompilationUnit)JavaCore.create(file);
- unit.getAllTypes(); // force to open
- } catch (CoreException e) {
- assertTrue("unable to open unit in 'src.jar' source folder", false);
- } finally {
- this.deleteProject("P");
- }
-}/**
- * Test that a method
- * has no corresponding resource.
- */
-public void testSourceMethodCorrespondingResource() throws JavaModelException {
- ICompilationUnit element= getCompilationUnit("JavaProjectTests", "", "q", "A.java");
- IMethod[] methods = element.getType("A").getMethods();
- assertTrue("missing methods", methods.length > 0);
- IResource corr= methods[0].getCorrespondingResource();
- assertTrue("incorrect corresponding resource", corr == null);
-}
-/**
- * Test the jdklevel of the package fragment root
- */
-public void testJdkLevelRoot() throws JavaModelException {
- IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectLibTests", "lib/");
- assertEquals("wrong type", IPackageFragmentRoot.K_BINARY, root.getKind());
- assertEquals("wrong jdk level", ClassFileConstants.JDK1_1, Util.getJdkLevel(root.getResource()));
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java
deleted file mode 100644
index 58a71da..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.tests.model.JavaSearchTests.JavaSearchResultCollector;
-
-/**
- * Tests the Java search engine accross multiple projects.
- */
-public class JavaSearchMultipleProjectsTests extends ModifyingResourceTests implements IJavaSearchConstants {
-public JavaSearchMultipleProjectsTests(String name) {
- super(name);
-}
-public static Test suite() {
- return new Suite(JavaSearchMultipleProjectsTests.class);
-}
-/**
- * Search for references in a hierarchy should find matches in super type.
- * (regression test for bug 31748 [search] search for reference is broken 2.1 M5)
- */
-public void testHierarchyScope1() throws CoreException {
- try {
- createJavaProject("P1");
- createFolder("/P1/p");
- createFile(
- "/P1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- " protected void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " foo();\n" +
- " }\n" +
- "}"
- );
- createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
- createFile(
- "/P2/Y.java",
- "import p.X;\n" +
- "public class Y extends X {\n" +
- " protected void foo() {\n" +
- " }\n" +
- "}"
- );
- ICompilationUnit cu = getCompilationUnit("/P2/Y.java");
- IType type = cu.getType("Y");
- IMethod method = type.getMethod("foo", new String[] {});
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showProject = true;
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "p/X.java [in P1] p.X.bar() -> void [foo()]",
- resultCollector.toString());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-/**
- * Search for references in a hierarchy should find matches in super type.
- * (regression test for bug 31748 [search] search for reference is broken 2.1 M5)
- */
-public void testHierarchyScope2() throws CoreException {
- try {
- createJavaProject("P1");
- createFolder("/P1/p");
- createFile(
- "/P1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- " protected void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " foo();\n" +
- " }\n" +
- "}"
- );
- createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
- createFile(
- "/P2/Y.java",
- "import p.X;\n" +
- "public class Y extends X {\n" +
- " protected void foo() {\n" +
- " }\n" +
- "}"
- );
- createFile(
- "/P2/Z.java",
- "public class Z extends Y {\n" +
- " protected void foo() {\n" +
- " }\n" +
- "}"
- );
-
- ICompilationUnit cu = getCompilationUnit("/P2/Z.java");
- IType type = cu.getType("Z");
- IMethod method = type.getMethod("foo", new String[] {});
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showProject = true;
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "p/X.java [in P1] p.X.bar() -> void [foo()]",
- resultCollector.toString());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-/**
- * Search for references in a hierarchy should find matches in super type.
- * (regression test for bug 35755 Search in hierarchy misses dependent projects )
- */
-public void testHierarchyScope3() throws CoreException {
- try {
- createJavaProject("P1");
- createFolder("/P1/p");
- createFile(
- "/P1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- " protected void foo() {\n" +
- " }\n" +
- "}"
- );
- createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
- createFolder("/P2/q");
- createFile(
- "/P2/q/Y.java",
- "package q;\n" +
- "import p.X;\n" +
- "public class Y extends X {\n" +
- " void bar() {\n" +
- " foo();\n" +
- " }\n" +
- "}"
- );
-
- ICompilationUnit cu = getCompilationUnit("/P1/p/X.java");
- IType type = cu.getType("X");
- IMethod method = type.getMethod("foo", new String[] {});
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showProject = true;
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "q/Y.java [in P2] q.Y.bar() -> void [foo()]",
- resultCollector.toString());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-/**
- * Search for references in a hierarchy should not find inaccurate match if reference is indirect.
- * (regression test for bug 35755 Search in hierarchy misses dependent projects )
- */
-public void testHierarchyScope4() throws CoreException {
- try {
- createJavaProject("P0");
- createFolder("/P0/p0");
- createFile(
- "/P0/p0/X.java",
- "package p0;\n" +
- "public class X {\n" +
- " public static X TheX;\n" +
- " public void foo() {\n" +
- " }\n" +
- "}"
- );
- createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P0"}, "");
- createFolder("/P1/p1");
- createFile(
- "/P1/p1/T.java",
- "package p1;\n" +
- "import p0.X;\n" +
- "public class T {\n" +
- " public X zork() {\n" +
- " return X.TheX;\n" +
- " }\n" +
- "}"
- );
- createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P0", "/P1"}, "");
- createFolder("/P2/p2");
- createFile(
- "/P2/p2/Y.java",
- "package p2;\n" +
- "import p0.X;\n" +
- "import p1.T;\n" +
- "public class Y extends X {\n" +
- " public void bar() {\n" +
- " new T().zork().foo();\n" +
- " }\n" +
- "}"
- );
- createJavaProject("P3", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P0", "/P2"}, "");
- createFolder("/P3/p3");
- createFile(
- "/P3/p3/Z.java",
- "package p3;\n" +
- "import p0.X;\n" +
- "import p2.Y;\n" +
- "public class Z extends Y {\n" +
- " static {\n" +
- " X.TheX = new Z(); // zork() will actually answer an instance of Z\n" +
- " }\n" +
- " public void foo() {\n" +
- " } // refs should find one in Y.bar()\n" +
- "}"
- );
-
- ICompilationUnit cu = getCompilationUnit("/P3/p3/Z.java");
- IType type = cu.getType("Z");
- IMethod method = type.getMethod("foo", new String[] {});
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- resultCollector.showProject = true;
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "p2/Y.java [in P2] p2.Y.bar() -> void [foo()] EXACT_MATCH",
- resultCollector.toString());
- } finally {
- deleteProjects(new String[] {"P0", "P1", "P2", "P3"});
- }
-}
-/**
- * Method occurences with 2 unrelated projects that contain the same source.
- * (regression test for bug 33800 search: reporting too many method occurrences)
- */
-public void testMethodOccurences() throws CoreException {
- try {
- // setup project P1
- IJavaProject p1 = createJavaProject("P1");
- createFolder("/P1/p");
- createFile(
- "/P1/p/I.java",
- "package p;\n" +
- "public interface I {\n" +
- " void method(Object o);\n" +
- "}"
- );
- createFile(
- "/P1/p/C.java",
- "package p;\n" +
- "public class C implements I {\n" +
- " void method(Object o) {\n" +
- " }\n" +
- "}"
- );
-
- // copy to project P2
- p1.getProject().copy(new Path("/P2"), false, null);
- IJavaProject p2 = getJavaProject("P2");
-
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {p1, p2});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showProject = true;
- IMethod method = getCompilationUnit("/P1/p/I.java").getType("I").getMethod("method", new String[] {"QObject;"});
- new SearchEngine().search(
- getWorkspace(),
- method,
- ALL_OCCURRENCES,
- scope,
- resultCollector);
- assertEquals(
- "Unexpected occurences of method p.I.method(Object)",
- "p/C.java [in P1] p.C.method(Object) -> void [method]\n" +
- "p/I.java [in P1] p.I.method(Object) -> void [method]",
- resultCollector.toString());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-/**
- * Type declaration in external jar file that is shared by 2 projects.
- * (regression test for bug 27485 SearchEngine returns wrong java element when searching in an archive that is included by two distinct java projects.)
- */
-public void testTypeDeclarationInJar() throws CoreException {
- try {
- IJavaProject p1 = createJavaProject("P1", new String[] {}, new String[] {"JCL_LIB"}, "");
- IJavaProject p2 = createJavaProject("P2", new String[] {}, new String[] {"JCL_LIB"}, "");
-
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {p1});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showProject = true;
- new SearchEngine().search(
- getWorkspace(),
- "Object",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "Unexpected result in scope of P1",
- getExternalJCLPathString() + " [in P1] java.lang.Object",
- resultCollector.toString());
-
- scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {p2});
- resultCollector = new JavaSearchResultCollector();
- resultCollector.showProject = true;
- new SearchEngine().search(
- getWorkspace(),
- "Object",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "Unexpected result in scope of P2",
- getExternalJCLPathString() + " [in P2] java.lang.Object",
- resultCollector.toString());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java
deleted file mode 100644
index e932540..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java
+++ /dev/null
@@ -1,2805 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Hashtable;
-
-import org.eclipse.jdt.internal.core.JavaModelStatus;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.search.*;
-import org.eclipse.jdt.core.compiler.CharOperation;
-
-import junit.framework.*;
-
-/**
- * Tests the Java search engine where results are JavaElements and source positions.
- */
-public class JavaSearchTests extends AbstractJavaModelTests implements IJavaSearchConstants {
-
-/**
- * Collects results as a string.
- */
-public static class JavaSearchResultCollector implements IJavaSearchResultCollector {
- public StringBuffer results = new StringBuffer();
- public boolean showAccuracy = false;
- public boolean showProject = false;
- public void aboutToStart() {
- }
- public void accept(IResource resource, int start, int end, IJavaElement element, int accuracy) {
- try {
- if (results.length() > 0) results.append("\n");
- IPath path = resource.getProjectRelativePath();
- if (path.segmentCount() == 0) {
- IJavaElement root = element;
- while (root != null && !(root instanceof IPackageFragmentRoot)) {
- root = root.getParent();
- }
- if (root != null) {
- IPackageFragmentRoot pkgFragmentRoot = (IPackageFragmentRoot)root;
- if (pkgFragmentRoot.isExternal()) {
- results.append(pkgFragmentRoot.getPath().toOSString());
- } else {
- results.append(pkgFragmentRoot.getPath());
- }
- }
- } else {
- results.append(path);
- }
- if (showProject) {
- IProject project = element.getJavaProject().getProject();
- results.append(" [in ");
- results.append(project.getName());
- results.append("]");
- }
- ICompilationUnit unit = null;
- if (element instanceof IMethod) {
- results.append(" ");
- IMethod method = (IMethod)element;
- results.append(method.getDeclaringType().getFullyQualifiedName());
- if (!method.isConstructor()) {
- results.append(".");
- results.append(method.getElementName());
- }
- results.append("(");
- String[] parameters = method.getParameterTypes();
- for (int i = 0; i < parameters.length; i++) {
- results.append(Signature.toString(parameters[i]));
- if (i < parameters.length-1) {
- results.append(", ");
- }
- }
- results.append(")");
- if (!method.isConstructor()) {
- results.append(" -> ");
- results.append(Signature.toString(method.getReturnType()));
- }
- unit = method.getCompilationUnit();
- } else if (element instanceof IType) {
- results.append(" ");
- IType type = (IType)element;
- results.append(type.getFullyQualifiedName());
- unit = type.getCompilationUnit();
- } else if (element instanceof IField) {
- results.append(" ");
- IField field = (IField)element;
- results.append(field.getDeclaringType().getFullyQualifiedName());
- results.append(".");
- results.append(field.getElementName());
- unit = field.getCompilationUnit();
- } else if (element instanceof IInitializer) {
- results.append(" ");
- IInitializer initializer = (IInitializer)element;
- results.append(initializer.getDeclaringType().getFullyQualifiedName());
- results.append(".");
- if (Flags.isStatic(initializer.getFlags())) {
- results.append("static ");
- }
- results.append("{}");
- unit = initializer.getCompilationUnit();
- } else if (element instanceof IPackageFragment) {
- results.append(" ");
- results.append(element.getElementName());
- }
- if (resource instanceof IFile) {
- char[] contents = null;
- if ("java".equals(resource.getFileExtension())) {
- if (!resource.equals(element.getUnderlyingResource())) {
- // working copy
- contents = unit.getBuffer().getCharacters();
- } else {
- contents = new org.eclipse.jdt.internal.compiler.batch.CompilationUnit(
- null,
- ((IFile) resource).getLocation().toFile().getPath(),
- null).getContents();
- }
- }
- if (start == -1 || contents != null) { // retrieving attached source not implemented here
- results.append(" [");
- if (start > -1) {
- results.append(CharOperation.subarray(contents, start, end));
- } else {
- results.append("No source");
- }
- results.append("]");
- }
- }
- if (showAccuracy) {
- results.append(" ");
- switch (accuracy) {
- case EXACT_MATCH:
- results.append("EXACT_MATCH");
- break;
- case POTENTIAL_MATCH:
- results.append("POTENTIAL_MATCH");
- break;
- }
- }
- } catch (JavaModelException e) {
- results.append("\n");
- results.append(e.toString());
- }
- }
- public void done() {
- }
- public IProgressMonitor getProgressMonitor() {
- return null;
- }
- public String toString() {
- return results.toString();
- }
-}
-public JavaSearchTests(String name) {
- super(name);
-}
-private IJavaSearchScope getJavaSearchScope() {
- return SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("JavaSearch")});
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("JavaSearch");
-}
-public void tearDownSuite() throws Exception {
- deleteProject("JavaSearch");
-
- super.tearDownSuite();
-}
-
-
-public static Test suite() {
- TestSuite suite = new Suite(JavaSearchTests.class.getName());
-
- if (false) {
- suite.addTest(new JavaSearchTests("testTypeOccurence2"));
- return suite;
- }
-
- // package declaration
- suite.addTest(new JavaSearchTests("testSimplePackageDeclaration"));
- suite.addTest(new JavaSearchTests("testVariousPackageDeclarations"));
-
- // package reference
- suite.addTest(new JavaSearchTests("testSimplePackageReference"));
- suite.addTest(new JavaSearchTests("testPackageReference1"));
- suite.addTest(new JavaSearchTests("testPackageReference2"));
- suite.addTest(new JavaSearchTests("testVariousPackageReference"));
- suite.addTest(new JavaSearchTests("testAccuratePackageReference"));
- suite.addTest(new JavaSearchTests("testPatternMatchPackageReference"));
-
- // type declaration
- suite.addTest(new JavaSearchTests("testSimpleTypeDeclaration"));
- suite.addTest(new JavaSearchTests("testTypeDeclaration"));
- suite.addTest(new JavaSearchTests("testTypeDeclarationInJar"));
- suite.addTest(new JavaSearchTests("testTypeDeclarationInJar2"));
- suite.addTest(new JavaSearchTests("testTypeDeclarationInPackageScope"));
- suite.addTest(new JavaSearchTests("testTypeDeclarationInPackageScope2"));
- suite.addTest(new JavaSearchTests("testMemberTypeDeclaration"));
- suite.addTest(new JavaSearchTests("testPatternMatchTypeDeclaration"));
- suite.addTest(new JavaSearchTests("testLongDeclaration"));
-
- // type reference
- suite.addTest(new JavaSearchTests("testSimpleTypeReference"));
- suite.addTest(new JavaSearchTests("testTypeReference1"));
- suite.addTest(new JavaSearchTests("testTypeReference2"));
- suite.addTest(new JavaSearchTests("testTypeReference3"));
- suite.addTest(new JavaSearchTests("testTypeReference4"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInInitializer"));
- suite.addTest(new JavaSearchTests("testTypeReferenceAsSingleNameReference"));
- suite.addTest(new JavaSearchTests("testMemberTypeReference"));
- suite.addTest(new JavaSearchTests("testMemberTypeReference2"));
- suite.addTest(new JavaSearchTests("testObjectMemberTypeReference"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInQualifiedNameReference"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInQualifiedNameReference2"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInQualifiedNameReference3"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInQualifiedNameReference4"));
- suite.addTest(new JavaSearchTests("testTypeReferenceNotInClasspath"));
- suite.addTest(new JavaSearchTests("testVariousTypeReferences"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInImport"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInImport2"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInArray"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInArray2"));
- suite.addTest(new JavaSearchTests("testNegativeTypeReference"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInThrows"));
- suite.addTest(new JavaSearchTests("testInnacurateTypeReference1"));
- suite.addTest(new JavaSearchTests("testInnacurateTypeReference2"));
- suite.addTest(new JavaSearchTests("testInnacurateTypeReference3"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInCast"));
- suite.addTest(new JavaSearchTests("testPatternMatchTypeReference"));
- suite.addTest(new JavaSearchTests("testTypeReferenceNotCaseSensitive"));
- suite.addTest(new JavaSearchTests("testAccurateTypeReference"));
- suite.addTest(new JavaSearchTests("testTypeReferenceInHierarchy"));
- suite.addTest(new JavaSearchTests("testTypeReferenceWithRecovery"));
-
- // type occurences
- suite.addTest(new JavaSearchTests("testTypeOccurence"));
- suite.addTest(new JavaSearchTests("testTypeOccurence2"));
- suite.addTest(new JavaSearchTests("testTypeOccurenceWithDollar"));
-
- // interface implementor
- suite.addTest(new JavaSearchTests("testInterfaceImplementors"));
- suite.addTest(new JavaSearchTests("testInterfaceImplementors2"));
-
- // method declaration
- suite.addTest(new JavaSearchTests("testSimpleMethodDeclaration"));
- suite.addTest(new JavaSearchTests("testSimpleConstructorDeclaration"));
- suite.addTest(new JavaSearchTests("testInnerMethodDeclaration"));
- suite.addTest(new JavaSearchTests("testMethodDeclarationInHierarchyScope1"));
- suite.addTest(new JavaSearchTests("testMethodDeclarationInHierarchyScope2"));
- suite.addTest(new JavaSearchTests("testMethodDeclarationInHierarchyScope3"));
- suite.addTest(new JavaSearchTests("testMethodDeclarationInPackageScope"));
- suite.addTest(new JavaSearchTests("testMethodDeclarationInJar"));
- suite.addTest(new JavaSearchTests("testConstructorDeclarationInJar"));
- suite.addTest(new JavaSearchTests("testMethodDeclarationInInitializer"));
-
- // method reference
- suite.addTest(new JavaSearchTests("testSimpleMethodReference"));
- suite.addTest(new JavaSearchTests("testStaticMethodReference1"));
- suite.addTest(new JavaSearchTests("testStaticMethodReference2"));
- suite.addTest(new JavaSearchTests("testInnerMethodReference"));
- suite.addTest(new JavaSearchTests("testMethodReferenceThroughSuper"));
- suite.addTest(new JavaSearchTests("testMethodReferenceInInnerClass"));
- suite.addTest(new JavaSearchTests("testMethodReferenceInAnonymousClass"));
- suite.addTest(new JavaSearchTests("testMethodReferenceThroughArray"));
- suite.addTest(new JavaSearchTests("testMethodReference1"));
- suite.addTest(new JavaSearchTests("testMethodReference2"));
- suite.addTest(new JavaSearchTests("testMethodReference3"));
- suite.addTest(new JavaSearchTests("testMethodReference4"));
-
- // constructor reference
- suite.addTest(new JavaSearchTests("testSimpleConstructorReference1"));
- suite.addTest(new JavaSearchTests("testSimpleConstructorReference2"));
- suite.addTest(new JavaSearchTests("testConstructorReferenceExplicitConstructorCall1"));
- suite.addTest(new JavaSearchTests("testConstructorReferenceExplicitConstructorCall2"));
- suite.addTest(new JavaSearchTests("testConstructorReferenceImplicitConstructorCall1"));
- suite.addTest(new JavaSearchTests("testConstructorReferenceImplicitConstructorCall2"));
- suite.addTest(new JavaSearchTests("testConstructorReferenceInFieldInitializer"));
-
- // field declaration
- suite.addTest(new JavaSearchTests("testSimpleFieldDeclaration"));
- suite.addTest(new JavaSearchTests("testFieldDeclarationInJar"));
- suite.addTest(new JavaSearchTests("testFieldDeclarationArrayType"));
- suite.addTest(new JavaSearchTests("testFieldDeclarationWithWildCard"));
-
- // field reference
- suite.addTest(new JavaSearchTests("testSimpleFieldReference"));
- suite.addTest(new JavaSearchTests("testSimpleReadFieldReference"));
- suite.addTest(new JavaSearchTests("testSimpleWriteFieldReference"));
- suite.addTest(new JavaSearchTests("testMultipleFieldReference"));
- suite.addTest(new JavaSearchTests("testStaticFieldReference"));
- suite.addTest(new JavaSearchTests("testFieldReference"));
- suite.addTest(new JavaSearchTests("testFieldReference2"));
- suite.addTest(new JavaSearchTests("testFieldReference3"));
- suite.addTest(new JavaSearchTests("testFieldReference4"));
- suite.addTest(new JavaSearchTests("testFieldReference5"));
- suite.addTest(new JavaSearchTests("testFieldReference6"));
- suite.addTest(new JavaSearchTests("testFieldReferenceInInnerClass"));
- suite.addTest(new JavaSearchTests("testFieldReferenceInAnonymousClass"));
- suite.addTest(new JavaSearchTests("testFieldReferenceThroughSubclass"));
- suite.addTest(new JavaSearchTests("testReadWriteFieldReferenceInCompoundExpression"));
- suite.addTest(new JavaSearchTests("testReadWriteAccessInQualifiedNameReference"));
- suite.addTest(new JavaSearchTests("testFieldReferenceInBrackets"));
- suite.addTest(new JavaSearchTests("testAccurateFieldReference1"));
-
- // or pattern
- suite.addTest(new JavaSearchTests("testOrPattern"));
-
- // declarations of accessed fields
- suite.addTest(new JavaSearchTests("testDeclarationOfAccessedFields1"));
- suite.addTest(new JavaSearchTests("testDeclarationOfAccessedFields2"));
- suite.addTest(new JavaSearchTests("testDeclarationOfAccessedFields3"));
-
- // declarations of referenced types
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes1"));
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes2"));
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes3"));
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes4"));
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes5"));
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes6"));
- suite.addTest(new JavaSearchTests("testDeclarationOfReferencedTypes7"));
-
- // declarations of sent messages
- suite.addTest(new JavaSearchTests("testSimpleDeclarationsOfSentMessages"));
- suite.addTest(new JavaSearchTests("testDeclarationOfSentMessages"));
-
- // potential match in binary
- suite.addTest(new JavaSearchTests("testPotentialMatchInBinary"));
-
- // core exception
- suite.addTest(new JavaSearchTests("testCoreException"));
-
- // search scopes
- suite.addTest(new JavaSearchTests("testHierarchyScope"));
- suite.addTest(new JavaSearchTests("testSubCUSearchScope1"));
- suite.addTest(new JavaSearchTests("testSubCUSearchScope2"));
- suite.addTest(new JavaSearchTests("testSubCUSearchScope3"));
- suite.addTest(new JavaSearchTests("testExternalJarScope"));
-
- return suite;
-}
-/**
- * Type reference test.
- */
-public void testAccurateFieldReference1() throws CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "d6.X.CONSTANT",
- FIELD,
- REFERENCES,
- SearchEngine.createJavaSearchScope(new IJavaElement[] {
- getPackageFragment("JavaSearch", "src", "d6")
- }),
- resultCollector);
- assertEquals(
- "src/d6/Y.java d6.Y.T [CONSTANT]",
- resultCollector.toString());
-}
-/**
- * Regression test for 1GBK7B2: ITPJCORE:WINNT - package references: could be more precise
- */
-public void testAccuratePackageReference() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "p3.p2");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pkg,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/PackageReference/K.java [p3.p2]",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- */
-public void testAccurateTypeReference() throws CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "d5.X",
- TYPE,
- REFERENCES,
- SearchEngine.createJavaSearchScope(new IJavaElement[] {
- getPackageFragment("JavaSearch", "src", "d5")
- }),
- resultCollector);
- assertEquals(
- "src/d5/Y.java d5.Y.T [d5.X]\n" +
- "src/d5/Y.java d5.Y.c [d5.X]\n" +
- "src/d5/Y.java d5.Y.o [d5.X]",
- resultCollector.toString());
-}
-/**
- * Constructor declaration in jar file test.
- */
-public void testConstructorDeclarationInJar() throws JavaModelException, CoreException {
- IType type = getClassFile("JavaSearch", "MyJar.jar", "p1", "A.class").getType();
- IMethod method = type.getMethod("A", new String[] {"Ljava.lang.String;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "MyJar.jar p1.A(java.lang.String) [No source]",
- resultCollector.toString());
-}
-/**
- * Constructor reference using an explicit constructor call.
- */
-public void testConstructorReferenceExplicitConstructorCall1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "Y.java").getType("Y");
- IMethod method = type.getMethod("Y", new String[] {"I"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/Z.java p.Z(int) [super(i)]",
- resultCollector.toString());
-}
-/**
- * Constructor reference using an explicit constructor call.
- */
-public void testConstructorReferenceExplicitConstructorCall2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IMethod method = type.getMethod("X", new String[] {"I"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/Y.java p.Y(int) [super(i)]\n" +
- "src/p/Y.java p.Y(boolean) [super(1)]",
- resultCollector.toString());
-}
-/**
- * Constructor reference using an implicit constructor call.
- * (regression test for bug 23112 search: need a way to search for references to the implicit non-arg constructor)
- */
-public void testConstructorReferenceImplicitConstructorCall1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "c7", "X.java").getType("X");
- IMethod method = type.getMethod("X", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/c7/Y.java c7.Y() [Y]",
- resultCollector.toString());
-}
-/**
- * Constructor reference using an implicit constructor call.
- * (regression test for bug 23112 search: need a way to search for references to the implicit non-arg constructor)
- */
-public void testConstructorReferenceImplicitConstructorCall2() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "c8.X()",
- CONSTRUCTOR,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/c8/Y.java c8.Y [Y]",
- resultCollector.toString());
-}
-/**
- * Constructor reference in a field initializer.
- * (regression test for PR 1GKZ8VZ: ITPJCORE:WINNT - Search - did not find references to member constructor)
- */
-public void testConstructorReferenceInFieldInitializer() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "A.java").getType("A").getType("Inner");
- IMethod method = type.getMethod("Inner", new String[] {"I"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/A.java A.field [new Inner(1)]\n" +
- "src/A.java A.field [new Inner(2)]",
- resultCollector.toString());
-}
-/**
- * CoreException thrown during accept.
- * (regression test for PR #1G3UI7A)
- */
-public void testCoreException() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IJavaSearchResultCollector resultCollector = new IJavaSearchResultCollector() {
- public void accept(IResource resource, int start, int end, IJavaElement enclosingElement, int accuracy) throws CoreException {
- throw new CoreException(new JavaModelStatus(-1, "test"));
- }
- public void aboutToStart() {}
- public void done() {}
- public IProgressMonitor getProgressMonitor() {
- return null;
- }
- };
- try {
- new SearchEngine().search(
- getWorkspace(),
- type,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- } catch (JavaModelException e) {
- Throwable wrappedException = e.getException();
- assertTrue("Unexpected wrapped exception", wrappedException instanceof CoreException);
- assertEquals("Unexpected CoreException has been thrown", "test", ((CoreException)wrappedException).getStatus().getMessage());
- return;
- }
- assertTrue("CoreException should have been thrown", false);
-}
-/**
- * Declaration of accessed fields test.
- * (regression test for bug 6538 searchDeclarationsOf* incorrect)
- */
-public void testDeclarationOfAccessedFields1() throws JavaModelException, CoreException {
- IMethod method =
- getCompilationUnit("JavaSearch", "src", "a5", "B.java").
- getType("C").getMethod("i", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfAccessedFields(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "",
- resultCollector.toString());
-}
-/**
- * Declaration of accessed fields test.
- * (regression test for bug 6538 searchDeclarationsOf* incorrect)
- */
-public void testDeclarationOfAccessedFields2() throws JavaModelException, CoreException {
- IMethod method =
- getCompilationUnit("JavaSearch", "src", "a6", "A.java").
- getType("B").getMethod("m", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfAccessedFields(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "src/a6/A.java a6.B.f [f]",
- resultCollector.toString());
-}
-/**
- * Declaration of accessed fields test.
- * (regression test for bug 10386 NPE in MatchLocator.lookupType)
- */
-public void testDeclarationOfAccessedFields3() throws JavaModelException, CoreException {
- IMethod method =
- getCompilationUnit("JavaSearch", "src", "b6", "A.java").
- getType("A").getMethod("foo", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfAccessedFields(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "src/b6/A.java b6.A.field [field]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- */
-public void testDeclarationOfReferencedTypes1() throws JavaModelException, CoreException {
- IMethod method =
- getCompilationUnit("JavaSearch", "src", "a3", "References.java").
- getType("References").getMethod("foo", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "src/a3/X.java a3.X [X]\n" +
- "src/a3/Z.java a3.Z [Z]\n" +
- "src/a3/b/A.java a3.b.A [A]\n" +
- "src/a3/b/A.java a3.b.A$B$C [C]\n" +
- "src/a3/b/A.java a3.b.A$B [B]\n" +
- getExternalJCLPathString() + " java.lang.Object\n" +
- "src/a3/Y.java a3.Y [Y]\n" +
- "src/a3/b/B.java a3.b.B [B]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 6779 searchDeclarationsOfReferencedTyped - missing exception types)
- */
-public void testDeclarationOfReferencedTypes2() throws CoreException {
- IMethod method =
- getCompilationUnit("JavaSearch", "src", "a7", "X.java").
- getType("X").getMethod("foo", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "src/a7/X.java a7.MyException [MyException]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 12649 Missing import after move )
- */
-public void testDeclarationOfReferencedTypes3() throws CoreException {
- ICompilationUnit unit = getCompilationUnit("JavaSearch", "src", "c1", "A.java");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- unit,
- resultCollector
- );
- assertEquals(
- "src/c1/I.java c1.I [I]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 12649 Missing import after move )
- */
-public void testDeclarationOfReferencedTypes4() throws CoreException {
- ICompilationUnit unit = getCompilationUnit("JavaSearch", "src", "c1", "B.java");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- unit,
- resultCollector
- );
- assertEquals(
- "src/c1/I.java c1.I [I]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 18418 search: searchDeclarationsOfReferencedTypes reports import declarations)
- */
-public void testDeclarationOfReferencedTypes5() throws CoreException {
- ICompilationUnit unit = getCompilationUnit("JavaSearch", "src", "c2", "A.java");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- unit,
- resultCollector
- );
- assertEquals(
- "src/c3/C.java c3.C [C]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 24934 Move top level doesn't optimize the imports[refactoring])
- */
-public void testDeclarationOfReferencedTypes6() throws CoreException {
- ICompilationUnit unit = getCompilationUnit("JavaSearch", "src", "d1", "X.java");
- IType innerType = unit.getType("X").getType("Inner");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- innerType,
- resultCollector
- );
- assertEquals(
- "src/d2/Y.java d2.Y [Y]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 37438 searchenging NPE in searchDeclarationsOfReferencedTypes
-)
- */
-public void testDeclarationOfReferencedTypes7() throws CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "r7");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- pkg,
- resultCollector
- );
- assertEquals(
- "",
- resultCollector.toString());
-}
-
-/**
- * Declaration of sent messages test.
- * (regression test for bug 6538 searchDeclarationsOf* incorrect)
- */
-public void testDeclarationOfSentMessages() throws JavaModelException, CoreException {
- IMethod method =
- getCompilationUnit("JavaSearch", "src", "a5", "B.java").
- getType("C").getMethod("i", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfSentMessages(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "",
- resultCollector.toString());
-}
-/**
- * Java search scope on java element in external jar test.
- */
-public void testExternalJarScope() throws CoreException, IOException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- File workspaceLocation = new File(workspace.getRoot().getLocation().toOSString());
- File minimalJar = new File(workspaceLocation, "JavaSearch/MyJar.jar");
- File externalJar = new File(workspaceLocation.getParentFile(), "MyJar.jar");
- IJavaProject project = this.getJavaProject("JavaSearch");
- IClasspathEntry[] classpath = project.getRawClasspath();
- try {
- copy(minimalJar, externalJar);
- int length = classpath.length;
- IClasspathEntry[] newClasspath = new IClasspathEntry[length];
- System.arraycopy(classpath, 0, newClasspath, 0, length-1);
- String externalPath = externalJar.getAbsolutePath();
- newClasspath[length-1] = JavaCore.newLibraryEntry(new Path(externalPath), new Path(externalPath), null, false);
- project.setRawClasspath(newClasspath, null);
-
- IPackageFragment pkg = this.getPackageFragment("JavaSearch", externalPath, "p0");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {pkg});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- workspace,
- "X",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- externalJar.getCanonicalPath()+ " p0.X",
- resultCollector.toString());
-
- IClassFile classFile = pkg.getClassFile("X.class");
- scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {classFile});
- resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- workspace,
- classFile.getType(),
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- externalJar.getCanonicalPath()+ " p0.X",
- resultCollector.toString());
-
- } finally {
- externalJar.delete();
- project.setRawClasspath(classpath, null);
- }
-
-}
-
-
-/**
- * Field declaration with array type test.
- * (regression test for PR 1GKEG73: ITPJCORE:WIN2000 - search (136): missing field declaration)
- */
-public void testFieldDeclarationArrayType() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "B.java").getType("B");
- IField field = type.getField("open");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/B.java B.open [open]",
- resultCollector.toString());
-}
-/**
- * Field declaration in jar file test.
- */
-public void testFieldDeclarationInJar() throws JavaModelException, CoreException {
- IType type = getClassFile("JavaSearch", "MyJar.jar", "p1", "A.class").getType();
- IField field = type.getField("field");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "MyJar.jar p1.A.field [No source]",
- resultCollector.toString());
-}
-/**
- * Field declaration with wild card test.
- * (regression test for bug 21763 Problem in Java search [search] )
- */
-public void testFieldDeclarationWithWildCard() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "class*path",
- FIELD,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/c5/Test.java c5.Test.class_path [class_path]",
- resultCollector.toString());
-}
-/**
- * Multiple field references in one ast test.
- * (regression test for PR 1GD79XM: ITPJCORE:WINNT - Search - search for field references - not all found)
- */
-public void testMultipleFieldReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p5", "A.java").getType("A");
- IField field = type.getField("x");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p5/A.java p5.A.k() -> void [x]\n" +
- "src/p5/A.java p5.A.k() -> void [x]\n" +
- "src/p5/A.java p5.A.k() -> void [x]",
- resultCollector.toString());
-}
-/**
- * Field reference in inner class test.
- * (regression test for PR 1GL11J6: ITPJCORE:WIN2000 - search: missing field references (nested types))
- */
-public void testFieldReferenceInInnerClass() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "O.java").getType("O");
- IField field = type.getField("y");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/O.java O$I.y() -> void [y]",
- resultCollector.toString());
-}
-/**
- * Field reference test.
- * (regression test for bug #3433 search: missing field occurrecnces (1GKZ8J6))
- */
-public void testFieldReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p8", "A.java").getType("A");
- IField field = type.getField("g");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p8/A.java p8.A.m() -> void [g]\n" +
- "src/p8/A.java p8.B.m() -> void [g]",
- resultCollector.toString());
-}
-/**
- * Field reference test.
- * (regression test for PR 1GK8TXE: ITPJCORE:WIN2000 - search: missing field reference)
- */
-public void testFieldReference2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p9", "X.java").getType("X");
- IField field = type.getField("f");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p9/X.java p9.X.m() -> void [f]",
- resultCollector.toString());
-}
-/**
- * Field reference test.
- * (regression test for bug 5821 Refactor > Rename renames local variable instead of member in case of name clash )
- */
-public void testFieldReference3() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "q8", "EclipseTest.java").getType("EclipseTest");
- IField field = type.getField("test");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q8/EclipseTest.java q8.EclipseTest.main(String[]) -> void [test]",
- resultCollector.toString());
-}
-/**
- * Field reference test.
- * (regression test for bug 5923 Search for "length" field refs finds [].length)
- */
-public void testFieldReference4() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "a2", "X.java").getType("X");
- IField field = type.getField("length");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/a2/X.java a2.X.foo() -> void [length]",
- resultCollector.toString());
-}
-/**
- * Field reference test.
- * (regression test for bug 7987 Field reference search should do lookup in 1.4 mode)
- */
-public void testFieldReference5() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "b1", "A.java").getType("A");
- IField field = type.getField("x");
-
- // Set 1.4 compliance level (no constant yet)
- Hashtable options = JavaCore.getOptions();
- String currentOption = (String)options.get("org.eclipse.jdt.core.compiler.compliance");
- options.put("org.eclipse.jdt.core.compiler.compliance", "1.4");
- JavaCore.setOptions(options);
-
- try {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/b1/B.java b1.B.foo() -> void [x]",
- resultCollector.toString());
- } finally {
- // Restore compliance level
- options.put("org.eclipse.jdt.core.compiler.compliance", currentOption);
- JavaCore.setOptions(options);
- }
-}
-/**
- * Field reference test.
- * (regression test for bug 20693 Finding references to variables does not find all occurances)
- */
-public void testFieldReference6() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "c4", "X.java").getType("X");
- IField field = type.getField("x");
-
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/c4/X.java c4.X.foo() -> int [x]",
- resultCollector.toString());
-}
-/**
- * Field reference in anonymous class test.
- * (regression test for PR 1GL12XE: ITPJCORE:WIN2000 - search: missing field references in inner class)
- */
-public void testFieldReferenceInAnonymousClass() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "D.java").getType("D");
- IField field = type.getField("h");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/D.java D.g() -> void [h]",
- resultCollector.toString());
-}
-/**
- * Field reference in brackets test.
- * (regression test for bug 23329 search: incorrect range for type references in brackets)
- */
-public void testFieldReferenceInBrackets() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "s3", "A.java").getType("A");
- IField field = type.getField("field");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/s3/A.java s3.A.bar() -> int [field]",
- resultCollector.toString());
-}
-/**
- * Field reference through subclass test.
- * (regression test for PR 1GKB9YH: ITPJCORE:WIN2000 - search for field refs - incorrect results)
- */
-public void testFieldReferenceThroughSubclass() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p6", "A.java").getType("A");
- IField field = type.getField("f");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p6/A.java p6.A.m() -> void [f]\n" +
- "src/p6/A.java p6.B.m() -> void [f]\n" +
- "src/p6/A.java p6.B.m() -> void [f]",
- resultCollector.toString());
-
- type = getCompilationUnit("JavaSearch", "src", "p6", "A.java").getType("AA");
- field = type.getField("f");
- resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p6/A.java p6.B.m() -> void [f]",
- resultCollector.toString());
-
-}
-/**
- * Hierarchy scope test.
- * (regression test for bug 3445 search: type hierarchy scope incorrect (1GLC8VS))
- */
-public void testHierarchyScope() throws JavaModelException, CoreException {
- ICompilationUnit cu = this. getCompilationUnit("JavaSearch", "src", "a9", "A.java");
- IType type = cu.getType("C");
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- assertTrue("a9.C should be included in hierarchy scope", scope.encloses(type));
- assertTrue("a9.A should be included in hierarchy scope", scope.encloses(cu.getType("A")));
- assertTrue("a9.B should be included in hierarchy scope", scope.encloses(cu.getType("B")));
- assertTrue("a9/A.java should be included in hierarchy scope", scope.encloses(cu.getUnderlyingResource().getFullPath().toString()));
-}
-/**
- * Type reference test.
- * (Regression test for bug 9642 Search - missing inaccurate type matches)
- */
-public void testInnacurateTypeReference1() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "Zork",
- TYPE,
- REFERENCES,
- SearchEngine.createJavaSearchScope(new IJavaElement[] {
- getPackageFragment("JavaSearch", "src", "b5")
- }),
- resultCollector);
- assertEquals(
- "src/b5/A.java [Zork]\n" +
- "src/b5/A.java b5.A.{} [Zork]\n" +
- "src/b5/A.java b5.A.{} [Zork]\n" +
- "src/b5/A.java b5.A.{} [Zork]",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- * (Regression test for bug 9642 Search - missing inaccurate type matches)
- */
-public void testInnacurateTypeReference2() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "p.Zork",
- TYPE,
- REFERENCES,
- SearchEngine.createJavaSearchScope(new IJavaElement[] {
- getPackageFragment("JavaSearch", "src", "b5")
- }),
- resultCollector);
- assertEquals(
- "src/b5/A.java b5.A.{} [Zork]\n" +
- "src/b5/A.java b5.A.{} [Zork]\n" +
- "src/b5/A.java b5.A.{} [Zork]",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- * (Regression test for bug 21485 NPE when doing a reference search to a package)
- */
-public void testInnacurateTypeReference3() throws CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "r3", "A21485.java").getType("A21485");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/r4/B21485.java [A21485] POTENTIAL_MATCH\n" +
- "src/r4/B21485.java r4.B21485 [A21485] POTENTIAL_MATCH",
- resultCollector.toString());
-}
-
-
-/**
- * Inner method declaration test.
- */
-public void testInnerMethodDeclaration() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X").getType("Inner");
- IMethod method = type.getMethod("foo", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/X.java p.X$Inner.foo() -> String [foo]",
- resultCollector.toString());
-}
-/**
- * Inner method reference test.
- */
-public void testInnerMethodReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X").getType("Inner");
- IMethod method = type.getMethod("foo", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/A.java p.A.foo(int, String, X) -> void [foo()]",
- resultCollector.toString());
-}
-/**
- * Interface implementors test.
- */
-public void testInterfaceImplementors() throws JavaModelException, CoreException {
- // implementors of an interface
- IType type = getCompilationUnit("JavaSearch", "src", "p", "I.java").getType("I");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- IMPLEMENTORS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/InterfaceImplementors.java InterfaceImplementors [p.I]\n" +
- "src/p/X.java p.X [I]",
- resultCollector.toString());
-
- // implementors of a class should give no match
- // (regression test for 1G5HBQA: ITPJUI:WINNT - Search - search for implementors of a class finds subclasses)
- type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- IMPLEMENTORS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-}
-/**
- * Interface implementors test.
- * (regression test for bug 22102 Not all implementors found for IPartListener)
- */
-public void testInterfaceImplementors2() throws JavaModelException, CoreException {
- // implementors of an interface
- IType type = getCompilationUnit("JavaSearch", "src", "r2", "I.java").getType("I");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- IMPLEMENTORS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/r2/X.java r2.X.field [I]",
- resultCollector.toString());
-}
-/**
- * Long declaration (>255) test.
- * (regression test for bug 25859 Error doing Java Search)
- */
-public void testLongDeclaration() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyz",
- TYPE,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/c9/X.java c9.AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyz [AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyz]",
- resultCollector.toString());
-}
-/**
- * Memeber type declaration test.
- * (regression test for bug 9992 Member class declaration not found)
- */
-public void testMemberTypeDeclaration() throws JavaModelException, CoreException {
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[]{
- this.getPackageFragment("JavaSearch", "src", "b4")
- });
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "*.A.B",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "src/b4/A.java b4.A$B [B]",
- resultCollector.toString());
-}
-/**
- * Member type reference test.
- */
-public void testMemberTypeReference() throws JavaModelException, CoreException {
- // references to second level member type
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- "BMember",
- TYPE,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "References to type BMember",
- "src/MemberTypeReference/Azz.java MemberTypeReference.Azz.poo() -> void [B.BMember] EXACT_MATCH\n" +
- "src/MemberTypeReference/Azz.java MemberTypeReference.Azz$AzzMember [BMember] EXACT_MATCH\n" +
- "src/MemberTypeReference/Azz.java MemberTypeReference.X.val [Azz.AzzMember.BMember] EXACT_MATCH\n" +
- "src/MemberTypeReference/B.java MemberTypeReference.B.foo() -> void [Azz.AzzMember.BMember] EXACT_MATCH",
- resultCollector.toString());
-
- // references to first level member type
- resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- "AzzMember",
- TYPE,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "References to type AzzMember",
- "src/MemberTypeReference/Azz.java MemberTypeReference.X.val [Azz.AzzMember] EXACT_MATCH\n" +
- "src/MemberTypeReference/B.java MemberTypeReference.B.foo() -> void [Azz.AzzMember] EXACT_MATCH",
- resultCollector.toString());
-
- // no reference to a field with same name as member type
- resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- "BMember",
- FIELD,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "References to field BMember",
- "",
- resultCollector.toString());
-}
-/**
- * Member type reference test.
- * (regression test for PR 1GL0MN9: ITPJCORE:WIN2000 - search: not consistent results for nested types)
- */
-public void testMemberTypeReference2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "a", "A.java").getType("A").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/a/A.java a.B.ax [A.X]\n" +
- "src/a/A.java a.B.sx [S.X]",
- resultCollector.toString());
-}
-/**
- * Method declaration in hierarchy test.
- */
-public void testMethodDeclarationInHierarchyScope1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "foo",
- METHOD,
- DECLARATIONS,
- SearchEngine.createHierarchyScope(type),
- resultCollector);
- assertEquals(
- "src/p/X.java p.X.foo(int, String, X) -> void [foo]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [foo]",
- resultCollector.toString());
-}
-/**
- * Method declaration in hierarchy that contains elements in external jar.
- * (regression test for PR #1G2E4F1)
- */
-public void testMethodDeclarationInHierarchyScope2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IMethod method = type.getMethod("foo", new String[] {"I", "QString;", "QX;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- DECLARATIONS,
- SearchEngine.createHierarchyScope(type), // java.lang.Object is in external jcl
- resultCollector);
- assertEquals(
- "src/p/X.java p.X.foo(int, String, X) -> void [foo]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [foo]",
- resultCollector.toString());
-}
-/**
- * Method declaration in hierarchy on a secondary type.
- */
-public void testMethodDeclarationInHierarchyScope3() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "d3", "A.java").getType("B");
- IMethod method = type.getMethod("foo", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- DECLARATIONS,
- SearchEngine.createHierarchyScope(type),
- resultCollector);
- assertEquals(
- "src/d3/A.java d3.B.foo() -> void [foo]",
- resultCollector.toString());
-}
-/**
- * Method declaration in field initialzer.
- * (regression test for bug 24346 Method declaration not found in field initializer )
- */
-public void testMethodDeclarationInInitializer() throws CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "foo24346",
- METHOD,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/c6/X.java c6.X.x [foo24346]",
- resultCollector.toString());
-}
-/**
- * Method declaration in jar file test.
- */
-public void testMethodDeclarationInJar() throws JavaModelException, CoreException {
- IType type = getClassFile("JavaSearch", "MyJar.jar", "p1", "A.class").getType();
- IMethod method = type.getMethod("foo", new String[] {"Ljava.lang.String;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- // System.out.println(displayString(resultCollector.toString(), 2));
- assertEquals(
- "MyJar.jar p1.A.foo(java.lang.String) -> boolean [No source]",
- resultCollector.toString());
-}
-/**
- * Method declaration in package test.
- * (regression tets for PR #1G2KA97)
- */
-public void testMethodDeclarationInPackageScope() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type.getPackageFragment()});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "main(String[])",
- METHOD,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "src/p/A.java p.A.main(String[]) -> void [main]",
- resultCollector.toString());
-}
-/**
- * Type declaration using a package scope test.
- * (check that subpackages are not included)
- */
-public void testTypeDeclarationInPackageScope() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p3", "X.java").getType("X");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type.getPackageFragment()});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "X",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "src/p3/X.java p3.X [X]",
- resultCollector.toString());
-}
-/**
- * Type declaration using a binary package scope test.
- * (check that subpackages are not included)
- */
-public void testTypeDeclarationInPackageScope2() throws JavaModelException, CoreException {
- IType type = getClassFile("JavaSearch", "MyJar.jar", "p0", "X.class").getType();
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type.getPackageFragment()});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getJavaProject("JavaSearch").getProject().getWorkspace(),
- "X",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "MyJar.jar p0.X [No source]",
- resultCollector.toString());
-}
-/**
- * Method reference through super test.
- */
-public void testMethodReferenceThroughSuper() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "sd", "AQ.java").getType("AQ");
- IMethod method = type.getMethod("k", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/sd/AQ.java sd.AQE.k() -> void [k()]",
- resultCollector.toString());
-}
-/**
- * Method reference test.
- * (regression test for bug 5068 search: missing method reference)
- */
-public void testMethodReference1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "q5", "AQ.java").getType("I");
- IMethod method = type.getMethod("k", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q5/AQ.java q5.T.m() -> void [k()]",
- resultCollector.toString());
-}
-/**
- * Method reference test.
- * (regression test for bug 5069 search: method reference in super missing)
- */
-public void testMethodReference2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "q6", "CD.java").getType("AQ");
- IMethod method = type.getMethod("k", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q6/CD.java q6.AQE.k() -> void [k()]",
- resultCollector.toString());
-}
-/**
- * Method reference test.
- * (regression test for bug 5070 search: missing interface method reference )
- */
-public void testMethodReference3() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "q7", "AQ.java").getType("I");
- IMethod method = type.getMethod("k", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q7/AQ.java q7.D.h() -> void [k()]",
- resultCollector.toString());
-}
-/**
- * Method reference test.
- * (regression test for bug 8928 Unable to find references or declarations of methods that use static inner classes in the signature)
- */
-public void testMethodReference4() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "b2", "Y.java").getType("Y");
- IMethod method = type.getMethod("foo", new String[] {"QX.Inner;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/b2/Z.java b2.Z.bar() -> void [foo(inner)]",
- resultCollector.toString());
-}
-/**
- * Method reference through array test.
- * (regression test for 1GHDA2V: ITPJCORE:WINNT - ClassCastException when doing a search)
- */
-public void testMethodReferenceThroughArray() throws JavaModelException, CoreException {
- IType type = getClassFile("JavaSearch", getExternalJCLPathString(), "java.lang", "Object.class").getType();
- IMethod method = type.getMethod("clone", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/E.java E.foo() -> Object [clone()]",
- resultCollector.toString());
-}
-/**
- * Method reference in inner class test.
- */
-public void testMethodReferenceInInnerClass() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "CA.java").getType("CA");
- IMethod method = type.getMethod("m", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/CA.java CA$CB.f() -> void [m()]\n" +
- "src/CA.java CA$CB$CC.f() -> void [m()]",
- resultCollector.toString());
-}
-/**
- * Method reference in anonymous class test.
- * (regression test for PR 1GGNOTF: ITPJCORE:WINNT - Search doesn't find method referenced in anonymous inner class)
- */
-public void testMethodReferenceInAnonymousClass() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "PR_1GGNOTF.java").getType("PR_1GGNOTF");
- IMethod method = type.getMethod("method", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/PR_1GGNOTF.java PR_1GGNOTF.method2() -> void [method()]",
- resultCollector.toString());
-}
-/**
- * Member type named "Object" reference test.
- * (regression test for 1G4GHPS: ITPJUI:WINNT - Strange error message in search)
- */
-public void testObjectMemberTypeReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "ObjectMemberTypeReference", "A.java")
- .getType("A")
- .getType("Object");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/ObjectMemberTypeReference/A.java ObjectMemberTypeReference.A.foo() -> void [Object] EXACT_MATCH",
- resultCollector.toString());
-}
-/**
- * OrPattern test.
- * (regression test for bug 5862 search : too many matches on search with OrPattern)
- */
-public void testOrPattern() throws CoreException {
- IMethod leftMethod = getCompilationUnit("JavaSearch", "src", "q9", "I.java")
- .getType("I").getMethod("m", new String[] {});
- ISearchPattern leftPattern = SearchEngine.createSearchPattern(leftMethod, ALL_OCCURRENCES);
- IMethod rightMethod = getCompilationUnit("JavaSearch", "src", "q9", "I.java")
- .getType("A1").getMethod("m", new String[] {});
- ISearchPattern rightPattern = SearchEngine.createSearchPattern(rightMethod, ALL_OCCURRENCES);
- ISearchPattern orPattern = SearchEngine.createOrSearchPattern(leftPattern, rightPattern);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- orPattern,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q9/I.java q9.I.m() -> void [m] EXACT_MATCH\n" +
- "src/q9/I.java q9.A1.m() -> void [m] EXACT_MATCH",
- resultCollector.toString());
-}
-/**
- * Package reference test.
- * (regression test for PR 1GK90H4: ITPJCORE:WIN2000 - search: missing package reference)
- */
-public void testPackageReference1() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "q2");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pkg,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q1/B.java q1.B.m(AA) -> void [q2]",
- resultCollector.toString());
-}
-/**
- * Package reference test.
- * (regression test for bug 17906 Rename package fails when inner classes are imported)
- */
-public void testPackageReference2() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "b8");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pkg,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/b9/Foo.java [b8]",
- resultCollector.toString());
-}
-
-/**
- * Test pattern match package references
- */
-public void testPatternMatchPackageReference() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "*p2.*",
- PACKAGE,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/PackageReference/A.java [p3.p2.p]\n" +
- "src/PackageReference/B.java [p3.p2.p]\n" +
- "src/PackageReference/C.java PackageReference.C [p3.p2.p]\n" +
- "src/PackageReference/D.java PackageReference.D.x [p3.p2.p]\n" +
- "src/PackageReference/E.java PackageReference.E.x [p3.p2.p]\n" +
- "src/PackageReference/F.java PackageReference.F.foo() -> p3.p2.p.X [p3.p2.p]\n" +
- "src/PackageReference/G.java PackageReference.G.foo(p3.p2.p.X) -> void [p3.p2.p]\n" +
- "src/PackageReference/H.java PackageReference.H.foo() -> void [p3.p2.p]\n" +
- "src/PackageReference/I.java PackageReference.I.foo() -> void [p3.p2.p]\n" +
- "src/PackageReference/J.java PackageReference.J.foo() -> void [p3.p2.p]",
- resultCollector.toString());
-}
-/**
- * Test pattern match type declaration
- * (regression test for bug 17210 No match found when query contains '?')
- */
-public void testPatternMatchTypeDeclaration() throws CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "X?Z",
- TYPE,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals("src/r5/XYZ.java r5.XYZ [XYZ]", resultCollector.toString());
-}
-/**
- * Test pattern match type reference in binary
- * (regression test for bug 24741 Search does not find patterned type reference in binary project )
- */
-public void testPatternMatchTypeReference() throws CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "p24741.*",
- TYPE,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "test24741.jar q24741.B",
- resultCollector.toString());
-}
-/**
- * Test that we find potential matches in binaries even if we can't resolve the entire
- * class file.
- * (Regression test for 1G4IN3E: ITPJCORE:WINNT - AbortCompilation using J9 to search for class declaration)
- */
-public void testPotentialMatchInBinary() throws JavaModelException, CoreException {
- IJavaProject project = this.getJavaProject("JavaSearch");
- IClasspathEntry[] classpath = project.getRawClasspath();
- try {
- // add AbortCompilation.jar to classpath
- int length = classpath.length;
- IClasspathEntry[] newClasspath = new IClasspathEntry[length+1];
- System.arraycopy(classpath, 0, newClasspath, 0, length);
- newClasspath[length] = JavaCore.newLibraryEntry(new Path("/JavaSearch/AbortCompilation.jar"), null, null);
- project.setRawClasspath(newClasspath, null);
-
- // potential match for a field declaration
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- "MissingFieldType.*",
- FIELD,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "AbortCompilation.jar AbortCompilation.MissingFieldType.field [No source] POTENTIAL_MATCH\n" +
- "AbortCompilation.jar AbortCompilation.MissingFieldType.missing [No source] POTENTIAL_MATCH\n" +
- "AbortCompilation.jar AbortCompilation.MissingFieldType.otherField [No source] POTENTIAL_MATCH",
- resultCollector.toString());
-
- // potential match for a method declaration
- resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- "MissingArgumentType.foo*",
- METHOD,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "AbortCompilation.jar AbortCompilation.MissingArgumentType.foo() -> void [No source] POTENTIAL_MATCH\n" +
- "AbortCompilation.jar AbortCompilation.MissingArgumentType.foo(java.util.EventListener) -> void [No source] POTENTIAL_MATCH\n" +
- "AbortCompilation.jar AbortCompilation.MissingArgumentType.foo2() -> void [No source] POTENTIAL_MATCH",
- resultCollector.toString());
-
- // potential match for a type declaration
- resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- "Missing*",
- TYPE,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "AbortCompilation.jar AbortCompilation.EnclosingType$MissingEnclosingType [No source] EXACT_MATCH\n" +
- "AbortCompilation.jar AbortCompilation.MissingArgumentType [No source] EXACT_MATCH\n" +
- "AbortCompilation.jar AbortCompilation.MissingFieldType [No source] EXACT_MATCH",
- resultCollector.toString());
- } finally {
- // reset classpath
- project.setRawClasspath(classpath, null);
- }
-}
-/**
- * Read and write access reference in compound expression test.
- * (regression test for bug 6158 Search - Prefix and postfix expression not found as write reference)
- */
-public void testReadWriteFieldReferenceInCompoundExpression() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "a4", "X.java").getType("X");
- IField field = type.getField("field");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
-
- // Read reference
- new SearchEngine().search(
- getWorkspace(),
- field,
- READ_ACCESSES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/a4/X.java a4.X.foo() -> void [field]",
- resultCollector.toString());
-
- // Write reference
- resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- WRITE_ACCESSES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/a4/X.java a4.X.foo() -> void [field]",
- resultCollector.toString());
-
-}
-/**
- * Simple constructor declaration test.
- */
-public void testSimpleConstructorDeclaration() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IMethod constructor = type.getMethod("A", new String[] {"QX;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- constructor,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals("src/p/A.java p.A(X) [A]", resultCollector.toString());
-}
-/**
- * Simple constructor reference test.
- */
-public void testSimpleConstructorReference1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IMethod constructor = type.getMethod("A", new String[] {"QX;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- constructor,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals("src/Test.java Test.main(String[]) -> void [new p.A(y)]", resultCollector.toString());
-}
-/**
- * Simple constructor reference test.
- */
-public void testSimpleConstructorReference2() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "p.A(X)",
- CONSTRUCTOR,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals("src/Test.java Test.main(String[]) -> void [new p.A(y)]", resultCollector.toString());
-}
-/**
- * Simple declarations of sent messages test.
- */
-public void testSimpleDeclarationsOfSentMessages() throws JavaModelException, CoreException {
- ICompilationUnit cu = getCompilationUnit("JavaSearch", "src", "", "Test.java");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfSentMessages(
- getWorkspace(),
- cu,
- resultCollector);
- assertEquals(
- "src/p/X.java p.X.foo(int, String, X) -> void [foo(int i, String s, X x)]\n" +
- "src/p/Y.java p.Y.bar() -> void [bar()]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [foo(int i, String s, X x)]\n" +
- "src/p/A.java p.A.foo(int, String, X) -> void [foo()]",
- resultCollector.toString());
-}
-/**
- * Simple field declaration test.
- */
-public void testSimpleFieldDeclaration() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IField field = type.getField("x");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/A.java p.A.x [x]",
- resultCollector.toString());
-}
-/**
- * Simple field reference test.
- */
-public void testSimpleFieldReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IField field = type.getField("x");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/Test.java Test.main(String[]) -> void [x]\n" +
- "src/p/A.java p.A(X) [x]",
- resultCollector.toString());
-}
-/**
- * Simple write field access reference test.
- */
-public void testSimpleWriteFieldReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IField field = type.getField("x");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- WRITE_ACCESSES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/A.java p.A(X) [x]",
- resultCollector.toString());
-}
-/**
- * Sub-cu java search scope test.
- * (regression test for bug 9041 search: cannot create a sub-cu scope)
- */
-public void testSubCUSearchScope1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "b3", "X.java").getType("X");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "src/b3/X.java b3.X.field [X]\n" +
- "src/b3/X.java b3.X.foo() -> Object [X]\n" +
- "src/b3/X.java b3.X$Y.field2 [X]\n" +
- "src/b3/X.java b3.X$Y.foo2() -> Object [X]",
- resultCollector.toString());
-}
-/**
- * Sub-cu java search scope test.
- * (regression test for bug 9041 search: cannot create a sub-cu scope)
- */
-public void testSubCUSearchScope2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "b3", "X.java").getType("X");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type.getField("field")});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "src/b3/X.java b3.X.field [X]",
- resultCollector.toString());
-}
-/**
- * Sub-cu java search scope test.
- * (regression test for bug 9041 search: cannot create a sub-cu scope)
- */
-public void testSubCUSearchScope3() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "b3", "X.java").getType("X");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type.getType("Y")});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "src/b3/X.java b3.X$Y.field2 [X]\n" +
- "src/b3/X.java b3.X$Y.foo2() -> Object [X]",
- resultCollector.toString());
-}
-/**
- * Type declaration test.
- * (regression test for bug 29524 Search for declaration via patterns adds '"*")
- */
-public void testTypeDeclaration() throws JavaModelException, CoreException {
- IPackageFragment pkg = this.getPackageFragment("JavaSearch", "src", "d8");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {pkg});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "A",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals("src/d8/A.java d8.A [A]", resultCollector.toString());
-}
-/**
- * Simple method declaration test.
- */
-public void testSimpleMethodDeclaration() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IMethod method = type.getMethod("foo", new String[] {"I", "QString;", "QX;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/X.java p.X.foo(int, String, X) -> void [foo]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [foo]",
- resultCollector.toString());
-}
-/**
- * Simple method reference test.
- */
-public void testSimpleMethodReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IMethod method = type.getMethod("foo", new String[] {"I", "QString;", "QX;"});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/Test.java Test.main(String[]) -> void [foo(1, \"a\", y)]\n" +
- "src/Test.java Test.main(String[]) -> void [foo(1, \"a\", z)]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [foo(i, s, new Y(true))]",
- resultCollector.toString());
-}
-/**
- * Simple package declaration test.
- */
-public void testSimplePackageDeclaration() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "p");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pkg,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p p",
- resultCollector.toString());
-}
-/**
- * Simple package reference test.
- */
-public void testSimplePackageReference() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "p");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pkg,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/InterfaceImplementors.java InterfaceImplementors [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/Test.java Test.main(String[]) -> void [p]\n" +
- "src/TypeReferenceInImport/X.java [p]",
- resultCollector.toString());
-}
-/**
- * Simple field read access reference test.
- */
-public void testSimpleReadFieldReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IField field = type.getField("x");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- READ_ACCESSES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/Test.java Test.main(String[]) -> void [x]",
- resultCollector.toString());
-}
-/**
- * Simple type declaration test.
- */
-public void testSimpleTypeDeclaration() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals("src/p/X.java p.X [X]", resultCollector.toString());
-}
-/**
- * Simple type reference test.
- */
-public void testSimpleTypeReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/A.java p.A.x [X]\n" +
- "src/p/A.java p.A(X) [X]\n" +
- "src/p/A.java p.A.foo(int, String, X) -> void [X]\n" +
- "src/p/X.java p.X() [X]\n" +
- "src/p/X.java p.X.foo(int, String, X) -> void [X]\n" +
- "src/p/Y.java p.Y [X]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [X]",
- resultCollector.toString());
-}
-/**
- * Static field reference test.
- * (regression test for PR #1G2P5EP)
- */
-public void testStaticFieldReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- IField field = type.getField("DEBUG");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/A.java p.A.foo() -> void [DEBUG]",
- resultCollector.toString());
-}
-/**
- * Static method reference test.
- */
-public void testStaticMethodReference1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "Y.java").getType("Y");
- IMethod method = type.getMethod("bar", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/Test.java Test.main(String[]) -> void [bar()]",
- resultCollector.toString());
-}
-/**
- * Static method reference test.
- */
-public void testStaticMethodReference2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- IMethod method = type.getMethod("bar", new String[] {});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- method,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-}
-/**
- * Type declaration in jar file test.
- */
-public void testTypeDeclarationInJar() throws JavaModelException, CoreException {
- IType type = getClassFile("JavaSearch", "MyJar.jar", "p1", "A.class").getType();
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "MyJar.jar p1.A [No source]",
- resultCollector.toString());
-}
-/**
- * Type declaration in jar file and in anonymous class test.
- * (regression test for 20631 Declaration of local binary type not found)
- */
-public void testTypeDeclarationInJar2() throws JavaModelException, CoreException {
- IPackageFragmentRoot root = getPackageFragmentRoot("JavaSearch", "test20631.jar");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {root});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "Y",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "test20631.jar X$1$Y",
- resultCollector.toString());
-}
-/**
- * Type ocurrence test.
- * (regression test for PR 1GKAQJS: ITPJCORE:WIN2000 - search: incorrect results for nested types)
- */
-public void testTypeOccurence() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "r", "A.java").getType("A").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- ALL_OCCURRENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/r/A.java r.A.m() -> A [X]\n" +
- "src/r/A.java r.A$X [X]\n" +
- "src/r/A.java r.A$X(X) [X]\n" +
- "src/r/A.java r.A$X(X) [X]\n" +
- "src/r/A.java r.B.ax [A.X]\n" +
- "src/r/A.java r.B.ax [X]",
- resultCollector.toString());
-}
-/**
- * Type ocuurence in unresolvable import test.
- * (regression test for bug 37166 NPE in SearchEngine when matching type against ProblemReferenceBinding )
- */
-public void testTypeOccurence2() throws CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "r8", "B.java").getType("B");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {type.getPackageFragment()});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- ALL_OCCURRENCES,
- scope,
- resultCollector);
- assertEquals(
- "src/r8/A.java [r8.B]",
- resultCollector.toString());
-}
-/**
- * Type name with $ ocurrence test.
- * (regression test for bug 3310 Smoke 124: Compile errors introduced with rename refactoring (1GFBK2G))
- */
-public void testTypeOccurenceWithDollar() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "q3", "A$B.java").getType("A$B");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- ALL_OCCURRENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/q3/A$B.java q3.A$B [A$B]\n" +
- "src/q4/C.java q4.C.foo() -> Object [q3.A$B]",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- * (Regression test for PR 1GK7K17: ITPJCORE:WIN2000 - search: missing type reference)
- */
-public void testTypeReference1() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "X.java").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/X.java AA() [X]",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- * (Regression test for bug 29516 SearchEngine regressions in 20030114)
- */
-public void testTypeReference2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "d7", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/d7/A.java d7.A.A [A]\n" +
- "src/d7/A.java d7.A.A(A) -> A [A]\n" +
- "src/d7/A.java d7.A.A(A) -> A [A]",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- * (Regression test for bug 31985 NPE searching non-qualified and case insensitive type ref)
- */
-public void testTypeReference3() throws JavaModelException, CoreException {
- ISearchPattern pattern = SearchEngine.createSearchPattern("x31985", TYPE, REFERENCES, false);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- pattern,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/e3/X31985.java e3.X31985.CONSTANT [X31985] EXACT_MATCH\n" +
- "src/e3/Y31985.java e3.Y31985.foo() -> Object [X31985] EXACT_MATCH",
- resultCollector.toString());
-}
-/**
- * Type reference test.
- * (Regression test for bug 31997 Refactoring d.n. work for projects with brackets in name.)
- */
-public void testTypeReference4() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "otherSrc()", "", "X31997.java").getType("X31997");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "otherSrc()/Y31997.java Y31997 [X31997]",
- resultCollector.toString());
-}
-/**
- * Type reference as a single name reference test.
- */
-public void testTypeReferenceAsSingleNameReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "TypeReferenceAsSingleNameReference.java").getType("TypeReferenceAsSingleNameReference");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/TypeReferenceAsSingleNameReference.java TypeReferenceAsSingleNameReference.hasReference() -> void [TypeReferenceAsSingleNameReference]\n" +
- "src/TypeReferenceAsSingleNameReference.java TypeReferenceAsSingleNameReference.hasReference() -> void [TypeReferenceAsSingleNameReference]",
- resultCollector.toString());
-}
-/**
- * Type reference in array test.
- * (regression test for PR #1GAL424)
- */
-public void testTypeReferenceInArray() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "TypeReferenceInArray", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/TypeReferenceInArray/A.java TypeReferenceInArray.A.a [A]\n" +
- "src/TypeReferenceInArray/A.java TypeReferenceInArray.A.b [TypeReferenceInArray.A]",
- resultCollector.toString());
-}
-/**
- * Type reference in array test.
- * (regression test for bug 3230 Search - Too many type references for query ending with * (1GAZVGI) )
- */
-public void testTypeReferenceInArray2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "s1", "X.java").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/s1/Y.java s1.Y.f [X]",
- resultCollector.toString());
-}
-/**
- * Type reference in cast test.
- * (regression test for bug 23329 search: incorrect range for type references in brackets)
- */
-public void testTypeReferenceInCast() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "s3", "A.java").getType("B");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/s3/A.java s3.A.foo() -> Object [B]",
- resultCollector.toString());
-}
-/**
- * Type reference in hierarchy test.
- * (regression test for bug 28236 Search for refs to class in hierarchy matches class outside hierarchy )
- */
-public void testTypeReferenceInHierarchy() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "d9.p1", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- scope,
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-}
-/**
- * Type reference in import test.
- * (regression test for PR #1GA7PAS)
- */
-public void testTypeReferenceInImport() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p2", "Z.java").getType("Z");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/TypeReferenceInImport/X.java [p2.Z]",
- resultCollector.toString());
-}
-/**
- * Type reference in import test.
- * (regression test for bug 23077 search: does not find type references in some imports)
- */
-public void testTypeReferenceInImport2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "r6", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/r6/B.java [r6.A]\n" +
- "src/r6/B.java [r6.A]\n" +
- "src/r6/B.java [r6.A]\n" +
- "src/r6/B.java [r6.A]\n" +
- "src/r6/B.java [r6.A]\n" +
- "src/r6/B.java [r6.A]",
- resultCollector.toString());
-}
-/**
- * Type reference in initializer test.
- * (regression test for PR #1G4GO4O)
- */
-public void testTypeReferenceInInitializer() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "Test.java").getType("Test");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/Test.java Test.static {} [Test]\n" +
- "src/Test.java Test.static {} [Test]\n" +
- "src/Test.java Test.{} [Test]",
- resultCollector.toString());
-}
-/**
- * Type reference inside a qualified name reference test.
- * (Regression test for PR #1G4TSC0)
- */
-public void testTypeReferenceInQualifiedNameReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/Test.java Test.main(String[]) -> void [p.A]\n" +
- "src/Test.java Test.main(String[]) -> void [p.A]\n" +
- "src/p/A.java p.A.foo() -> void [A]",
- resultCollector.toString());
-}
-/**
- * Type reference inside a qualified name reference test.
- * (Regression test for PR #1GLBP65)
- */
-public void testTypeReferenceInQualifiedNameReference2() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p4", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p4/A.java p4.A.A [A]\n" +
- "src/p4/A.java p4.X.x() -> void [p4.A]\n" +
- "src/p4/A.java p4.X [p4.A]",
- resultCollector.toString());
-}
-/**
- * Type reference inside a qualified name reference test.
- * (Regression test for PR 1GL9UMH: ITPJCORE:WIN2000 - search: missing type occurrences)
- */
-public void testTypeReferenceInQualifiedNameReference3() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "", "W.java").getType("W");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/W.java W.m() -> int [W]",
- resultCollector.toString());
-}
-/**
- * Type reference inside a qualified name reference test.
- * (Regression test for bug 16751 Renaming a class doesn't update all references )
- */
-public void testTypeReferenceInQualifiedNameReference4() throws CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "b7", "X.java").getType("SubClass");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/b7/X.java b7.Test.main(String[]) -> void [SubClass]",
- resultCollector.toString());
-}
-/**
- * Type reference in a throw clause test.
- * (Regression test for bug 6779 searchDeclarationsOfReferencedTyped - missing exception types)
- */
-public void testTypeReferenceInThrows() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "a7", "X.java").getType("MyException");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/a7/X.java a7.X.foo() -> void [MyException] EXACT_MATCH",
- resultCollector.toString());
-}
-/**
- * Type reference test (not case sensitive)
- */
-public void testTypeReferenceNotCaseSensitive() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "d4");
- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {pkg});
- ISearchPattern pattern = SearchEngine.createSearchPattern("Y", TYPE, REFERENCES, false);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pattern,
- scope,
- resultCollector);
- assertEquals(
- "src/d4/X.java d4.X.foo() -> Object [Y]",
- resultCollector.toString());
-}
-/**
- * Type reference in a folder that is not in the classpath.
- * (regression test for PR #1G5N8KS)
- */
-public void testTypeReferenceNotInClasspath() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p/A.java p.A.x [X]\n" +
- "src/p/A.java p.A(X) [X]\n" +
- "src/p/A.java p.A.foo(int, String, X) -> void [X]\n" +
- "src/p/X.java p.X() [X]\n" +
- "src/p/X.java p.X.foo(int, String, X) -> void [X]\n" +
- "src/p/Y.java p.Y [X]\n" +
- "src/p/Z.java p.Z.foo(int, String, X) -> void [X]",
- resultCollector.toString());
-}
-/**
- * Type reference with recovery test.
- * (Regression test for bug 29366 Search reporting invalid inaccurate match )
- */
-public void testTypeReferenceWithRecovery() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "e1", "A29366.java").getType("A29366");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- resultCollector.showAccuracy = true;
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/e1/A29366.java e1.A29366.foo() -> void [A29366] EXACT_MATCH",
- resultCollector.toString());
-}
-/**
- * Negative type reference test.
- * (regression test for 1G52F7P: ITPJCORE:WINNT - Search - finds bogus references to class)
- */
-public void testNegativeTypeReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "p7", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-}
-
-/**
- * Various package declarations test.
- */
-public void testVariousPackageDeclarations() throws JavaModelException, CoreException {
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "p3*",
- PACKAGE,
- DECLARATIONS,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/p3 p3\n" +
- "src/p3/p2/p p3.p2.p",
- resultCollector.toString());
-}
-/**
- * Various package reference test.
- */
-public void testVariousPackageReference() throws JavaModelException, CoreException {
- IPackageFragment pkg = getPackageFragment("JavaSearch", "src", "p3.p2.p");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- pkg,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "src/PackageReference/A.java [p3.p2.p]\n" +
- "src/PackageReference/B.java [p3.p2.p]\n" +
- "src/PackageReference/C.java PackageReference.C [p3.p2.p]\n" +
- "src/PackageReference/D.java PackageReference.D.x [p3.p2.p]\n" +
- "src/PackageReference/E.java PackageReference.E.x [p3.p2.p]\n" +
- "src/PackageReference/F.java PackageReference.F.foo() -> p3.p2.p.X [p3.p2.p]\n" +
- "src/PackageReference/G.java PackageReference.G.foo(p3.p2.p.X) -> void [p3.p2.p]\n" +
- "src/PackageReference/H.java PackageReference.H.foo() -> void [p3.p2.p]\n" +
- "src/PackageReference/I.java PackageReference.I.foo() -> void [p3.p2.p]\n" +
- "src/PackageReference/J.java PackageReference.J.foo() -> void [p3.p2.p]",
- resultCollector.toString());
-}
-/**
- * Type reference inside an argument, a return type or a field type.
- * (Regression test for PR #1GA7QA1)
- */
-public void testVariousTypeReferences() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "NoReference", "A.java").getType("A");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- type,
- REFERENCES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "", // no reference should be found
- resultCollector.toString());
-}
-/**
- * Write access reference in a qualified name reference test.
- * (regression test for bug 7344 Search - write acces give wrong result)
- */
-public void testReadWriteAccessInQualifiedNameReference() throws JavaModelException, CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "a8", "A.java").getType("A");
- IField field = type.getField("a");
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
-
- resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- field,
- WRITE_ACCESSES,
- getJavaSearchScope(),
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java
deleted file mode 100644
index 521c155..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.tests.util.Util;
-import junit.framework.Test;
-
-public class MementoTests extends ModifyingResourceTests {
-public MementoTests(String name) {
- super(name);
-}
-public static Test suite() {
- return new Suite(MementoTests.class);
-}
-protected void assertMemento(String expected, IJavaElement element) {
- String actual = element.getHandleIdentifier();
- if (!expected.equals(actual)){
- System.out.println(Util.displayString(actual, 2));
- }
- assertEquals(
- "Unexpected memento for " + element,
- expected,
- actual);
- IJavaElement restored = JavaCore.create(actual);
- assertEquals(
- "Unexpected restored element",
- element,
- restored);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- this.createJavaProject(
- "P",
- new String[] {"src"},
- new String[] {
- getExternalJCLPathString(),
- "/P/lib",
- "/P/lib/myLib.jar",
- "/OtherProj/lib",
- "/OtherProj/lib/myLib.jar",
- },
- "bin");
-}
-public void tearDownSuite() throws Exception {
- this.deleteProject("P");
- super.tearDownSuite();
-}
-/**
- * Tests that a binary field can be persisted and restored using its memento.
- */
-public void testBinaryFieldMemento() throws JavaModelException {
- IField field = getClassFile("/P/lib/p/X.class").getType().getField("field");
- assertMemento(
- "=P/lib<p(X.class[X^field",
- field);
-}
-/**
- * Tests that an inner type, inner field and inner method can be persisted and restored
- * using mementos.
- */
-public void testBinaryInnerTypeMemento() throws JavaModelException {
- IType type = getClassFile("/P/lib/p/X$Inner.class").getType();
-
- assertMemento(
- "=P/lib<p(X$Inner.class[Inner",
- type);
-
- IField innerField = type.getField("field");
- assertMemento(
- "=P/lib<p(X$Inner.class[Inner^field",
- innerField);
-
- IMethod innerMethod = type.getMethod("foo", new String[] {"I", "Ljava.lang.String;"});
- assertMemento(
- "=P/lib<p(X$Inner.class[Inner~foo~I~Ljava.lang.String;",
- innerMethod);
-}
-/**
- * Tests that a binary method can be persisted and restored using its memento.
- */
-public void testBinaryMethodMemento() throws JavaModelException {
- IType type = getClassFile("/P/lib/p/X.class").getType();
-
- IMethod method = type.getMethod("foo", new String[] {"I", "Ljava.lang.String;"});
- assertMemento(
- "=P/lib<p(X.class[X~foo~I~Ljava.lang.String;",
- method);
-
- method = type.getMethod("bar", new String[] {});
- assertMemento(
- "=P/lib<p(X.class[X~bar",
- method);
-
- method = type.getMethod("fred", new String[] {"[Z"});
- assertMemento(
- "=P/lib<p(X.class[X~fred~[Z",
- method);
-}
-/**
- * Tests that a binary type can be persisted and restored using its memento.
- */
-public void testBinaryTypeMemento() throws JavaModelException {
- IType type = getClassFile("/P/lib/p/X.class").getType();
- assertMemento(
- "=P/lib<p(X.class[X",
- type);
-}
-/**
- * Tests that a class file can be persisted and restored using its memento.
- */
-public void testClassFileMemento() throws JavaModelException {
- IClassFile cf = getClassFile("/P/lib/p/X.class");
- assertMemento(
- "=P/lib<p(X.class",
- cf);
-
- cf = getClassFile("/P/lib/Y.class");
- assertMemento(
- "=P/lib<(Y.class",
- cf);
-
-}
-/**
- * Tests that a compilation unit can be persisted and restored using its memento.
- */
-public void testCompilationUnitMemento() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("/P/src/p/X.java");
- assertMemento(
- "=P/src<p{X.java",
- cu);
-
- cu = getCompilationUnit("/P/src/Y.java");
- assertMemento(
- "=P/src<{Y.java",
- cu);
-}
-/**
- * Tests that an import declaration can be persisted and restored using its memento.
- */
-public void testImportContainerMemento() throws JavaModelException {
- IImportContainer importContainer = getCompilationUnit("/P/src/p/X.java").getImportContainer();
- assertMemento(
- "=P/src<p{X.java#",
- importContainer);
-}
-/**
- * Tests that an import declaration can be persisted and restored using its memento.
- */
-public void testImportDeclarationMemento() throws JavaModelException {
- IImportDeclaration importDecl = getCompilationUnit("/P/src/p/X.java").getImport("java.io.Serializable");
- assertMemento(
- "=P/src<p{X.java#java.io.Serializable",
- importDecl);
-
- importDecl = getCompilationUnit("/P/src/p/X.java").getImport("java.util.*");
- assertMemento(
- "=P/src<p{X.java#java.util.*",
- importDecl);
-}
-/**
- * Tests that an initializer can be persisted and restored using its memento.
- */
-public void testInitializerMemento() throws JavaModelException {
- IType type = getCompilationUnit("/P/src/p/X.java").getType("X");
-
- IInitializer initializer = type.getInitializer(1);
- assertMemento(
- "=P/src<p{X.java[X|1",
- initializer);
-
- initializer = type.getInitializer(2);
- assertMemento(
- "=P/src<p{X.java[X|2",
- initializer);
-}
-/**
- * Tests that a binary field in an internal jar can be persisted and restored using its memento.
- */
-public void testInternalJarBinaryFieldMemento() throws JavaModelException {
- IType type = getPackageFragmentRoot("/P/lib/myLib.jar").getPackageFragment("p").getClassFile("X.class").getType();
- IField field = type.getField("field");
- assertMemento(
- "=P/lib/myLib.jar<p(X.class[X^field",
- field);
-}
-/**
- * Tests that a inner binary type and field in an internal jar can be persisted and restored using its memento.
- */
-public void testInternalJarBinaryInnerTypeMemento() throws JavaModelException {
- IType type = getPackageFragmentRoot("/P/lib/myLib.jar").getPackageFragment("p").getClassFile("X$Inner.class").getType();
- assertMemento(
- "=P/lib/myLib.jar<p(X$Inner.class[Inner",
- type);
-}
-/**
- * Tests that a binary method in an internal jar can be persisted and restored using its memento.
- */
-public void testInternalJarBinaryMethodMemento() throws JavaModelException {
- IType type = getPackageFragmentRoot("/P/lib/myLib.jar").getPackageFragment("p").getClassFile("X.class").getType();
- IMethod method = type.getMethod("foo", new String[] {"[Ljava.lang.String;"});
- assertMemento(
- "=P/lib/myLib.jar<p(X.class[X~foo~[Ljava.lang.String;",
- method);
-}
-/**
- * Tests that a binary type in an internal jar can be persisted and restored using its memento.
- */
-public void testInternalJarBinaryTypeMemento() throws JavaModelException {
- IType type = getPackageFragmentRoot("/P/lib/myLib.jar").getPackageFragment("p").getClassFile("X.class").getType();
- assertMemento(
- "=P/lib/myLib.jar<p(X.class[X",
- type);
-}
-/**
- * Tests that a binary field in an external jar can be persisted and restored using its memento.
- */
-public void testExternalJarBinaryFieldMemento() throws JavaModelException {
- IType type = getClassFile("P", getExternalJCLPathString(), "p", "X.class").getType();
- IField field = type.getField("field");
- assertMemento(
- "=P/" + getExternalJCLPath() + "<p(X.class[X^field",
- field);
-}
-/**
- * Tests that a inner binary type and field in an external jar can be persisted and restored using its memento.
- */
-public void testExternalJarBinaryInnerTypeMemento() throws JavaModelException {
- IType type = getClassFile("P", getExternalJCLPathString(), "p", "X$Inner.class").getType();
- assertMemento(
- "=P/" + getExternalJCLPath() + "<p(X$Inner.class[Inner",
- type);
-}
-/**
- * Tests that a binary method in an external jar can be persisted and restored using its memento.
- */
-public void testExternalJarBinaryMethodMemento() throws JavaModelException {
- IType type = getClassFile("P", getExternalJCLPathString(), "p", "X.class").getType();
- IMethod method = type.getMethod("foo", new String[] {"[Ljava.lang.String;"});
- assertMemento(
- "=P/" + getExternalJCLPath() + "<p(X.class[X~foo~[Ljava.lang.String;",
- method);
-}
-/**
- * Tests that a binary type in an external jar can be persisted and restored using its memento.
- */
-public void testExternalJarBinaryTypeMemento() throws JavaModelException {
- IType type = getClassFile("P", getExternalJCLPathString(), "p", "X.class").getType();
- assertMemento(
- "=P/" + getExternalJCLPath() + "<p(X.class[X",
- type);
-}
-/**
- * Tests that a package declaration can be persisted and restored using its memento.
- */
-public void testPackageDeclarationMemento() throws JavaModelException {
- IPackageDeclaration declaration = getCompilationUnit("/P/src/p/X.java").getPackageDeclaration("p");
- assertMemento(
- "=P/src<p{X.java%p",
- declaration);
-
- declaration = getCompilationUnit("/P/src/p1/p2/X.java").getPackageDeclaration("p1.p2");
- assertMemento(
- "=P/src<p1.p2{X.java%p1.p2",
- declaration);
-}
-/**
- * Tests that a package fragment can be persisted and restored using its memento.
- */
-public void testPackageFragmentMemento() throws JavaModelException {
- IPackageFragment pkg = getPackage("/P/src/p");
- assertMemento(
- "=P/src<p",
- pkg);
-
- pkg = getPackage("/P/src/p1/p2");
- assertMemento(
- "=P/src<p1.p2",
- pkg);
-
- pkg = getPackage("/P/src");
- assertMemento(
- "=P/src<",
- pkg);
-}
-/**
- * Tests that a source folder package fragment root can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento1() throws CoreException {
- IJavaProject project = getJavaProject("P");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(project.getProject().getFolder("src"));
- assertMemento(
- "=P/src",
- root);
-}
-/**
- * Tests that a source folder package fragment root corresponding to the project
- * can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento2() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P1", new String[] {""}, "");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(project.getProject());
- assertMemento(
- "=P1/",
- root);
- } finally {
- this.deleteProject("P1");
- }
-}
-/**
- * Tests that a library folder package fragment root in the same project
- * can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento3() throws CoreException {
- IJavaProject project = getJavaProject("P");
- IFolder libFolder = project.getProject().getFolder("lib");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(libFolder);
- assertMemento(
- "=P/lib",
- root);
-}
-/**
- * Tests that a library folder package fragment root in another project
- * can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento4() throws CoreException {
- IJavaProject project = getJavaProject("P");
- IFolder otherLibFolder = getFolder("/OtherProj/lib");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(otherLibFolder);
- assertMemento(
- "=P//OtherProj/lib",
- root);
-}
-/**
- * Tests that a jar package fragment root in the same project
- * can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento5() throws CoreException {
- IJavaProject project = getJavaProject("P");
- IFile jar = getFile("/P/lib/myLib.jar");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(jar);
- assertMemento(
- "=P/lib/myLib.jar",
- root);
-}
-/**
- * Tests that a jar package fragment root in another project
- * can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento6() throws CoreException {
- IJavaProject project = getJavaProject("P");
- IFile jar = getFile("/OtherProj/lib/myLib.jar");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(jar);
- assertMemento(
- "=P//OtherProj/lib/myLib.jar",
- root);
-}
-/**
- * Tests that an external jar package fragment root
- * can be persisted and restored using its memento.
- */
-public void testPackageFragmentRootMemento7() throws CoreException {
- IPackageFragmentRoot root = getPackageFragmentRoot("P", getExternalJCLPathString());
- assertMemento(
- "=P/" + getExternalJCLPath(),
- root);
-}
-/**
- * Tests that a project can be persisted and restored using its memento.
- */
-public void testProjectMemento() throws JavaModelException {
- IJavaProject project = getJavaProject("P");
- assertMemento(
- "=P",
- project);
-}
-/**
- * Tests that a bogus memento cannot be restored.
- */
-public void testRestoreBogusMemento() throws JavaModelException {
- IJavaElement restored = JavaCore.create("bogus");
- assertEquals("should not be able to restore a bogus memento", null, restored);
-}
-/**
- * Tests that a source field can be persisted and restored using its memento.
- */
-public void testSourceFieldMemento() throws JavaModelException {
- IField field = getCompilationUnit("/P/src/p/X.java").getType("X").getField("field");
- assertMemento(
- "=P/src<p{X.java[X^field",
- field);
-}
-/**
- * Tests that a source inner type, inner field and inner method can be persisted and restored
- * using mementos.
- */
-public void testSourceInnerTypeMemento() throws JavaModelException {
- IType innerType = getCompilationUnit("/P/src/p/X.java").getType("X").getType("Inner");
- assertMemento(
- "=P/src<p{X.java[X[Inner",
- innerType);
-}
-/**
- * Tests that a source method can be persisted and restored using its memento.
- */
-public void testSourceMethodMemento() throws JavaModelException {
- IType type = getCompilationUnit("/P/src/p/X.java").getType("X");
-
- IMethod method = type.getMethod("foo", new String[] {"I", "Ljava.lang.String;"});
- assertMemento(
- "=P/src<p{X.java[X~foo~I~Ljava.lang.String;",
- method);
-
- method = type.getMethod("bar", new String[] {});
- assertMemento(
- "=P/src<p{X.java[X~bar",
- method);
-
- method = type.getMethod("fred", new String[] {"[Z"});
- assertMemento(
- "=P/src<p{X.java[X~fred~[Z",
- method);
-}
-/**
- * Tests that a source type can be persisted and restored using its memento.
- */
-public void testSourceTypeMemento() throws JavaModelException {
- IType type = getCompilationUnit("/P/src/p/X.java").getType("X");
- assertMemento(
- "=P/src<p{X.java[X",
- type);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java
deleted file mode 100644
index 3e19931..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IParent;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.batch.Main;
-import org.eclipse.jdt.internal.core.JavaElement;
-
-/*
- * Tests that modify resources in the workspace.
- */
-public class ModifyingResourceTests extends AbstractJavaModelTests {
-
-public ModifyingResourceTests(String name) {
- super(name);
-}
-protected void assertDeltas(String message, String expected) {
- StringBuffer buffer = new StringBuffer();
- IJavaElementDelta[] deltas = this.deltaListener.deltas;
- for (int i=0, length= deltas.length; i<length; i++) {
- IJavaElementDelta[] projects = deltas[i].getAffectedChildren();
- this.sortDeltas(projects);
- for (int j=0, projectsLength=projects.length; j<projectsLength; j++) {
- buffer.append(projects[j]);
- if (j != projectsLength-1) {
- buffer.append("\n");
- }
- }
- IResourceDelta[] nonJavaProjects = deltas[i].getResourceDeltas();
- if (nonJavaProjects != null) {
- for (int j=0, nonJavaProjectsLength=nonJavaProjects.length; j<nonJavaProjectsLength; j++) {
- if (j == 0 && buffer.length() != 0) {
- buffer.append("\n");
- }
- buffer.append(nonJavaProjects[j]);
- if (j != nonJavaProjectsLength-1) {
- buffer.append("\n");
- }
- }
- }
- if (i != length-1) {
- buffer.append("\n\n");
- }
- }
- String actual = buffer.toString();
- if (!expected.equals(actual)){
- System.out.println(Util.displayString(actual, 3));
- }
- assertEquals(
- message,
- expected,
- actual);
-}
-/**
- * E.g. <code>
- * org.eclipse.jdt.tests.core.ModifyingResourceTests.generateClassFile(
- * "A",
- * "public class A {\n" +
- * "}")
- */
-public static void generateClassFile(String className, String javaSource) throws IOException {
- String cu = "d:/temp/" + className + ".java";
- FileOutputStream output = new FileOutputStream(cu);
- try {
- output.write(javaSource.getBytes());
- } finally {
- output.close();
- }
- Main.compile(cu + " -d d:/temp -classpath " + System.getProperty("java.home") + "/lib/rt.jar");
- FileInputStream input = new FileInputStream("d:/temp/" + className + ".class");
- try {
- System.out.println("{");
- byte[] buffer = new byte[80];
- int read = 0;
- while (read != -1) {
- read = input.read(buffer);
- if (read != -1) System.out.print("\t");
- for (int i = 0; i < read; i++) {
- System.out.print(buffer[i]);
- System.out.print(", ");
- }
- if (read != -1) System.out.println();
- }
- System.out.print("}");
- } finally {
- input.close();
- }
-}
-
-protected IFile createFile(String path, InputStream content) throws CoreException {
- IFile file = this.getFile(path);
- file.create(content, true, null);
- return file;
-}
-
-protected IFile createFile(String path, byte[] content) throws CoreException {
- IFile file = this.getFile(path);
- InputStream input = new ByteArrayInputStream(content);
- file.create(input, true, null);
- return file;
-}
-
-protected IFile createFile(String path, String content) throws CoreException {
- IFile file = this.getFile(path);
- InputStream input = new ByteArrayInputStream(content.getBytes());
- file.create(input, true, null);
- return file;
-}
-protected IFolder createFolder(String path) throws CoreException {
- final IFolder folder = this.getFolder(path);
- getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IContainer parent = folder.getParent();
- if (parent instanceof IFolder && !parent.exists()) {
- createFolder(parent.getFullPath().toString());
- }
- folder.create(true, true, null);
- }
- },
- null);
-
- return folder;
-}
-protected void deleteFile(String filePath) throws CoreException {
- deleteResource(this.getFile(filePath));
-}
-protected void deleteFolder(String folderPath) throws CoreException {
- deleteResource(this.getFolder(folderPath));
-}
-protected IFile editFile(String path, String content) throws CoreException {
- IFile file = this.getFile(path);
- InputStream input = new ByteArrayInputStream(content.getBytes());
- file.setContents(input, IFile.FORCE, null);
- return file;
-}
-/*
- * Expands (i.e. open) the given element and returns a toString() representation
- * of the tree.
- */
-protected String expandAll(IJavaElement element) throws CoreException {
- StringBuffer buffer = new StringBuffer();
- this.expandAll(element, 0, buffer);
- return buffer.toString();
-}
-private void expandAll(IJavaElement element, int tab, StringBuffer buffer) throws CoreException {
- IJavaElement[] children = null;
- // force opening of element by getting its children
- if (element instanceof IParent) {
- IParent parent = (IParent)element;
- children = parent.getChildren();
- }
- ((JavaElement)element).toStringInfo(tab, buffer);
- if (children != null) {
- for (int i = 0, length = children.length; i < length; i++) {
- buffer.append("\n");
- this.expandAll(children[i], tab+1, buffer);
- }
- }
-}
-protected void renameProject(String project, String newName) throws CoreException {
- this.getProject(project).move(new Path(newName), true, null);
-}
-protected void sortDeltas(IJavaElementDelta[] deltas) {
- org.eclipse.jdt.internal.core.Util.Comparer comparer = new org.eclipse.jdt.internal.core.Util.Comparer() {
- public int compare(Object a, Object b) {
- IJavaElementDelta deltaA = (IJavaElementDelta)a;
- IJavaElementDelta deltaB = (IJavaElementDelta)b;
- return deltaA.getElement().getElementName().compareTo(deltaB.getElement().getElementName());
- }
- };
- org.eclipse.jdt.internal.core.Util.sort(deltas, comparer);
-}
-protected ICompilationUnit getCompilationUnit(String path) {
- return (ICompilationUnit)JavaCore.create(this.getFile(path));
-}
-protected IClassFile getClassFile(String path) {
- return (IClassFile)JavaCore.create(this.getFile(path));
-}
-protected IFile getFile(String path) {
- return getWorkspaceRoot().getFile(new Path(path));
-}
-protected IFolder getFolder(String path) {
- return getWorkspaceRoot().getFolder(new Path(path));
-}
-protected IPackageFragment getPackage(String path) {
- if (path.indexOf('/', 1) != -1) { // if path as more than one segment
- IJavaElement element = JavaCore.create(this.getFolder(path));
- if (element instanceof IPackageFragmentRoot) {
- return ((IPackageFragmentRoot)element).getPackageFragment("");
- } else {
- return (IPackageFragment)element;
- }
- } else {
- IProject project = this.getProject(path);
- return JavaCore.create(project).getPackageFragmentRoot(project).getPackageFragment("");
- }
-}
-protected IPackageFragmentRoot getPackageFragmentRoot(String path) {
- if (path.indexOf('/', 1) != -1) { // if path as more than one segment
- if (path.endsWith(".jar")) {
- return (IPackageFragmentRoot)JavaCore.create(this.getFile(path));
- } else {
- return (IPackageFragmentRoot)JavaCore.create(this.getFolder(path));
- }
- } else {
- IProject project = this.getProject(path);
- return JavaCore.create(project).getPackageFragmentRoot(project);
- }
-}
-protected String getSortedByProjectDeltas() {
- StringBuffer buffer = new StringBuffer();
- for (int i=0, length = this.deltaListener.deltas.length; i<length; i++) {
- IJavaElementDelta[] projects = this.deltaListener.deltas[i].getAffectedChildren();
- int projectsLength = projects.length;
-
- // sort by project
- IJavaElementDelta[] sorted = new IJavaElementDelta[projectsLength];
- System.arraycopy(projects, 0, sorted, 0, projectsLength);
- org.eclipse.jdt.internal.core.Util.sort(
- sorted,
- new org.eclipse.jdt.internal.core.Util.Comparer() {
- public int compare(Object a, Object b) {
- return a.toString().compareTo(b.toString());
- }
- });
-
- for (int j=0; j<projectsLength; j++) {
- buffer.append(sorted[j]);
- if (j != projectsLength-1) {
- buffer.append("\n");
- }
- }
- if (i != length-1) {
- buffer.append("\n\n");
- }
- }
- return buffer.toString();
-}
-protected void moveFile(String sourcePath, String destPath) throws CoreException {
- this.getFile(sourcePath).move(this.getFile(destPath).getFullPath(), false, null);
-}
-protected void moveFolder(String sourcePath, String destPath) throws CoreException {
- this.getFolder(sourcePath).move(this.getFolder(destPath).getFullPath(), false, null);
-}
-protected void swapFiles(String firstPath, String secondPath) throws CoreException {
- final IFile first = this.getFile(firstPath);
- final IFile second = this.getFile(secondPath);
- IWorkspaceRunnable runnable = new IWorkspaceRunnable( ) {
- public void run(IProgressMonitor monitor) throws CoreException {
- IPath tempPath = first.getParent().getFullPath().append("swappingFile.temp");
- first.move(tempPath, false, monitor);
- second.move(first.getFullPath(), false, monitor);
- getWorkspaceRoot().getFile(tempPath).move(second.getFullPath(), false, monitor);
- }
- };
- getWorkspace().run(runnable, null);
-}
-/*
- * Returns a new classpath from the given source folders and their respective exclusion patterns.
- * The given array as the following form:
- * [<source folder>, "<pattern>[|<pattern]*"]*
- * E.g. new String[] {
- * "src1", "p/A.java",
- * "src2", "*.txt|com.tests/**"
- * }
- */
-protected IClasspathEntry[] createClasspath(String[] sourceFoldersAndExclusionPatterns) {
- int length = sourceFoldersAndExclusionPatterns.length;
- IClasspathEntry[] classpath = new IClasspathEntry[length/2];
- for (int i = 0; i < length; i+=2) {
- String src = sourceFoldersAndExclusionPatterns[i];
- String patterns = sourceFoldersAndExclusionPatterns[i+1];
- StringTokenizer tokenizer = new StringTokenizer(patterns, "|");
- int patternsCount = tokenizer.countTokens();
- IPath[] patternPaths = new IPath[patternsCount];
- for (int j = 0; j < patternsCount; j++) {
- patternPaths[j] = new Path(tokenizer.nextToken());
- }
- classpath[i/2] = JavaCore.newSourceEntry(new Path(src), patternPaths);
- }
- return classpath;
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java
deleted file mode 100644
index 363f775..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.core.JavaProject;
-import junit.framework.Test;
-
-/**
- * These test ensure that modifications in Java projects are correctly reported as
- * IJavaEllementDeltas.
- */
-public class NameLookupTests2 extends ModifyingResourceTests {
-
-public NameLookupTests2(String name) {
- super(name);
-}
-
-
-
-public static Test suite() {
- return new Suite(NameLookupTests2.class);
-}
-
-public void testAddPackageFragmentRootAndPackageFrament() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src1"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "");
- IClasspathEntry[] classpath =
- new IClasspathEntry[] {
- JavaCore.newProjectEntry(new Path("/P1"))
- };
- p2.setRawClasspath(classpath, null);
-
- IPackageFragment[] res = ((JavaProject)p2).getNameLookup().findPackageFragments("p1", false);
- assertTrue("Should get no package fragment", res == null);
-
- IClasspathEntry[] classpath2 =
- new IClasspathEntry[] {
- JavaCore.newSourceEntry(new Path("/P1/src1")),
- JavaCore.newSourceEntry(new Path("/P1/src2"))
- };
- p1.setRawClasspath(classpath2, null);
- this.createFolder("/P1/src2/p1");
-
- res = ((JavaProject)p2).getNameLookup().findPackageFragments("p1", false);
- assertTrue(
- "Should get 'p1' package fragment",
- res != null &&
- res.length == 1 &&
- res[0].getElementName().equals("p1"));
-
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-public void testAddPackageFragment() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src1"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "");
- IClasspathEntry[] classpath =
- new IClasspathEntry[] {
- JavaCore.newProjectEntry(new Path("/P1"))
- };
- p2.setRawClasspath(classpath, null);
-
- IPackageFragment[] res = ((JavaProject)p2).getNameLookup().findPackageFragments("p1", false);
- assertTrue("Should get no package fragment", res == null);
-
- this.createFolder("/P1/src1/p1");
-
- res = ((JavaProject)p2).getNameLookup().findPackageFragments("p1", false);
- assertTrue(
- "Should get 'p1' package fragment",
- res != null &&
- res.length == 1 &&
- res[0].getElementName().equals("p1"));
-
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Resolve, add pkg, resolve again: new pkg should be accessible
- * (regression test for bug 37962 Unexpected transient problem during reconcile
- */
-public void testAddPackageFragment2() throws CoreException {
- try {
- JavaProject project = (JavaProject)this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("/P/src/p1");
-
- IPackageFragment[] pkgs = project.getNameLookup().findPackageFragments("p1", false);
- assertElementsEqual(
- "Didn't find p1",
- "p1",
- pkgs);
-
- this.createFolder("/P/src/p2");
-
- pkgs = project.getNameLookup().findPackageFragments("p2", false);
- assertElementsEqual(
- "Didn't find p2",
- "p2",
- pkgs);
- } finally {
- this.deleteProject("P");
- }
-}
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java
deleted file mode 100644
index 18c8b51..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.Hashtable;
-
-import junit.framework.Test;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.NamingConventions;
-import org.eclipse.jdt.core.compiler.CharOperation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaProject;
-
-public class NamingConventionTests extends AbstractJavaModelTests {
-
-IJavaProject project;
-
-public NamingConventionTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- return new Suite(NamingConventionTests.class);
-}
-/**
- * Setup for the next test.
- */
-public void setUp() throws Exception {
- super.setUp();
-
- project = createJavaProject("P", new String[]{"src"}, "bin"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-}
-/**
- * Cleanup after the previous test.
- */
-public void tearDown() throws Exception {
- this.deleteProject("P"); //$NON-NLS-1$
-
- super.tearDown();
-}
-private String toString(char[][] suggestions) {
- if(suggestions == null) {
- return ""; //$NON-NLS-1$
- }
-
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < suggestions.length; i++) {
- if(i != 0) {
- buffer.append('\n');
- }
- buffer.append(suggestions[i]);
- }
- return buffer.toString();
-}
-private String toString(String[] suggestions) {
- if(suggestions == null) {
- return ""; //$NON-NLS-1$
- }
-
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < suggestions.length; i++) {
- if(i != 0) {
- buffer.append('\n');
- }
- buffer.append(suggestions[i]);
- }
- return buffer.toString();
-}
-public void testSuggestFieldName001() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "name\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName002() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneClass".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "class1\n" + //$NON-NLS-1$
- "oneClass", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName003() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"f"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "fName\n" + //$NON-NLS-1$
- "fOneName\n" + //$NON-NLS-1$
- "name\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName004() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"_"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "_name\n" + //$NON-NLS-1$
- "_oneName\n" + //$NON-NLS-1$
- "name\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName005() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"f"); //$NON-NLS-1$
- Object staticFieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES,"fg"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- Flags.AccStatic,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES,staticFieldPrefixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "fgName\n" + //$NON-NLS-1$
- "fgOneName\n" + //$NON-NLS-1$
- "name\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName006() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "preNamesuf\n" + //$NON-NLS-1$
- "preOneNamesuf\n" + //$NON-NLS-1$
- "preName\n" + //$NON-NLS-1$
- "preOneName\n" + //$NON-NLS-1$
- "namesuf\n" + //$NON-NLS-1$
- "oneNamesuf\n" + //$NON-NLS-1$
- "name\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName007() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "int".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "preIsuf\n" + //$NON-NLS-1$
- "preI\n" + //$NON-NLS-1$
- "isuf\n" + //$NON-NLS-1$
- "i", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName008() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- new char[][]{"name".toCharArray()}); //$NON-NLS-1$
-
- assertEquals(
- "name2\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName009() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- new char[][]{"preNamesuf".toCharArray()}); //$NON-NLS-1$
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "preName2suf\n" + //$NON-NLS-1$
- "preOneNamesuf\n" + //$NON-NLS-1$
- "preName\n" + //$NON-NLS-1$
- "preOneName\n" + //$NON-NLS-1$
- "namesuf\n" + //$NON-NLS-1$
- "oneNamesuf\n" + //$NON-NLS-1$
- "name\n" + //$NON-NLS-1$
- "oneName", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName010() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "OneName".toCharArray(), //$NON-NLS-1$
- 1,
- 0,
- new char[][]{"preNamesuf".toCharArray()}); //$NON-NLS-1$
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "preNamessuf\n" + //$NON-NLS-1$
- "preOneNamessuf\n" + //$NON-NLS-1$
- "preNames\n" + //$NON-NLS-1$
- "preOneNames\n" + //$NON-NLS-1$
- "namessuf\n" + //$NON-NLS-1$
- "oneNamessuf\n" + //$NON-NLS-1$
- "names\n" + //$NON-NLS-1$
- "oneNames", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName011() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c".toCharArray(), //$NON-NLS-1$
- "Factory".toCharArray(), //$NON-NLS-1$
- 1,
- 0,
- CharOperation.NO_CHAR_CHAR); //$NON-NLS-1$
-
- assertEquals(
- "factories", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName012() throws CoreException {
- String[] suggestions = NamingConventions.suggestFieldNames(
- project,
- "a.b.c", //$NON-NLS-1$
- "FooBar", //$NON-NLS-1$
- 0,
- 0,
- new String[]{"bar"}); //$NON-NLS-1$
-
- assertEquals(
- "bar2\n" + //$NON-NLS-1$
- "fooBar", //$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName013() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "java.lang".toCharArray(), //$NON-NLS-1$
- "Class".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "class1",//$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName014() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "java.lang".toCharArray(), //$NON-NLS-1$
- "Class".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- new char[][]{"class1".toCharArray()}); //$NON-NLS-1$
-
- assertEquals(
- "class2",//$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName015() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "".toCharArray(), //$NON-NLS-1$
- "#".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "name",//$NON-NLS-1$
- toString(suggestions));
-}
-public void testSuggestFieldName016() throws CoreException {
- char[][] suggestions = NamingConventions.suggestFieldNames(
- project,
- "".toCharArray(), //$NON-NLS-1$
- "#".toCharArray(), //$NON-NLS-1$
- 0,
- 0,
- new char[][]{"name".toCharArray()}); //$NON-NLS-1$
-
- assertEquals(
- "name2",//$NON-NLS-1$
- toString(suggestions));
-}
-public void testRemovePrefixAndSuffixForFieldName001() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[] name = NamingConventions.removePrefixAndSuffixForFieldName(
- project,
- "preOneNamesuf".toCharArray(), //$NON-NLS-1$
- 0);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "oneName", //$NON-NLS-1$
- new String(name));
-}
-public void testRemovePrefixAndSuffixForFieldName002() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pr, pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"uf, suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[] name = NamingConventions.removePrefixAndSuffixForFieldName(
- project,
- "preOneNamesuf".toCharArray(), //$NON-NLS-1$
- Flags.AccStatic);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "preOneNamesuf", //$NON-NLS-1$
- new String(name));
-}
-public void testRemovePrefixAndSuffixForFieldName003() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pr, pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"uf, suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[] name = NamingConventions.removePrefixAndSuffixForFieldName(
- project,
- "preOneNamesuf".toCharArray(), //$NON-NLS-1$
- 0);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "oneName", //$NON-NLS-1$
- new String(name));
-}
-public void testSuggestGetterName001() throws CoreException {
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "fieldName".toCharArray(), //$NON-NLS-1$
- 0,
- false,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "getFieldName", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestGetterName002() throws CoreException {
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "FieldName".toCharArray(), //$NON-NLS-1$
- 0,
- false,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "getFieldName", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestGetterName003() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pr, pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"uf, suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "preFieldName".toCharArray(), //$NON-NLS-1$
- 0,
- false,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "getFieldName", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestGetterName004() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pr, pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"uf, suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "preFieldNamesuf".toCharArray(), //$NON-NLS-1$
- 0,
- false,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "getFieldName", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestGetterName005() throws CoreException {
- Hashtable options = JavaCore.getOptions();
- Object fieldPrefixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_PREFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,"pr, pre"); //$NON-NLS-1$
- Object fieldSuffixPreviousValue = options.get(JavaCore.CODEASSIST_FIELD_SUFFIXES);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,"uf, suf"); //$NON-NLS-1$
- JavaCore.setOptions(options);
-
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "preFieldNamesuf".toCharArray(), //$NON-NLS-1$
- 0,
- true,
- CharOperation.NO_CHAR_CHAR);
-
- options.put(JavaCore.CODEASSIST_FIELD_PREFIXES,fieldPrefixPreviousValue);
- options.put(JavaCore.CODEASSIST_FIELD_SUFFIXES,fieldSuffixPreviousValue);
- JavaCore.setOptions(options);
- assertEquals(
- "isFieldName", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestGetterName006() throws CoreException {
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "isSomething".toCharArray(), //$NON-NLS-1$
- 0,
- true,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "isSomething", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestGetterName007() throws CoreException {
- char[] suggestion = NamingConventions.suggestGetterName(
- project,
- "isSomething".toCharArray(), //$NON-NLS-1$
- 0,
- false,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "getIsSomething", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestSetterName001() throws CoreException {
- char[] suggestion = NamingConventions.suggestSetterName(
- project,
- "isSomething".toCharArray(), //$NON-NLS-1$
- 0,
- true,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "setSomething", //$NON-NLS-1$
- new String(suggestion));
-}
-public void testSuggestSetterName002() throws CoreException {
- char[] suggestion = NamingConventions.suggestSetterName(
- project,
- "isSomething".toCharArray(), //$NON-NLS-1$
- 0,
- false,
- CharOperation.NO_CHAR_CHAR);
-
- assertEquals(
- "setIsSomething", //$NON-NLS-1$
- new String(suggestion));
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java
deleted file mode 100644
index 6107073..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.Hashtable;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-
-public class OptionTests extends ModifyingResourceTests {
-
-public OptionTests(String name) {
- super(name);
-}
-public static Test suite() {
-
- if (false){
- TestSuite suite = new Suite(OptionTests.class.getName());
- suite.addTest(new ClasspathTests("testDenseCycleDetection"));
- return suite;
- }
- return new Suite(OptionTests.class);
-}
-/**
- * Test persistence of project custom options
- */
-public void test01() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.DISABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "8.0");
- options.put(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, JavaCore.ERROR);
- JavaCore.setOptions(options);
-
- options.clear();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.ENABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "10.0");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom value for deprecation option", JavaCore.ENABLED, projectA.getOption(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, true));
- assertEquals("projA:unexpected custom value for compliance option", "10.0", projectA.getOption(JavaCore.COMPILER_COMPLIANCE, true));
- assertEquals("projA:unexpected inherited value1 for hidden-catch option", JavaCore.ERROR, projectA.getOption(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, true));
-
- // check project B custom options (should be none, indicating it sees global ones only)
- assertEquals("projB:unexpected custom value for deprecation option", JavaCore.DISABLED, projectB.getOption(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, true));
- assertEquals("projB:unexpected custom value for compliance option", "8.0", projectB.getOption(JavaCore.COMPILER_COMPLIANCE, true));
- assertEquals("projB:unexpected inherited value for hidden-catch option", JavaCore.ERROR, projectB.getOption(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, true));
-
- // flush custom options - project A should revert to global ones
- projectA.setOptions(null);
- assertEquals("projA:unexpected reverted value for deprecation option", JavaCore.DISABLED, projectA.getOption(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, true));
- assertEquals("projA:unexpected reverted value for compliance option", "8.0", projectA.getOption(JavaCore.COMPILER_COMPLIANCE, true));
- assertEquals("projA:unexpected inherited value2 for hidden-catch option", JavaCore.ERROR, projectA.getOption(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, true));
-
- } finally {
- this.deleteProject("A");
- this.deleteProject("B");
- }
-}
-
-/**
- * Test custom encoding
- */
-public void test02() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- String globalEncoding = JavaCore.getOption(JavaCore.CORE_ENCODING);
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.CORE_ENCODING, "custom");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom encoding", "custom", projectA.getOption(JavaCore.CORE_ENCODING, true));
-
- // check project B custom options (should be none, indicating it sees global ones only)
- assertEquals("projB:unexpected custom encoding", globalEncoding, projectB.getOption(JavaCore.CORE_ENCODING, true));
-
- // flush custom options - project A should revert to global ones
- projectA.setOptions(null);
- assertEquals("projA:unexpected reverted encoding", globalEncoding, projectA.getOption(JavaCore.CORE_ENCODING, true));
-
- } finally {
- this.deleteProject("A");
- this.deleteProject("B");
- }
-}
-
-/**
- * Test custom project option (if not considering JavaCore options)
- */
-public void test03() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.DISABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "8.0");
- options.put(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, JavaCore.ERROR);
- JavaCore.setOptions(options);
-
- options.clear();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.ENABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "10.0");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom value for deprecation option", JavaCore.ENABLED, projectA.getOption(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, false));
- assertEquals("projA:unexpected custom value for compliance option", "10.0", projectA.getOption(JavaCore.COMPILER_COMPLIANCE, false));
- assertEquals("projA:unexpected inherited value1 for hidden-catch option", null, projectA.getOption(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, false));
-
- // check project B custom options (should be none, indicating it sees global ones only)
- assertEquals("projB:unexpected custom value for deprecation option", null, projectB.getOption(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, false));
- assertEquals("projB:unexpected custom value for compliance option", null, projectB.getOption(JavaCore.COMPILER_COMPLIANCE, false));
- assertEquals("projB:unexpected inherited value for hidden-catch option", null, projectB.getOption(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, false));
-
- // flush custom options - project A should revert to global ones
- projectA.setOptions(null);
- assertEquals("projA:unexpected reverted value for deprecation option", null, projectA.getOption(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, false));
- assertEquals("projA:unexpected reverted value for compliance option", null, projectA.getOption(JavaCore.COMPILER_COMPLIANCE, false));
- assertEquals("projA:unexpected inherited value2 for hidden-catch option", null, projectA.getOption(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, false));
-
- } finally {
- this.deleteProject("A");
- this.deleteProject("B");
- }
-}
-/**
- * Test persistence of project custom options - using getOptions()
- */
-public void test04() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.DISABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "8.0");
- options.put(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, JavaCore.ERROR);
- JavaCore.setOptions(options);
-
- options.clear();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.ENABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "10.0");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom value for deprecation option", JavaCore.ENABLED, projectA.getOptions(true).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projA:unexpected custom value for compliance option", "10.0", projectA.getOptions(true).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projA:unexpected inherited value1 for hidden-catch option", JavaCore.ERROR, projectA.getOptions(true).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- // check project B custom options (should be none, indicating it sees global ones only)
- assertEquals("projB:unexpected custom value for deprecation option", JavaCore.DISABLED, projectB.getOptions(true).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projB:unexpected custom value for compliance option", "8.0", projectB.getOptions(true).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projB:unexpected inherited value for hidden-catch option", JavaCore.ERROR, projectB.getOptions(true).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- // flush custom options - project A should revert to global ones
- projectA.setOptions(null);
- assertEquals("projA:unexpected reverted value for deprecation option", JavaCore.DISABLED, projectA.getOptions(true).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projA:unexpected reverted value for compliance option", "8.0", projectA.getOptions(true).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projA:unexpected inherited value2 for hidden-catch option", JavaCore.ERROR, projectA.getOptions(true).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- } finally {
- this.deleteProject("A");
- this.deleteProject("B");
- }
-}
-
-/**
- * Test custom encoding - using getOptions()
- */
-public void test05() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- String globalEncoding = JavaCore.getOption(JavaCore.CORE_ENCODING);
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.CORE_ENCODING, "custom");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom encoding", "custom", projectA.getOptions(true).get(JavaCore.CORE_ENCODING));
-
- // check project B custom options (should be none, indicating it sees global ones only)
- assertEquals("projB:unexpected custom encoding", globalEncoding, projectB.getOptions(true).get(JavaCore.CORE_ENCODING));
-
- // flush custom options - project A should revert to global ones
- projectA.setOptions(null);
- assertEquals("projA:unexpected reverted encoding", globalEncoding, projectA.getOptions(true).get(JavaCore.CORE_ENCODING));
-
- } finally {
- this.deleteProject("A");
- this.deleteProject("B");
- }
-}
-
-/**
- * Test custom project option (if not considering JavaCore options) - using getOptions()
- */
-public void test06() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
- IJavaProject projectB =
- this.createJavaProject(
- "B",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.DISABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "8.0");
- options.put(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, JavaCore.ERROR);
- JavaCore.setOptions(options);
-
- options.clear();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.ENABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "10.0");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom value for deprecation option", JavaCore.ENABLED, projectA.getOptions(false).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projA:unexpected custom value for compliance option", "10.0", projectA.getOptions(false).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projA:unexpected inherited value1 for hidden-catch option", null, projectA.getOptions(false).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- // check project B custom options (should be none, indicating it sees global ones only)
- assertEquals("projB:unexpected custom value for deprecation option", null, projectB.getOptions(false).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projB:unexpected custom value for compliance option", null, projectB.getOptions(false).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projB:unexpected inherited value for hidden-catch option", null, projectB.getOptions(false).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- // flush custom options - project A should revert to global ones
- projectA.setOptions(null);
- assertEquals("projA:unexpected reverted value for deprecation option", null, projectA.getOptions(false).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projA:unexpected reverted value for compliance option", null, projectA.getOptions(false).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projA:unexpected inherited value2 for hidden-catch option", null, projectA.getOptions(false).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- } finally {
- this.deleteProject("A");
- this.deleteProject("B");
- }
-}
-/**
- * Custom options must replace existing ones completely
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26255
- */
-public void test07() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.ENABLED);
- options.put(JavaCore.COMPILER_COMPLIANCE, "10.0");
- projectA.setOptions(options);
-
- // check project A custom options
- assertEquals("projA:unexpected custom value for deprecation option", JavaCore.ENABLED, projectA.getOptions(false).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projA:unexpected custom value for compliance option", "10.0", projectA.getOptions(false).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projA:unexpected inherited value1 for hidden-catch option", null, projectA.getOptions(false).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- // change custom options to have one less
- options.clear();
- options.put(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, JavaCore.ENABLED);
- projectA.setOptions(options);
- assertEquals("projA:unexpected custom value for deprecation option", JavaCore.ENABLED, projectA.getOptions(false).get(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE));
- assertEquals("projA:unexpected custom value for compliance option", null, projectA.getOptions(false).get(JavaCore.COMPILER_COMPLIANCE));
- assertEquals("projA:unexpected inherited value1 for hidden-catch option", null, projectA.getOptions(false).get(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
-
- } finally {
- this.deleteProject("A");
- }
-}
-/**
- * Empty custom option must not be ignored
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26251
- */
-public void test08() throws CoreException {
- try {
- IJavaProject projectA =
- this.createJavaProject(
- "A",
- new String[] {}, // source folders
- new String[] {}, // lib folders
- new String[] {}, // projects
- "");
-
- Hashtable options = new Hashtable();
- options.put(JavaCore.COMPILER_TASK_TAGS, "TODO:");
- JavaCore.setOptions(options);
-
-
- // check project A custom options
- assertEquals("1#projA:unexpected custom value for task tags option", null, projectA.getOption(JavaCore.COMPILER_TASK_TAGS, false));
- assertEquals("1#projA:unexpected custom value for inherited task tags option", "TODO:", projectA.getOption(JavaCore.COMPILER_TASK_TAGS, true));
- assertEquals("1#workspace:unexpected custom value for task tags option", "TODO:", JavaCore.getOption(JavaCore.COMPILER_TASK_TAGS));
-
- // change custom options to have one less
- options.clear();
- options.put(JavaCore.COMPILER_TASK_TAGS, "");
- projectA.setOptions(options);
- assertEquals("2#projA:unexpected custom value for task tags option", "", projectA.getOption(JavaCore.COMPILER_TASK_TAGS, false));
- assertEquals("2#projA:unexpected custom value for inherited task tags option", "", projectA.getOption(JavaCore.COMPILER_TASK_TAGS, true));
- assertEquals("2#workspace:unexpected custom value for task tags option", "TODO:", JavaCore.getOption(JavaCore.COMPILER_TASK_TAGS));
-
- // change custom options to have one less
- options.clear();
- options.put(JavaCore.COMPILER_TASK_TAGS, "@TODO");
- JavaCore.setOptions(options);
- assertEquals("3#projA:unexpected custom value for task tags option", "", projectA.getOption(JavaCore.COMPILER_TASK_TAGS, false));
- assertEquals("3#projA:unexpected custom value for inherited task tags option", "", projectA.getOption(JavaCore.COMPILER_TASK_TAGS, true));
- assertEquals("3#workspace:unexpected custom value for task tags option", "@TODO", JavaCore.getOption(JavaCore.COMPILER_TASK_TAGS));
-
- } finally {
- this.deleteProject("A");
- }
-}
-
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
deleted file mode 100644
index 2bea890..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
+++ /dev/null
@@ -1,868 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
-
-public class ReconcilerTests extends ModifyingResourceTests {
-
- protected ICompilationUnit cu;
- protected ICompilationUnit workingCopy;
- protected ProblemRequestor problemRequestor;
-
- class ProblemRequestor implements IProblemRequestor {
- StringBuffer problems;
- int problemCount;
- public ProblemRequestor() {
- this.initialize();
- }
- public void acceptProblem(IProblem problem) {
- problems.append(++problemCount + (problem.isError() ? ". ERROR" : ". WARNING"));
- problems.append(" in " + new String(problem.getOriginatingFileName()));
- try {
- problems.append(((DefaultProblem)problem).errorReportSource((org.eclipse.jdt.internal.compiler.env.ICompilationUnit)(workingCopy == null ? cu : workingCopy)));
- problems.append("\n");
- problems.append(problem.getMessage());
- problems.append("\n");
- } catch (Exception e) {
- }
- }
- public void beginReporting() {
- this.problems.append("----------\n");
- }
- public void endReporting() {
- problems.append("----------\n");
- }
- public boolean isActive() {
- return true;
- }
- public void initialize() {
- this.problems = new StringBuffer();
- this.problemCount = 0;
- }
- }
-
-/**
- */
-public ReconcilerTests(String name) {
- super(name);
-}
-protected void assertProblems(String message, String expected) {
- String actual = this.problemRequestor.problems.toString();
- if (!expected.equals(actual)){
- System.out.println(Util.displayString(actual, 2));
- }
- assertEquals(
- message,
- expected,
- actual);
-}
-/**
- * Setup for the next test.
- */
-public void setUp() throws Exception {
- super.setUp();
- this.cu = getCompilationUnit("Reconciler", "src", "p1", "X.java");
- this.problemRequestor = new ProblemRequestor();
- this.workingCopy = (ICompilationUnit)cu.getWorkingCopy(null, null, this.problemRequestor);
- this.problemRequestor.initialize();
- this.startDeltas();
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.createJavaProject("Reconciler", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin");
- this.createFolder("/Reconciler/src/p1");
- this.createFolder("/Reconciler/src/p2");
- this.createFile(
- "/Reconciler/src/p1/X.java",
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}"
- );
-}
-public static Test suite() {
- return new Suite(ReconcilerTests.class);
-}
-/**
- * Cleanup after the previous test.
- */
-public void tearDown() throws Exception {
- if (this.workingCopy != null) {
- this.workingCopy.destroy();
- }
- this.stopDeltas();
- super.tearDown();
-}
-public void tearDownSuite() throws Exception {
- this.deleteProject("Reconciler");
- super.tearDownSuite();
-}
-/**
- * Ensures that the reconciler handles duplicate members correctly.
- */
-public void testAddDuplicateMember() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[+]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents, updating the structure of this reconciler's compilation
- * unit, and fires the Java element delta for the structural changes
- * of the addition of a field and a constructor.
- */
-public void testAddFieldAndConstructor() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " int i;\n" +
- " X(int i) {\n" +
- " this.i = i;\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " i[+]: {}\n" +
- " X[+]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents, updating the structure of this reconciler's compilation
- * unit, and fires the Java element delta for the structural changes
- * of the addition of a field and a constructor.
- */
-public void testAddImports() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "import java.lang.reflect.*;\n" +
- "import java.util.Vector;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "[import container][*]: {CHILDREN | FINE GRAINED}\n" +
- " import java.lang.reflect.*[+]: {}\n" +
- " import java.util.Vector[+]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents, updating the structure of this reconciler's compilation
- * unit, and fires the Java element delta for the structural changes
- * of the addition of a method.
- */
-public void testAddMethod1() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- " public void bar() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " bar[+]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents,updating the structure of this reconciler's compilation
- * unit, and fires the Java element delta for the structural changes
- * of the addition of a portion of a new method.
- */
-public void testAddPartialMethod1() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void some()\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " some[+]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents,updating the structure of this reconciler's compilation
- * unit, and fires the Java element delta for the structural changes
- * of the addition of a portion of a new method. Ensures that when a
- * second part is added to the new method no structural changes are recognized.
- */
-public void testAddPartialMethod1and2() throws JavaModelException {
- // Add partial method before foo
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void some()\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
-
- // Add { on partial method
- this.clearDeltas();
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void some() {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- ""
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents,updating the structure of this reconciler's compilation
- * unit, and fires the Java element deltas for the structural changes
- * of a method visibility change.
- */
-public void testChangeMethodVisibility() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " private void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[*]: {MODIFIERS CHANGED}"
- );
-}
-/**
- * Ensures that a reference to a constant with type mismatch doesn't show an error.
- * (regression test for bug 17104 Compiler does not complain but "Quick Fix" ??? complains)
- */
-public void testConstantReference() throws CoreException {
- try {
- this.createFile(
- "/Reconciler/src/p1/OS.java",
- "package p1;\n" +
- "public class OS {\n" +
- " public static final int CONST = 23 * 1024;\n" +
- "}");
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "public class X {\n" +
- " public short c;\n" +
- " public static void main(String[] arguments) {\n" +
- " short c = 1;\n" +
- " switch (c) {\n" +
- " case OS.CONST: return;\n" +
- " }\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- } finally {
- this.deleteFile("/Reconciler/src/p1/OS.java");
- }
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents, updating the structure of this reconciler's compilation
- * unit, and fires the Java element deltas for the structural changes
- * of a method being deleted.
- */
-public void testDeleteMethod1() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[-]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents, updating the structure of this reconciler's compilation
- * unit, and fires the Java element deltas for the structural changes
- * of two methods being deleted.
- */
-public void testDeleteTwoMethods() throws JavaModelException {
- // create 2 methods
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- " public void bar() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
-
- // delete the 2 methods
- this.clearDeltas();
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " bar[-]: {}\n" +
- " foo[-]: {}"
- );
-}
-/**
- * Start with no imports, add an import, and then append to the import name.
- */
-public void testGrowImports() throws JavaModelException {
- // no imports
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "public class X {\n" +
- "}");
- this.workingCopy.reconcile();
-
- // add an import
- this.clearDeltas();
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p\n" +
- "public class X {\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "[import container][+]: {}"
- );
-
- // append to import name
- this.clearDeltas();
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2\n" +
- "public class X {\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "[import container][*]: {CHILDREN | FINE GRAINED}\n" +
- " import p2[+]: {}\n" +
- " import p[-]: {}"
- );
-}
-/**
- * Introduces a syntax error in the modifiers of a method.
- */
-public void testMethodWithError() throws JavaModelException, CoreException {
- // Introduce syntax error
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public.void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta after syntax error",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[*]: {MODIFIERS CHANGED}"
- );
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " public.void foo() {\n" +
- " ^\n" +
- "Syntax error on token \".\", \"boolean\", \"void\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"float\", \"double\", \"Identifier\", \"interface\", \"class\" expected\n" +
- "----------\n"
- );
-
- // Fix the syntax error
- this.clearDeltas();
- this.problemRequestor.initialize();
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta after fixing syntax error",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " foo[*]: {MODIFIERS CHANGED}"
- );
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. WARNING in X.java (at line 2)\n" +
- " import p2.*;\n" +
- " ^^\n" +
- "The import p2 is never used\n" +
- "----------\n"
- );
-}
-/**
- * Test reconcile force flag
- */
-public void testMethodWithError2() throws JavaModelException, CoreException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public.void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- this.problemRequestor.initialize();
-
- // use force flag to refresh problems
- this.workingCopy.reconcile(true, null);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " public.void foo() {\n" +
- " ^\n" +
- "Syntax error on token \".\", \"boolean\", \"void\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"float\", \"double\", \"Identifier\", \"interface\", \"class\" expected\n" +
- "----------\n"
- );
-}
-
-/**
- * Test reconcile force flag off
- */
-public void testMethodWithError3() throws JavaModelException, CoreException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public.void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- this.problemRequestor.initialize();
-
- // use force flag to refresh problems
- this.workingCopy.reconcile(false, null);
- assertProblems(
- "Unexpected problems",
- ""
- );
-}
-/**
- * Test reconcile force flag + cancel
- */
-public void testMethodWithError4() throws JavaModelException, CoreException {
-
- final IProgressMonitor myMonitor = new IProgressMonitor() {
- boolean isCanceled = false;
- public void beginTask(String name, int totalWork) {}
- public void done() {}
- public void internalWorked(double work) {}
- public boolean isCanceled() {
- return this.isCanceled;
- }
- public void setCanceled(boolean value) {
- this.isCanceled = value;
- }
- public void setTaskName(String name) {}
- public void subTask(String name) {}
- public void worked(int work) {}
- };
-
- class CancelingProblemRequestor extends ProblemRequestor {
- boolean isCanceling = false;
- public void acceptProblem(IProblem problem) {
- if (isCanceling) myMonitor.setCanceled(true); // auto-cancel on first problem
- super.acceptProblem(problem);
- }
- };
- CancelingProblemRequestor myPbRequestor = new CancelingProblemRequestor();
-
- this.workingCopy.destroy();
- ICompilationUnit x = getCompilationUnit("Reconciler", "src", "p1", "X.java");
- this.problemRequestor = myPbRequestor;
- this.workingCopy = (ICompilationUnit) x.getWorkingCopy(null, null,this.problemRequestor);
-
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "public class X {\n" +
- " Zork f; \n"+
- " void foo(Zork z){\n"+
- " }\n"+
- "} \n");
-
- this.workingCopy.reconcile();
- this.problemRequestor.initialize();
-
- // use force flag to refresh problems
- myPbRequestor.isCanceling = true;
- this.workingCopy.reconcile(true, myMonitor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " Zork f; \n" +
- " ^^^^\n" +
- "Zork cannot be resolved (or is not a valid type) for the field X.f\n" +
- "----------\n"
- );
-}
-
-/**
- * Test reconcile force flag off
- */
-public void testMethodWithError5() throws JavaModelException, CoreException {
- try {
- this.createFolder("/Reconciler/src/tests");
- this.createFile(
- "/Reconciler/src/tests/AbstractSearchableSource.java",
- "package tests; \n"+
- "abstract class AbstractSearchableSource extends AbstractSource implements SearchableSource { \n"+
- " abstract int indexOfImpl(long value); \n"+
- " public final int indexOf(long value) { \n"+
- " return indexOfImpl(value); \n"+
- " } \n"+
- "} \n");
-
- this.createFile(
- "/Reconciler/src/tests/Source.java",
- "package tests; \n"+
- "interface Source { \n"+
- " long getValue(int index); \n"+
- " int size(); \n"+
- "} \n");
-
- this.createFile(
- "/Reconciler/src/tests/AbstractSource.java",
- "package tests; \n"+
- "abstract class AbstractSource implements Source { \n"+
- " AbstractSource() { \n"+
- " } \n"+
- " void invalidate() { \n"+
- " } \n"+
- " abstract long getValueImpl(int index); \n"+
- " abstract int sizeImpl(); \n"+
- " public final long getValue(int index) { \n"+
- " return 0; \n"+
- " } \n"+
- " public final int size() { \n"+
- " return 0; \n"+
- " } \n"+
- "} \n");
-
- this.createFile(
- "/Reconciler/src/tests/SearchableSource.java",
- "package tests; \n"+
- "interface SearchableSource extends Source { \n"+
- " int indexOf(long value); \n"+
- "} \n");
-
- ICompilationUnit compilationUnit = getCompilationUnit("Reconciler", "src", "tests", "AbstractSearchableSource.java");
- ProblemRequestor pbReq = new ProblemRequestor();
- IWorkingCopy wc = (ICompilationUnit)compilationUnit.getWorkingCopy(null, null, pbReq);
- pbReq.initialize();
- this.startDeltas();
- wc.reconcile(true, null);
- String actual = pbReq.problems.toString();
- String expected =
- "----------\n" +
- "----------\n";
- if (!expected.equals(actual)){
- System.out.println(Util.displayString(actual, 2));
- }
- assertEquals(
- "unexpected errors",
- expected,
- actual);
- } finally {
- this.deleteFile("/Reconciler/src/tests/AbstractSearchableSource.java");
- this.deleteFile("/Reconciler/src/tests/SearchableSource.java");
- this.deleteFile("/Reconciler/src/tests/Source.java");
- this.deleteFile("/Reconciler/src/tests/AbstractSource.java");
- this.deleteFolder("/Reconciler/src/tests");
- }
-}
-/*
- * Test that the creation of a working copy detects errors
- * (regression test for bug 33757 Problem not detected when opening a working copy)
- */
-public void testMethodWithError6() throws JavaModelException, CoreException {
- this.workingCopy.destroy(); // don't use the one created in setUp()
- this.workingCopy = null;
- try {
- this.createFile(
- "/Reconciler/src/p1/Y.java",
- "package p1;\n" +
- "public class Y {\n" +
- " public.void foo() {\n" +
- " }\n" +
- "}"
- );
- this.cu = getCompilationUnit("Reconciler", "src", "p1", "Y.java");
- this.problemRequestor = new ProblemRequestor();
- this.problemRequestor.initialize();
- this.workingCopy = (ICompilationUnit)this.cu.getWorkingCopy(null, null, this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in Y.java (at line 3)\n" +
- " public.void foo() {\n" +
- " ^\n" +
- "Syntax error on token \".\", \"boolean\", \"void\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"float\", \"double\", \"Identifier\", \"interface\", \"class\" expected\n" +
- "----------\n"
- );
- } finally {
- this.deleteFile("/Reconciler/src/p1/Y.java");
- }
-}
-/*
- * Test that the opening of a working copy detects errors
- * (regression test for bug 33757 Problem not detected when opening a working copy)
- */
-public void testMethodWithError7() throws JavaModelException, CoreException {
- this.workingCopy.destroy(); // don't use the one created in setUp()
- this.workingCopy = null;
- try {
- this.createFile(
- "/Reconciler/src/p1/Y.java",
- "package p1;\n" +
- "public class Y {\n" +
- " public.void foo() {\n" +
- " }\n" +
- "}"
- );
- this.cu = getCompilationUnit("Reconciler", "src", "p1", "Y.java");
- this.problemRequestor = new ProblemRequestor();
- this.workingCopy = (ICompilationUnit)this.cu.getWorkingCopy(null, null, this.problemRequestor);
-
- // Close working copy
- this.workingCopy.close();
-
- // Reopen should detect syntax error
- this.problemRequestor.initialize();
- this.workingCopy.open(null);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in Y.java (at line 3)\n" +
- " public.void foo() {\n" +
- " ^\n" +
- "Syntax error on token \".\", \"boolean\", \"void\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"float\", \"double\", \"Identifier\", \"interface\", \"class\" expected\n" +
- "----------\n"
- );
- } finally {
- this.deleteFile("/Reconciler/src/p1/Y.java");
- }
-}
-/**
- * Ensures that the reconciler handles member move correctly.
- */
-public void testMoveMember() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- " public void bar() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- this.clearDeltas();
-
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void bar() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " bar[*]: {REORDERED}\n" +
- " foo[*]: {REORDERED}"
- );
-}
-/**
- * Ensures that the reconciler does nothing when the source
- * to reconcile with is the same as the current contents.
- */
-public void testNoChanges1() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(this.workingCopy.getSource());
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- ""
- );
-}
-/**
- * Ensures that the reconciler does nothing when the source
- * to reconcile with has the same structure as the current contents.
- */
-public void testNoChanges2() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " System.out.println()\n" +
- " }\n" +
- "}"
- );
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- ""
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents, updating the structure of this reconciler's compilation
- * unit, and fires the Java element deltas for the structural changes
- * of a renaming a method; the original method deleted and the new method added structurally.
- */
-public void testRenameMethod1() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void bar() {\n" +
- " }\n" +
- "}"
- );
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " bar[+]: {}\n" +
- " foo[-]: {}"
- );
-}
-/**
- * Ensures that the reconciler reconciles the new contents with the current
- * contents,updating the structure of this reconciler's compilation
- * unit, and fires the Java element delta for the structural changes
- * of the addition of a portion of a new method.
- */
-public void testRenameWithSyntaxError() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "import p2.*;\n" +
- "public class X {\n" +
- " public void bar( {\n" +
- " }\n" +
- "}"
- );
- this.workingCopy.reconcile();
- assertDeltas(
- "Unexpected delta",
- "X[*]: {CHILDREN | FINE GRAINED}\n" +
- " bar[+]: {}\n" +
- " foo[-]: {}"
- );
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " public void bar( {\n" +
- " ^\n" +
- "Syntax error on token \"{\", \"float\", \"double\", \"byte\", \"short\", \"int\", \"long\", \"char\", \"boolean\", \"void\", \"Identifier\" expected\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " public void bar( {\n" +
- " ^\n" +
- "Unmatched bracket\n" +
- "----------\n"
- );
-}
-/**
- * Ensure that an unhandled exception is detected.
- */
-public void testUnhandledException() throws JavaModelException {
- this.workingCopy.getBuffer().setContents(
- "package p1;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " throw new Exception();\n" +
- " }\n" +
- "}"
- );
- this.workingCopy.reconcile();
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " throw new Exception();\n" +
- " ^^^^^^^^^^^^^^^^^^^^^\n" +
- "Unhandled exception type Exception\n" +
- "----------\n"
- );
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java
deleted file mode 100644
index 75e5b4b..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFile;
-
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
-
-public class RenameTests extends CopyMoveTests {
- ICompilationUnit cu;
-/**
- */
-public RenameTests(String name) {
- super(name);
-}
-/**
- * Attempts to rename the elements with optional
- * forcing. The operation should fail with the failure code.
- */
-public void renameNegative(IJavaElement[] elements ,String[] renamings, boolean force, int failureCode) throws JavaModelException {
- try {
- //rename
- getJavaModel().rename(elements, new IJavaElement[]{elements[0].getParent()}, renamings, force, null);
- } catch (JavaModelException jme) {
- assertTrue("Code not correct for JavaModelException: " + jme, jme.getStatus().getCode() == failureCode);
- return;
- }
- assertTrue("The rename should have failed for multiple renaming", false);
- return;
-}
-/**
- * Attempts to rename the element with optional
- * forcing. The operation should fail with the failure code.
- */
-public void renameNegative(IJavaElement element, String rename, boolean force, int failureCode) throws JavaModelException {
- try {
- //rename
- getJavaModel().rename(new IJavaElement[] {element}, new IJavaElement[] {element.getParent()}, new String[] {rename}, force, null);
- } catch (JavaModelException jme) {
- assertTrue("Code not correct for JavaModelException: " + jme, jme.getStatus().getCode() == failureCode);
- return;
- }
- assertTrue("The rename should have failed for: " + element, false);
- return;
-}
-/**
- * Renames the element to the container with optional
- * forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void renamePositive(IJavaElement[] elements, String[] names, boolean force) throws JavaModelException {
- renamePositive(elements, new IJavaElement[]{elements[0].getParent()}, names, force);
-}
-/**
- * Renames the element to the container with optional
- * forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void renamePositive(IJavaElement[] elements, IJavaElement[] destinations, String[] names, boolean force) throws JavaModelException {
- renamePositive(elements, destinations, names, force, false);
-}
-/**
- * Renames the element to the container with optional
- * forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void renamePositive(IJavaElement[] elements, IJavaElement[] destinations, String[] names, boolean force, boolean originalShouldExist) throws JavaModelException {
- renamePositive(elements, destinations, names, force, originalShouldExist, null);
-}
-/**
- * Renames the element to the container with optional
- * forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void renamePositive(IJavaElement[] elements, IJavaElement[] destinations, String[] names, boolean force, boolean originalShouldExist, IProgressMonitor monitor) throws JavaModelException {
- // if forcing, ensure that a name collision exists
- int i;
- if (force) {
- for (i = 0; i < elements.length; i++) {
- IJavaElement e = elements[i];
- IJavaElement collision = generateHandle(e, names[i], e.getParent());
- assertTrue("Collision does not exist", collision.exists());
- }
- }
-
- // rename
- getJavaModel().rename(elements, destinations, names, force, monitor);
- for (i = 0; i < elements.length; i++) {
- // generate the new element handle
- IJavaElement e = elements[i];
- IJavaElement renamed = generateHandle(e, names[i], e.getParent());
- assertTrue("Renamed element should exist", renamed.exists());
- if (!originalShouldExist) {
- assertTrue("Original element should not exist", !e.exists());
- }
- IJavaElementDelta destDelta = getDeltaFor(renamed.getParent());
- if (isMainType(e, e.getParent())) {
- assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED);
- assertTrue("Added children not correct for element copy", destDelta.getElement().equals(renamed.getParent()));
- assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0);
- assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(e.getParent()));
- } else {
- assertTrue("Destination container not changed", destDelta != null && deltaChildrenChanged(destDelta));
- IJavaElementDelta[] deltas = destDelta.getAddedChildren();
- assertTrue("Added children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(renamed));
- assertTrue("kind should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED);
- deltas = destDelta.getRemovedChildren();
- assertTrue("Removed children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(e));
- assertTrue("kind should be K_REMOVED", deltas[i].getKind() == IJavaElementDelta.REMOVED);
- }
- }
-}
-/**
- * Renames the element to the container with optional
- * forcing. The operation should succeed, so any exceptions
- * encountered are thrown.
- */
-public void renamePositive(IJavaElement element, String rename, boolean force) throws JavaModelException {
- renamePositive(new IJavaElement[] {element}, new String[] {rename}, force);
-}
-/**
- * Setup for the next test.
- */
-public void setUp() throws Exception {
- super.setUp();
-
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFile(
- "/P/src/X.java",
- "public class X {\n" +
- " boolean other;\n" +
- " int bar;\n" +
- " {\n" +
- " bar = 1;\n" +
- " }\n" +
- " X(int i) {\n" +
- " }\n" +
- " void otherMethod(String s) {\n" +
- " }\n" +
- " void foo(String s) {\n" +
- " }\n" +
- "}"
- );
- this.cu = getCompilationUnit("/P/src/X.java");
-
- startDeltas();
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- IJavaProject project = this.createJavaProject("BinaryProject", new String[] {"src"}, new String[] {"JCL_LIB"}, "lib");
- this.createFile(
- "/BinaryProject/src/X.java",
- "public class X {\n" +
- " int bar;\n" +
- " public void foo() {\n" +
- " }\n" +
- "}"
- );
- project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
- project.setRawClasspath(
- new IClasspathEntry[] {
- JavaCore.newLibraryEntry(new Path("/BinaryProject/lib"), null, null)
- },
- null
- );
-}
-public static Test suite() {
- return new Suite(RenameTests.class);
-}
-/**
- * Cleanup after the previous test.
- */
-public void tearDown() throws Exception {
- stopDeltas();
- this.deleteProject("P");
-
- super.tearDown();
-}
-public void tearDownSuite() throws Exception {
- this.deleteProject("BinaryProject");
- super.tearDownSuite();
-}
-/**
- * Ensures that a binary field cannot be renamed.
- */
-public void testRenameBinaryField() throws JavaModelException {
- IClassFile cf = getClassFile("BinaryProject", "lib", "", "X.class");
- IField binaryField = cf.getType().getField("bar");
- renameNegative(binaryField, "fred", false, IJavaModelStatusConstants.READ_ONLY);
-}
-/**
- * Ensures that a binary method cannot be renamed.
- */
-public void testRenameBinaryMethod() throws JavaModelException {
- IClassFile cf = getClassFile("BinaryProject", "lib", "", "X.class");
- IMethod binaryMethod = cf.getType().getMethods()[0];
- renameNegative(binaryMethod, "fred", false, IJavaModelStatusConstants.READ_ONLY);
-}
-/**
- * Ensures that a binary type cannot be renamed.
- */
-public void testRenameBinaryType() throws JavaModelException {
- IClassFile cf = getClassFile("BinaryProject", "lib", "", "X.class");
- IType binaryType = cf.getType();
- renameNegative(binaryType, "Y", false, IJavaModelStatusConstants.READ_ONLY);
-}
-
-/**
- * This operation should fail as renaming a CU and a CU member at the
- * same time is not supported.
- */
-public void testRenameCompilationUnitAndType() throws CoreException {
- renameNegative(
- new IJavaElement[] {this.cu, this.cu.getType("X")},
- new String[]{"Y.java", "Y"},
- false,
- IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
-}
-/**
- * Ensures that compilation units cannot be renamed to an existing cu name
- * unless the force flag is set.
- */
-public void testRenameCompilationUnitResultingInCollision() throws CoreException{
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
-
- renameNegative(this.cu, "Y.java", false, IJavaModelStatusConstants.NAME_COLLISION);
- renamePositive(this.cu, "Y.java", true);
-}
-/**
- * Ensures that compilation units can be renamed.
- * Verifies that the proper change deltas are generated as a side effect
- * of running the operation.
- */
-public void testRenameCompilationUnitsCheckingDeltas() throws CoreException{
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
- ICompilationUnit cu2 = this.getCompilationUnit("/P/src/Y.java");
-
- clearDeltas();
- renamePositive(
- new ICompilationUnit[] {this.cu, cu2},
- new String[] {"NewX.java", "NewY.java"},
- false);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[-]: {MOVED_TO(NewX.java [in [default] [in src [in P]]])}\n" +
- " NewX.java[+]: {MOVED_FROM(X.java [in [default] [in src [in P]]])}\n" +
- " Y.java[-]: {MOVED_TO(NewY.java [in [default] [in src [in P]]])}\n" +
- " NewY.java[+]: {MOVED_FROM(Y.java [in [default] [in src [in P]]])}"
- );
-}
-/**
- * Ensures that a compilation unit cannot be renamed to an invalid name.
- * The new name for a cu must end in .java and be a valid Java identifier.
- */
-public void testRenameCompilationUnitWithInvalidName() throws JavaModelException {
- renameNegative(this.cu, "NewX", false, IJavaModelStatusConstants.INVALID_NAME);
- renameNegative(this.cu, "New X.java", false, IJavaModelStatusConstants.INVALID_NAME);
-}
-/**
- * This operation should fail as renaming a CU with a null name should throw
- * an <code>IllegalArgumentException</code>
- */
-public void testRenameCompilationUnitWithNull() throws JavaModelException {
- try {
- this.cu.rename(null, false, null);
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Should not be able to rename a cu with a null name", false);
-}
-/**
- * Ensures that a construtor cannot be renamed using the
- * <code>RenameElementsOperation</code>.
- */
-public void testRenameConstructor() throws JavaModelException {
- IMethod constructor = this.cu.getType("X").getMethod("X", new String[] {"I"});
- renameNegative(constructor, "newName", false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-
-/**
- *
- */
-public void testRenameCU() throws CoreException {
- this.cu.rename("NewX.java", false, null);
- assertTrue("Original CU should not exist", !cu.exists());
-
- ICompilationUnit newCU = getCompilationUnit("/P/src/NewX.java");
- assertTrue("New CU should exist", newCU.exists());
-
- assertTypesEqual(
- "Unexpected types",
- "NewX\n",
- newCU.getAllTypes());
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[-]: {MOVED_TO(NewX.java [in [default] [in src [in P]]])}\n" +
- " NewX.java[+]: {MOVED_FROM(X.java [in [default] [in src [in P]]])}"
- );
-}
-public void testRenameCUForce() throws CoreException {
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- "}"
- );
-
- clearDeltas();
- this.cu.rename("Y.java", true, null);
-
- IFile file = (IFile)this.cu.getResource();
- ICompilationUnit destCU = getCompilationUnit("/P/src/Y.java");
- IFile destFile = (IFile)destCU.getResource();
-
- assertTrue("Original CU should not exist", !cu.exists());
- assertTrue("Original file should not exist", !file.exists());
- assertTrue("Destination CU should exist", destCU.exists());
- assertTrue("Destination file should exist", destFile.exists());
-
- assertTypesEqual(
- "Unexpected types",
- "Y\n",
- destCU.getAllTypes());
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[-]: {MOVED_TO(Y.java [in [default] [in src [in P]]])}\n" +
- " Y.java[+]: {MOVED_FROM(X.java [in [default] [in src [in P]]])}"
- );
-}
-/*
- * Ensures that renaming an empty package fragment doesn't make it disappear
- * (regression test for bug 24505 Refactoring an empty package makes it disappears)
- */
-public void testRenameEmptyPF() throws CoreException {
- this.createFolder("/P/src/x/y/z");
-
- clearDeltas();
- getPackage("/P/src/x/y/z").rename("x.y", false, null);
-
- IPackageFragment newFrag = getPackage("/P/src/x/y");
- assertTrue("New package should exist", newFrag.exists());
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " x.y.z[-]: {MOVED_TO(x.y [in src [in P]])}\n" +
- " x.y[+]: {MOVED_FROM(x.y.z [in src [in P]])}"
- );
-}
-/**
- * Ensures that fields can be renamed.
- * Verifies that the proper change deltas are generated as a side effect
- * of running the operation. As well ensures that the fields are
- * positioned in the same location as before the rename.
- */
-public void testRenameFieldsCheckingDeltasAndPositions() throws JavaModelException {
- IType type = this.cu.getType("X");
- IField field = type.getField("bar");
- renamePositive(field, "fred", false);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
- " fred[+]: {}\n" +
- " bar[-]: {}"
- );
- ensureCorrectPositioning((IParent)type, type.getField("fred"), type.getField("other"));
-}
-/**
- * Ensures that fields can be renamed even if one of the renamings fails.
- */
-public void testRenameFieldsMultiStatus() throws CoreException {
- String addition = "multiStatus";
- IType type = this.cu.getType("X");
- IField[] iFields = type.getFields();
- String[] newNames = new String[iFields.length];
- int i;
- for (i = 0; i < iFields.length; i++) {
- IField f = iFields[i];
- newNames[i] = addition + f.getElementName();
- }
- newNames[1] = ";"; //invalid name
-
- boolean e = false;
- try {
- type.getJavaModel().rename(iFields, new IJavaElement[] {type}, newNames, false, null);
- } catch (JavaModelException jme) {
- assertTrue("Should not be multistatus (only one failure)", !jme.getStatus().isMultiStatus());
- assertTrue("Should be an invalid destination", jme.getStatus().getCode() == IJavaModelStatusConstants.INVALID_NAME);
- e = true;
- }
- assertTrue("Should have been an exception", e);
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " [default][*]: {CHILDREN}\n" +
- " X.java[*]: {CHILDREN | FINE GRAINED}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
- " multiStatusother[+]: {}\n" +
- " other[-]: {}"
- );
-
- IJavaElement copy = generateHandle(iFields[0], newNames[0], type);
- assertTrue("Copy should exist", copy.exists());
-}
-/**
- * Ensures that fields cannot be renamed to the same name.
- */
-public void testRenameFieldsResultingInCollision() throws JavaModelException {
- String addition = "new";
- IType type= this.cu.getType("X");
- IField[] iFields = type.getFields();
- String[] newNames = new String[iFields.length];
- int i;
- for (i = 0; i < iFields.length; i++) {
- IField f = iFields[i];
- newNames[i] = addition + f.getElementName();
- }
- //set two fields to have the same new name
- newNames[i-1]= newNames[i-2];
-
- renameNegative(iFields, newNames, false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that renaming can be canceled.
- */
-public void testRenameFieldsWithCancel() throws CoreException {
- boolean isCanceled = false;
- String addition = "new1";
- IType type = RenameTests.this.cu.getType("X");
- IField[] iFields = type.getFields();
- String[] newNames = new String[iFields.length];
- int i;
- for (i = 0; i < iFields.length; i++) {
- IField f = iFields[i];
- newNames[i] = addition + f.getElementName();
- }
- try {
- TestProgressMonitor monitor = TestProgressMonitor.getInstance();
- monitor.setCancelledCounter(1);
- renamePositive(iFields, new IJavaElement[] {type}, newNames, false, false, monitor);
- } catch (OperationCanceledException e) {
- isCanceled = true;
- }
- assertTrue("Operation should have thrown an operation canceled exception", isCanceled);
-}
-/**
- * Ensures that an initializer cannot be renamed.
- */
-public void testRenameInitializer() throws JavaModelException {
- IType typeSource= this.cu.getType("X");
- IInitializer initializerSource= typeSource.getInitializer(1);
-
- renameNegative(initializerSource, "someName", false, IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
-}
-/**
- * Ensures that main types can be renamed. As a side effect
- * of renaming the main types, the types' enclosing compilation unit
- * are renamed as well.
- */
-public void testRenameMainTypes() throws CoreException {
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " public Y() {\n" +
- " }\n" +
- "}"
- );
- ICompilationUnit cu2 = getCompilationUnit("/P/src/Y.java");
- IPackageFragment pkg = (IPackageFragment) this.cu.getParent();
-
- IJavaElement[] types = new IJavaElement[] {
- this.cu.getType("X"),
- cu2.getType("Y")
- };
- String[] newNames = new String[] {"NewX", "NewY"};
- renamePositive(
- new IJavaElement[] {
- this.cu.getType("X"),
- cu2.getType("Y")
- },
- new IJavaElement[] {
- types[0].getParent(),
- types[1].getParent()},
- newNames,
- false);
-
- //test that both the compilation unit, main type and constructors have been renamed.
- ICompilationUnit renamedCU1= pkg.getCompilationUnit("NewX.java");
- ICompilationUnit renamedCU2= pkg.getCompilationUnit("NewY.java");
- IType newType1 = renamedCU1.getType("NewX");
- IType newType2 = renamedCU2.getType("NewY");
- assertTrue("NewX should be present", newType1.exists());
- assertTrue("NewY should be present", newType2.exists());
-
- IMethod constructor1 = newType1.getMethod("NewX", new String[] {"I"});
- IMethod constructor2 = newType2.getMethod("NewY", new String[] {});
- assertTrue("NewX(int) should be present", constructor1.exists());
- assertTrue("NewY() should be present", constructor2.exists());
-}
-/**
- * Ensures that main types can be renamed as well as a child of a main type. As a side effect
- * of renaming the main types, the types enclosing compilation unit
- * are renamed as well.
- * @see 1FTKMBD: ITPJCORE:ALL - JM- Cannot rename parent and child with the same operation
- */
-public void testRenameMainTypesAndAChild() throws CoreException {
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " public Y() {\n" +
- " }\n" +
- "}"
- );
- ICompilationUnit cu2 = getCompilationUnit("/P/src/Y.java");
-
- String[] newNames = new String[] {
- "newBar",
- "NewX",
- "NewY"
- };
- IJavaElement[] elements = new IJavaElement[] {
- this.cu.getType("X").getField("bar"),
- this.cu.getType("X"),
- cu2.getType("Y")
- };
- IJavaElement[] destinations = new IJavaElement[elements.length];
- for (int i = 0; i < elements.length; i++) {
- destinations[i] = elements[i].getParent();
- }
-
- getJavaModel().rename(elements, destinations, newNames, false, null);
-
- //test that both the compilation unit and the main type have been renamed.
- IPackageFragment pkg = (IPackageFragment) this.cu.getParent();
- ICompilationUnit renamedCU1= pkg.getCompilationUnit("NewX.java");
- IType newX = renamedCU1.getType("NewX");
- assertTrue("NewX should be present", newX.exists());
-
- ICompilationUnit renamedCU2= pkg.getCompilationUnit("NewY.java");
- IType newY = renamedCU2.getType("NewY");
- assertTrue("NewY should be present", newY.exists());
-
- IField newBar = newX.getField("newBar");
- assertTrue("Renamed field should exist", newBar.exists());
-}
-/**
- * Ensures that a method can be renamed.
- */
-public void testRenameMethod() throws JavaModelException {
- IType type = this.cu.getType("X");
- IMethod method = type.getMethod("foo", new String[] {"QString;"});
- renamePositive(method, "newFoo", false);
-
- //ensure that the method did not move as a result of the rename
- ensureCorrectPositioning(
- type,
- type.getMethod("newFoo", new String[] {"QString;"}),
- type.getMethod("otherMethod", new String[] {"QString;"}));
-}
-/**
- * Ensures that a method cannot be renamed to an existing method name.
- */
-public void testRenameMethodResultingInCollision() throws JavaModelException {
- IType type = this.cu.getType("X");
- IMethod method = type.getMethod("foo", new String[] {"QString;"});
- renameNegative(method, "otherMethod", false, IJavaModelStatusConstants.NAME_COLLISION);
-}
-/**
- * Ensures that a method cannot be renamed to an invalid method name
- */
-public void testRenameMethodsWithInvalidName() throws JavaModelException {
- IMethod method = this.cu.getType("X").getMethod("foo", new String[] {"QString;"});
- renameNegative(method, "%%someInvalidName", false, IJavaModelStatusConstants.INVALID_NAME);
-}
-public void testRenamePF() throws CoreException {
- this.createFolder("/P/src/x/y/z");
- this.createFile(
- "/P/src/x/y/z/A.java",
- "package x.y.z;\n" +
- "public class A {\n" +
- "}"
- );
-
- IPackageFragment frag = getPackage("/P/src/x/y/z");
- clearDeltas();
- frag.rename("x.y.newZ", false, null);
-
- IPackageFragment newFrag = getPackage("/P/src/x/y/newZ");
- assertTrue("Old package should not exist", !frag.exists());
- assertTrue("New package should exist", newFrag.exists());
-
- ICompilationUnit compilationUnit = newFrag.getCompilationUnit("A.java");
- assertTrue("A.java should exits in new package", compilationUnit.exists());
-
- IType[] types = compilationUnit.getTypes();
- assertTrue(types != null && types.length == 1);
- IType mainType = types[0];
- assertEquals(
- "Unexpected A.java's main type'",
- "x.y.newZ.A",
- mainType.getFullyQualifiedName());
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " x.y.z[-]: {MOVED_TO(x.y.newZ [in src [in P]])}\n" +
- " x.y.newZ[+]: {MOVED_FROM(x.y.z [in src [in P]])}"
- );
-}
-/*
- * Ensures that renaming to a name containing spaces works
- * (regression test for bug 21957 'refactor rename' allows subpackage name to start with a space)
- */
-public void testRenamePF2() throws CoreException {
- this.createFolder("/P/src/x/y/z");
- this.createFile(
- "/P/src/x/y/z/A.java",
- "package x.y.z;\n" +
- "public class A {\n" +
- "}"
- );
-
- IPackageFragment frag = getPackage("/P/src/x/y/z");
- clearDeltas();
- frag.rename("x.y. z2", false, null);
-
- IPackageFragment newFrag = getPackage("/P/src/x/y/z2");
- assertTrue("Old package should not exist", !frag.exists());
- assertTrue("New package should exist", newFrag.exists());
-
- ICompilationUnit compilationUnit = newFrag.getCompilationUnit("A.java");
- assertTrue("A.java should exits in new package", compilationUnit.exists());
-
- IType[] types = compilationUnit.getTypes();
- assertTrue(types != null && types.length == 1);
- IType mainType = types[0];
- assertEquals(
- "Unexpected A.java's main type'",
- "x.y.z2.A",
- mainType.getFullyQualifiedName());
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " x.y.z[-]: {MOVED_TO(x.y.z2 [in src [in P]])}\n" +
- " x.y.z2[+]: {MOVED_FROM(x.y.z [in src [in P]])}"
- );
-}
-public void testRenamePFWithSubPackages() throws CoreException {
- this.createFolder("/P/src/x/y/z");
- this.createFile(
- "/P/src/x/y/z/A.java",
- "package x.y.z;\n" +
- "public class A {\n" +
- "}"
- );
-
- clearDeltas();
- getPackage("/P/src/x").rename("newX", false, null);
-
- IPackageFragment oldFrag = getPackage("/P/src/x/y/z");
- assertTrue("Old inner package should still exist", oldFrag.exists());
-
- IPackageFragment newFrag = getPackage("/P/src/newX");
- assertTrue("New package should exist", newFrag.exists());
-
- ICompilationUnit compilationUnit = oldFrag.getCompilationUnit("A.java");
- assertTrue("A.java should exits in old inner package", compilationUnit.exists());
-
- assertDeltas(
- "Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " newX[+]: {}"
- );
-}
-/**
- * Ensures that a method can be renamed if it contains syntax errors.
- */
-public void testRenameSyntaxErrorMethod() throws CoreException {
- this.createFile(
- "/P/src/Y.java",
- "public class Y {\n" +
- " void foo( {\n" + // syntax error
- " }\n" +
- "}"
- );
- IMethod method = getCompilationUnit("/P/src/Y.java").getType("Y").getMethod("foo", null);;
- renamePositive(method, "newFoo", false);
-}
-/**
- * Ensures that attempting to rename with an incorrect number of renamings fails
- */
-public void testRenameWithInvalidRenamings() throws JavaModelException {
- IMethod method = getCompilationUnit("/P/src/X.java").getType("X").getMethod("foo", null);;
-
- renameNegative(
- new IJavaElement[] {method},
- new String[]{"", ""},
- false,
- IJavaModelStatusConstants.INDEX_OUT_OF_BOUNDS);
-
- renameNegative(
- new IJavaElement[] {method},
- null,
- false,
- IJavaModelStatusConstants.NULL_NAME);
-}
-/**
- * Ensures that a working copy cannot be renamed.
- */
-public void testRenameWorkingCopy() throws JavaModelException {
- IWorkingCopy copy = null;
- try {
- copy = (IWorkingCopy) this.cu.getWorkingCopy();
- renameNegative((IJavaElement)copy, "NewX", false, IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
- } finally {
- if (copy != null) copy.destroy();
- }
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java
deleted file mode 100644
index 0a1e8c4..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java
+++ /dev/null
@@ -1,911 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.internal.core.JavaModelStatus;
-
-import junit.framework.*;
-
-public class ResolveTests extends AbstractJavaModelTests {
-
-public ResolveTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("Resolve");
-}
-public void tearDownSuite() throws Exception {
- deleteProject("Resolve");
-
- super.tearDownSuite();
-}
-
-
-public static Test suite() {
- TestSuite suite = new Suite(ResolveTests.class.getName());
-
- // empty selection tests
- suite.addTest(new ResolveTests("testResolveEmptySelection"));
- suite.addTest(new ResolveTests("testResolveEmptySelection2"));
- suite.addTest(new ResolveTests("testResolveEmptySelectionOnMethod"));
-
- // selection tests
- suite.addTest(new ResolveTests("testResolveInvalidResolve"));
- suite.addTest(new ResolveTests("testResolveConstructor"));
- suite.addTest(new ResolveTests("testResolveMethod"));
- suite.addTest(new ResolveTests("testResolveField"));
- suite.addTest(new ResolveTests("testResolvePackage"));
- suite.addTest(new ResolveTests("testResolveClass1"));
- suite.addTest(new ResolveTests("testResolveClass2"));
- suite.addTest(new ResolveTests("testResolveClass3"));
- suite.addTest(new ResolveTests("testResolveClass4"));
- suite.addTest(new ResolveTests("testResolveClass5"));
- suite.addTest(new ResolveTests("testResolveClass6"));
- suite.addTest(new ResolveTests("testResolveInterface"));
- suite.addTest(new ResolveTests("testResolveInClassFileWithSource"));
- suite.addTest(new ResolveTests("testResolveInClassFileWithoutSource"));
- suite.addTest(new ResolveTests("testResolveQualifiedType"));
- suite.addTest(new ResolveTests("testResolvePartiallyQualifiedType"));
- suite.addTest(new ResolveTests("testResolveUnicode"));
- suite.addTest(new ResolveTests("testNegativeResolveUnicode"));
- suite.addTest(new ResolveTests("testResolveArrayLength"));
- suite.addTest(new ResolveTests("testResolveConstructorDeclaration"));
- suite.addTest(new ResolveTests("testResolveMethodDeclaration"));
- suite.addTest(new ResolveTests("testResolveFieldDeclaration"));
- suite.addTest(new ResolveTests("testResolveTypeDeclaration"));
- suite.addTest(new ResolveTests("testResolveMemberTypeDeclaration"));
- suite.addTest(new ResolveTests("testResolveMemberTypeDeclaration2"));
- suite.addTest(new ResolveTests("testResolveMethodWithIncorrectParameter"));
- suite.addTest(new ResolveTests("testResolveExplicitSuperConstructorCall"));
- suite.addTest(new ResolveTests("testResolveExplicitThisConstructorCall"));
- suite.addTest(new ResolveTests("testResolveMessageSendOnBaseType"));
- suite.addTest(new ResolveTests("testResolveMethodWithInnerTypeInClassFile"));
- suite.addTest(new ResolveTests("testResolveMethodWithInnerTypeInClassFile2"));
- suite.addTest(new ResolveTests("testResolveTypeInComment"));
- suite.addTest(new ResolveTests("testResolveImport"));
- suite.addTest(new ResolveTests("testResolveConstructorCallOfMemberType"));
- suite.addTest(new ResolveTests("testResolveLocalName1"));
- suite.addTest(new ResolveTests("testResolveLocalName2"));
- suite.addTest(new ResolveTests("testResolveArgumentName1"));
- suite.addTest(new ResolveTests("testResolveArgumentName2"));
- suite.addTest(new ResolveTests("testResolveCatchArgumentName1"));
- suite.addTest(new ResolveTests("testResolveCatchArgumentName2"));
- suite.addTest(new ResolveTests("testResolveAbstractMethod"));
- suite.addTest(new ResolveTests("testResolveInnerClassAsParamater"));
- suite.addTest(new ResolveTests("testResolveCatchArgumentType1"));
- suite.addTest(new ResolveTests("testResolveCatchArgumentType2"));
- suite.addTest(new ResolveTests("testResolveStaticClassConstructor"));
- return suite;
-}
-
-/**
- * Resolve empty selection
- */
-public void testResolveEmptySelection() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveTypeEmptySelection.java");
-
- String str = cu.getSource();
- String selectAt = "ect";
- String selection = "";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Object") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve empty selection
- */
-public void testResolveEmptySelection2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveTypeEmptySelection2.java");
-
- String str = cu.getSource();
- String selectAt = "Obj";
- String selection = "";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Object") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve empty selection
- */
-public void testResolveEmptySelectionOnMethod() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveEmptySelectionOnMethod.java");
-
- String str = cu.getSource();
- String selectAt = "oo";
- String selection = "";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IMethod);
-}
-/**
- * Resolve the method
- */
-public void testResolveMethodWithIncorrectParameter() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveMethodWithIncorrectParameter.java");
-
- String source = cu.getSource();
-
- int start = source.indexOf("foo(\"String");
- int length = "foo".length();
-
- IJavaElement[] elements = cu.codeSelect(start, length);
- assertTrue("should have one method of 'foo'",
- elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IMethod);
-}
-/**
- * Resolse explicit super constructor call
- */
-public void testResolveExplicitSuperConstructorCall() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveExplicitSuperConstructorCall.java");
-
- String str = cu.getSource();
- String selectAt = "super(";
- String selection = "super";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("SuperClass") &&
- elements[0] instanceof IMethod);
-}
-/**
- * Resolse explicit this constructor call
- */
-public void testResolveExplicitThisConstructorCall() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveExplicitThisConstructorCall.java");
-
- String str = cu.getSource();
- String selectAt = "this(";
- String selection = "this";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("ResolveExplicitThisConstructorCall") &&
- elements[0] instanceof IMethod);
-}
-/**
- * Try to resolve message send on base type.
- */
-public void testResolveMessageSendOnBaseType() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveMessageSendOnBaseType.java");
-
- String str = cu.getSource();
- String selectAt = "hello";
- String selection = "hello";
- IJavaElement[] elements = cu.codeSelect(
- str.indexOf(selectAt),
- selection.length());
-
- assertTrue("should have nothing", elements.length == 0);
-}
-/**
- * Resolve method in inner type.
- */
-public void testResolveMethodWithInnerTypeInClassFile() throws JavaModelException {
- IClassFile cu = getClassFile("Resolve", "zzz.jar", "", "MyClass$Inner.class");
-
- String str = cu.getSource();
- String selectAt = "test";
- String selection = "test";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("test") &&
- elements[0] instanceof IMethod);
-}
-/**
- * bug 33785
- */
-public void testResolveMethodWithInnerTypeInClassFile2() throws JavaModelException {
- IClassFile cu = getClassFile("Resolve", "zzz.jar", "", "MyClass2$Inner.class");
-
- String str = cu.getSource();
- String selectAt = "method";
- String selection = "method";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("method") &&
- elements[0] instanceof IMethod);
-
- IMethod method = (IMethod) elements[0];
- ISourceRange sourceRange = method.getSourceRange();
- String methodString = "void method(MyClass2.Inner[] arg){}";
- int o = str.indexOf(methodString);
- int l = methodString.length();
- assertTrue("source range should be ("+o+","+l+") and not ("+sourceRange.getOffset()+","+sourceRange.getLength()+")", sourceRange.getOffset() == o && sourceRange.getLength() == l);
-}
-/**
- * Resolve type in comment.
- */
-public void testResolveTypeInComment() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveTypeInComment.java");
-
- String str = cu.getSource();
- String selectAt = "X */";
- String selection = "X";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0] instanceof IType &&
- ((IType)elements[0]).getFullyQualifiedName().equals("p2.X"));
-}
-/**
- * Resolve in import
- */
-public void testResolveImport() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveImport.java");
-
- String str = cu.getSource();
- String selectAt = "ImportedClass";
- String selection = "ImportedClass";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("ImportedClass") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve constructor call
- */
-public void testResolveConstructorCallOfMemberType() throws JavaModelException {
- IClassFile cf = getClassFile("Resolve", "class-folder", "", "ResolveConstructorCallOfMemberType.class");
-
- String str = cf.getSource();
- String selectAt = "Inner";
- String selection = "Inner";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cf.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("Inner") &&
- elements[0] instanceof IMethod);
-}
-/**
- * Resolve a local declaration name
- */
-public void testResolveLocalName1() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveLocalName.java");
-
- String str = cu.getSource();
- String selectAt = "var1";
- String selection = "var1";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Object") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve a local declaration name with base type
- */
-public void testResolveLocalName2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveLocalName.java");
-
- String str = cu.getSource();
- String selectAt = "var2";
- String selection = "var2";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have nothing", elements.length == 0);
-}
-/**
- * Resolve an argument name
- */
-public void testResolveArgumentName1() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArgumentName.java");
-
- String str = cu.getSource();
- String selectAt = "var1";
- String selection = "var1";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Object") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve an argument name with base type
- */
-public void testResolveArgumentName2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArgumentName.java");
-
- String str = cu.getSource();
- String selectAt = "var2";
- String selection = "var2";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have nothing", elements.length == 0);
-}
-
-/**
- * Resolve an argument name inside catch statement
- */
-public void testResolveCatchArgumentName1() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveCatchArgumentName.java");
-
- String str = cu.getSource();
- String selectAt = "var1";
- String selection = "var1";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Object") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve an argument name inside catch statement with base type
- */
-public void testResolveCatchArgumentName2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveCatchArgumentName.java");
-
- String str = cu.getSource();
- String selectAt = "var2";
- String selection = "var2";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have nothing", elements.length == 0);
-}
-/**
- * Attempt to resolve outside of the range of the compilation unit.
- */
-public void testResolveInvalidResolve() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "p1", "X.java");
- try {
- cu.codeSelect(-1, 10);
- } catch (JavaModelException jme) {
- assertTrue("Incorrect status on the JavaModelException", jme.getStatus().getCode() == JavaModelStatus.INDEX_OUT_OF_BOUNDS);
- return;
- }
- assertTrue("Exception should have been thrown for out of bounds resolution", false);
-}
-/**
- * Resolve a constructor
- */
-public void testResolveConstructor() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveConstructor.java");
-
- String str = cu.getSource();
- String selectAt = "ResolveConstructor(\"";
- String selection = "ResolveConstructor";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("ResolveConstructor") &&
- elements[0] instanceof IMethod &&
- ((IMethod)elements[0]).getParameterTypes()[0].equals("QString;"));
-}
-/**
- * Resolve the method "foo"
- */
-public void testResolveMethod() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveMethod.java");
-
- String str = cu.getSource();
- String selectAt = "foo(\"";
- String selection = "foo";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method of 'foo'",
- elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IMethod &&
- ((IMethod)elements[0]).getParameterTypes()[0].equals("QString;"));
-}
-/**
- * Resolve the field "foo"
- */
-public void testResolveField() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveField.java");
-
- String str = cu.getSource();
- String selectAt = "foo =";
- String selection = "foo";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one field of 'foo'",
- elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IField);
-}
-/**
- * Resolve the package "java.lang"
- */
-public void testResolvePackage() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolvePackage.java");
-
- String str = cu.getSource();
- String selectAt = "lang";
- String selection = "lang";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one package of 'java.lang'",
- elements.length == 1 &&
- elements[0].getElementName().equals("java.lang") &&
- elements[0] instanceof IPackageFragment);
-}
-/**
- * Resolve the class 'X' (field type).
- */
-public void testResolveClass1() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveClass1.java");
-
- String str = cu.getSource();
- String selectAt = "X";
- String selection = "X";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1 &&
- elements[0].getElementName().equals("X") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve the class 'X' (local variable type).
- */
-public void testResolveClass2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveClass2.java");
-
- String str = cu.getSource();
- String selectAt = "X";
- String selection = "X";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1 &&
- elements[0].getElementName().equals("X") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve the class 'X'(array initializer type).
- */
-public void testResolveClass3() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveClass3.java");
-
- String str = cu.getSource();
- String selectAt = "X[]{";
- String selection = "X";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1 &&
- elements[0].getElementName().equals("X") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve the class 'X' (return type).
- */
-public void testResolveClass4() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveClass4.java");
-
- String str = cu.getSource();
- String selectAt = "X";
- String selection = "X";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1 &&
- elements[0].getElementName().equals("X") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve the class 'X' (method argument).
- */
-public void testResolveClass5() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveClass5.java");
-
- String str = cu.getSource();
- String selectAt = "X";
- String selection = "X";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1 &&
- elements[0].getElementName().equals("X") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve the class 'SuperClass' (super class).
- */
-public void testResolveClass6() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveClass6.java");
-
- String str = cu.getSource();
- String selectAt = "X";
- String selection = "X";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1 &&
- elements[0].getElementName().equals("X") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve the interface "Y"
- */
-public void testResolveInterface() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveInterface.java");
-
- String str = cu.getSource();
- String selectAt = "Y";
- String selection = "Y";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one interface", elements.length == 1 &&
- elements[0].getElementName().equals("Y") &&
- elements[0] instanceof IType);
-}
-/**
- * Tests code resolve on a class file with attached source.
- */
-public void testResolveInClassFileWithSource() throws JavaModelException {
- IClassFile cu = getClassFile("Resolve", "p3.jar", "p3", "X.class");
-
- String str = cu.getSource();
- String selectAt = "Object";
- String selection = "Object";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue(elements != null && elements.length == 1 &&
- elements[0].getElementName().equals("Object") &&
- elements[0].getElementType() == IJavaElement.TYPE);
-}
-/**
- * Tests code resolve on a class file without attached source.
- */
-public void testResolveInClassFileWithoutSource() throws JavaModelException {
- IClassFile cu = getClassFile("Resolve", "p4.jar", "p4", "X.class");
-
- String selection = "Object";
- int start = 34;
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue(elements != null && elements.length == 0);
-}
-/**
- * Resolve the qualified type "java.lang.Object"
- */
-public void testResolveQualifiedType() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveQualifiedType.java");
-
- String str = cu.getSource();
- String selectAt = "java.lang.Object";
- String selection = "java.lang.Object";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class", elements.length == 1);
- IJavaElement element = elements[0];
- assertTrue("Should be an IType", element instanceof IType);
- IType type = (IType)element;
- assertTrue("should be java.lang.Object",
- type.getElementName().equals("Object") &&
- type.getPackageFragment().getElementName().equals("java.lang"));
-}
-/**
- * Try to resolve the qualified type "lang.Object"
- */
-public void testResolvePartiallyQualifiedType() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolvePartiallyQualifiedType.java");
-
- String str = cu.getSource();
- String selectAt = "lang.Object";
- String selection = "lang.Object";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have no result class", elements != null && elements.length == 0);
-}
-/**
- * Resolve the type "java.lang. \u0053ring"
- */
-public void testResolveUnicode() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveUnicode.java");
-
- String str = cu.getSource();
- String selectAt = "java.lang.\\u0053tring";
- String selection = "java.lang.\\u0053tring";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one class 'java.lang.\u0053tring'", elements.length == 1);
- IJavaElement element = elements[0];
- assertTrue("should be an IType", element instanceof IType);
- IType type = (IType)element;
- assertEquals("unexpected element name", "\u0053tring", type.getElementName());
- assertEquals("unexpected parent name", "java.lang", type.getPackageFragment().getElementName());
-}
-/**
- * Tries to resolve the type "lang. \u0053tring" which doesn't exist.
- */
-public void testNegativeResolveUnicode() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveUnicode.java");
-
- String str = cu.getSource();
- String selectAt = "lang.\\u0053tring";
- String selection = "lang.\\u0053tring";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have no class", elements != null && elements.length == 0);
-}
-/**
- * Resolve the field "length" of an array
- */
-public void testResolveArrayLength() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArrayLength.java");
-
- String str = cu.getSource();
- String selectAt = "length";
- String selection = "length";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have no field 'length'", elements != null && elements.length == 0);
-}
-/**
- * Resolve constructor declaration
- */
-public void testResolveConstructorDeclaration() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveConstructorDeclaration.java");
-
- String str = cu.getSource();
- String selectAt = "ResolveConstructorDeclaration(i";
- String selection = "ResolveConstructorDeclaration";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("ResolveConstructorDeclaration") &&
- elements[0] instanceof IMethod &&
- ((IMethod)elements[0]).getParameterTypes()[0].equals("I"));
-}
-/**
- * Resolve method declaration
- */
-public void testResolveMethodDeclaration() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveMethodDeclaration.java");
-
- String str = cu.getSource();
- String selectAt = "foo(i";
- String selection = "foo";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IMethod &&
- ((IMethod)elements[0]).getParameterTypes()[0].equals("I"));
-}
-/**
- * Resolve field declaration
- */
-public void testResolveFieldDeclaration() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveFieldDeclaration.java");
-
- String str = cu.getSource();
- String selectAt = "foo";
- String selection = "foo";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one field", elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IField);
-}
-/**
- * Resolve type declaration
- */
-public void testResolveTypeDeclaration() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveTypeDeclaration.java");
-
- String str = cu.getSource();
- String selectAt = "OtherType";
- String selection = "OtherType";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("OtherType") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve member type declaration
- */
-public void testResolveMemberTypeDeclaration() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveMemberTypeDeclaration1.java");
-
- String str = cu.getSource();
- String selectAt = "MemberInterface";
- String selection = "MemberInterface";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("MemberInterface") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve member type declaration located in default package
- */
-public void testResolveMemberTypeDeclaration2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveMemberTypeDeclaration2.java");
-
- String str = cu.getSource();
- String selectAt = "MemberOfMember";
- String selection = "MemberOfMember";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("MemberOfMember") &&
- elements[0] instanceof IType);
-}
-/**
- * Resolve default abstrart method
- * bugs http://dev.eclipse.org/bugs/show_bug.cgi?id=23594
- */
-public void testResolveAbstractMethod() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveAbstractMethod.java");
-
- String str = cu.getSource();
- String selectAt = "foo";
- String selection = "foo";
- int start = str.indexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IMethod &&
- ((IMethod)elements[0]).getDeclaringType().getElementName().equals("SuperInterface"));
-}
-/**
- * bugs http://dev.eclipse.org/bugs/show_bug.cgi?id=25687
- */
-public void testResolveInnerClassAsParamater() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveInnerClassAsParamater.java");
-
- String str = cu.getSource();
- String selectAt = "foo";
- String selection = "foo";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("foo") &&
- elements[0] instanceof IMethod);
-}
-/**
- * bugs http://dev.eclipse.org/bugs/show_bug.cgi?id=24626
- */
-public void testResolveCatchArgumentType1() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveCatchArgumentType1.java");
-
- String str = cu.getSource();
- String selectAt = "Y1";
- String selection = "Y1";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Y1") &&
- elements[0] instanceof IType);
-}
-/**
- * bugs http://dev.eclipse.org/bugs/show_bug.cgi?id=24626
- */
-public void testResolveCatchArgumentType2() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveCatchArgumentType2.java");
-
- String str = cu.getSource();
- String selectAt = "Y1";
- String selection = "Y1";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one type", elements.length == 1 &&
- elements[0].getElementName().equals("Y1") &&
- elements[0] instanceof IType);
-}
-/**
- * bugs http://dev.eclipse.org/bugs/show_bug.cgi?id=25888
- */
-public void testResolveStaticClassConstructor() throws JavaModelException {
- IClassFile cu = getClassFile("Resolve", "test25888.jar", "", "ResolveStaticClassConstructor.class");
-
- String str = cu.getSource();
- String selectAt = "StaticInnerClass";
- String selection = "StaticInnerClass";
- int start = str.lastIndexOf(selectAt);
- int length = selection.length();
- IJavaElement[] elements = cu.codeSelect(start, length);
-
- assertTrue("should have one method", elements.length == 1 &&
- elements[0].getElementName().equals("StaticInnerClass") &&
- elements[0] instanceof IMethod);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RootManipulationsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RootManipulationsTests.java
deleted file mode 100644
index e83eba6..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RootManipulationsTests.java
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-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.*;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.core.JavaElement;
-
-import junit.framework.Test;
-
-public class RootManipulationsTests extends ModifyingResourceTests {
-public RootManipulationsTests(String name) {
- super(name);
-}
-protected void assertJavaProject(String expected, IJavaProject project) throws CoreException {
- StringBuffer buffer = new StringBuffer();
- populate(buffer, project, 0);
-
- String actual = buffer.toString();
- if (!expected.equals(actual)) {
- System.out.println(Util.displayString(actual, 3));
- }
- assertEquals(expected, actual);
-}
-protected void copy(IPackageFragmentRoot root, IPath destination) throws JavaModelException {
- copy(root, destination, null);
-}
-protected void copy(IPackageFragmentRoot root, IPath destination, IClasspathEntry sibling) throws JavaModelException {
- root.copy(
- destination,
- IResource.NONE,
- IPackageFragmentRoot.DESTINATION_PROJECT_CLASSPATH,
- sibling,
- null);
-}
-protected void delete(IPackageFragmentRoot root) throws JavaModelException {
- root.delete(
- IResource.NONE,
- IPackageFragmentRoot.ORIGINATING_PROJECT_CLASSPATH
- | IPackageFragmentRoot.OTHER_REFERRING_PROJECTS_CLASSPATH,
- null);
-}
-protected void move(IPackageFragmentRoot root, IPath destination) throws JavaModelException {
- move(root, destination, null);
-}
-protected void move(IPackageFragmentRoot root, IPath destination, IClasspathEntry sibling) throws JavaModelException {
- root.move(
- destination,
- IResource.NONE,
- IPackageFragmentRoot.DESTINATION_PROJECT_CLASSPATH
- | IPackageFragmentRoot.ORIGINATING_PROJECT_CLASSPATH
- | IPackageFragmentRoot.OTHER_REFERRING_PROJECTS_CLASSPATH,
- sibling,
- null);
-}
-protected void populate(StringBuffer buffer, IJavaElement element, int indent) throws CoreException {
- if (!(element instanceof IParent) || !(element instanceof IOpenable)) return;
-
- if (buffer.length() != 0) {
- buffer.append("\n");
- }
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append(((JavaElement)element).toDebugString());
-
- IParent parent = (IParent)element;
- IJavaElement[] children = null;
- try {
- children = parent.getChildren();
- } catch (JavaModelException e) {
- }
- if (children != null) {
- for (int i = 0, length = children.length; i < length; i++) {
- populate(buffer, children[i], indent+1);
- }
- }
-
- Object[] nonJavaResources = null;
- try {
- if (element instanceof IJavaProject) {
- nonJavaResources = ((IJavaProject)element).getNonJavaResources();
- } else if (element instanceof IPackageFragmentRoot) {
- nonJavaResources = ((IPackageFragmentRoot)element).getNonJavaResources();
- } else if (element instanceof IPackageFragment) {
- nonJavaResources = ((IPackageFragment)element).getNonJavaResources();
- }
- } catch (JavaModelException e) {
- }
- if (nonJavaResources != null) {
- for (int i = 0, length = nonJavaResources.length; i < length; i++) {
- populate(buffer, nonJavaResources[i], indent+1);
- }
- }
-}
-protected void populate(StringBuffer buffer, Object nonJavaResource, int indent) throws CoreException {
- if (buffer.length() != 0) {
- buffer.append("\n");
- }
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append(nonJavaResource);
- /*
- if (nonJavaResource instanceof IContainer) {
- IResource[] members = ((IContainer)nonJavaResource).members();
- for (int i = 0, length = members.length; i < length; i++) {
- populate(buffer, members[i], indent+1);
- }
- }*/
-}
-public static Test suite() {
- return new Suite(RootManipulationsTests.class);
-}
-/*
- * Ensure that a simple copy of a source root to another project triggers the right delta
- * and that the model is up-to-date.
- */
-public void testCopySourceFolder1() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src"}, "bin");
- this.createJavaProject("P2", new String[] {}, "bin");
- this.createFolder("/P1/src/p");
- this.createFile(
- "/P1/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- this.startDeltas();
- this.copy(root, new Path("/P2/src"));
- assertDeltas(
- "Unexpected delta",
- "P2[*]: {CHILDREN}\n" +
- " src[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- ICompilationUnit cu = this.getCompilationUnit("/P2/src/p/X.java");
- assertTrue("Destination cu should exist", cu.exists());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that coping and renaming a source root to another project triggers the right delta
- * and that the model is up-to-date.
- */
-public void testCopySourceFolder2() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src"}, "bin");
- this.createJavaProject("P2", new String[] {}, "bin");
- this.createFolder("/P1/src/p");
- this.createFile(
- "/P1/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- this.startDeltas();
- this.copy(root, new Path("/P2/src2"));
- assertDeltas(
- "Unexpected delta",
- "P2[*]: {CHILDREN}\n" +
- " src2[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- ICompilationUnit cu = this.getCompilationUnit("/P2/src2/p/X.java");
- assertTrue("Destination cu should exist", cu.exists());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that coping a source root to another project triggers the right delta
- * and doesn't copy a nested source folder.
- */
-public void testCopySourceFolder3() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {}, "bin");
- p1.setRawClasspath(createClasspath(new String[] {"/P1/src1", "src2/**", "/P1/src1/src2", ""}), null);
- this.createJavaProject("P2", new String[] {}, "bin");
- this.createFolder("/P1/src1/p");
- this.createFile(
- "/P1/src1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- this.createFolder("/P1/src1/src2/q");
- this.createFile(
- "/P1/src1/src2/q/Y.java",
- "package q;\n" +
- "public class Y {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src1");
- this.startDeltas();
- this.copy(root, new Path("/P2/src1"));
- assertDeltas(
- "Unexpected delta",
- "P2[*]: {CHILDREN}\n" +
- " src1[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- ICompilationUnit cu = this.getCompilationUnit("/P2/src1/p/X.java");
- assertTrue("Destination cu should exist", cu.exists());
- cu = this.getCompilationUnit("/P2/src1/src2/q/Y.java");
- assertTrue("Nested cu should not exist", !cu.exists());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that copying a source root to another project using a sibling classpath entry triggers the right delta
- * and that the model is up-to-date.
- */
-public void testCopySourceFolder4() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src1", "src2"}, "bin");
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
-
- // insert first
- IClasspathEntry sibling = JavaCore.newSourceEntry(new Path("/P2/src1"));
- this.startDeltas();
- this.copy(root, new Path("/P2/src"), sibling);
- assertDeltas(
- "Unexpected delta (1)",
- "P2[*]: {CHILDREN}\n" +
- " src1[*]: {REORDERED}\n" +
- " src2[*]: {REORDERED}\n" +
- " src[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertElementsEqual(
- "Unexpected roots of P2 after insertion first",
- "src\n" +
- "src1\n" +
- "src2",
- p2.getPackageFragmentRoots());
-
- // insert in the middle
- sibling = JavaCore.newSourceEntry(new Path("/P2/src2"));
- this.startDeltas();
- this.copy(root, new Path("/P2/src3"), sibling);
- assertDeltas(
- "Unexpected delta (2)",
- "P2[*]: {CHILDREN}\n" +
- " src2[*]: {REORDERED}\n" +
- " src3[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertElementsEqual(
- "Unexpected roots of P2 after insertion in the middle",
- "src\n" +
- "src1\n" +
- "src3\n" +
- "src2",
- p2.getPackageFragmentRoots());
-
- // insert last
- this.startDeltas();
- this.copy(root, new Path("/P2/src4"), null);
- assertDeltas(
- "Unexpected delta (3)",
- "P2[*]: {CHILDREN}\n" +
- " src4[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertElementsEqual(
- "Unexpected roots of P2 after insertion last",
- "src\n" +
- "src1\n" +
- "src3\n" +
- "src2\n" +
- "src4",
- p2.getPackageFragmentRoots());
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that coping a source root to another project with an existing source root in
- * REPLACE mode triggers the right delta and that the model is up-to-date.
- * (regression test bug 30511 IPackageFragmentRoot:move ignores FORCE flag)
- */
-public void testCopySourceFolder5() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.createFolder("/P1/src/p");
- this.createFile(
- "/P1/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- this.startDeltas();
- root.copy(new Path("/P2/src"), IResource.NONE, IPackageFragmentRoot.REPLACE, null, null);
- assertDeltas(
- "Unexpected delta",
- "P2[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[+]: {}"
- );
- assertJavaProject(
- "P2\n" +
- " src\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that coping and renaming a source root to same project in
- * REPLACE mode triggers the right delta and that the model is up-to-date.
- * (regression test bug 30857 IPackageFragmentRoot: copy removes source folders from classpath)
- */
-public void testCopySourceFolder6() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/src");
- this.startDeltas();
- root.copy(
- new Path("/P/src1"),
- IResource.KEEP_HISTORY,
- IPackageFragmentRoot.REPLACE | IPackageFragmentRoot.DESTINATION_PROJECT_CLASSPATH,
- null,
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src1[+]: {}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " src1\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that coping a source root to another project with an existing source root in
- * non REPLACE mode throws the right JavaModelException.
- * (regression test bug 30511 IPackageFragmentRoot:move ignores FORCE flag)
- */
-public void testFailCopySourceFolder1() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src"}, "bin");
- this.createJavaProject("P2", new String[] {"src"}, "bin");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- try {
- root.copy(new Path("/P2/src"), IResource.NONE, IPackageFragmentRoot.DESTINATION_PROJECT_CLASSPATH, null, null);
- } catch (JavaModelException e) {
- assertEquals("/P2/src already exists in target.", e.getMessage());
- return;
- }
- assertTrue("Should throw a JavaModelException", false);
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that coping a source root to another project with an existing source root in
- * non REPLACE mode throws the right JavaModelException.
- * (regression test bug 30511 IPackageFragmentRoot:move ignores FORCE flag)
- */
-public void testFailCopySourceFolder2() throws CoreException {
- try {
- this.createJavaProject("P1", new String[] {"src"}, "bin");
- this.createJavaProject("P2", new String[] {"src"}, "bin");
- this.deleteFolder("/P2/src");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- try {
- root.copy(new Path("/P2/src"), IResource.NONE, IPackageFragmentRoot.DESTINATION_PROJECT_CLASSPATH, null, null);
- } catch (JavaModelException e) {
- assertEquals("/P2/src already exists in target.", e.getMessage());
- return;
- }
- assertTrue("Should throw a JavaModelException", false);
- } finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that deleting a jar package fragment root triggers the right delta
- * and that the model is up-to-date.
- */
-public void testDeleteJarFile1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, new String[] {"/P/myLib.jar"}, "bin");
- this.createFile("/P/myLib.jar", "");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/myLib.jar");
- this.startDeltas();
- this.delete(root);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " myLib.jar[-]: {}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src\n" +
- " [default]\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that deleting am external jar package fragment root triggers the right delta
- * and that the model is up-to-date.
- * (regression test for bug 30506 IPackageFragmentRoot:delete does not handle external jars)
- */
-public void testDeleteJarFile3() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, new String[] {getExternalJCLPathString()}, "bin");
-
- IPackageFragmentRoot root = project.getPackageFragmentRoot(getExternalJCLPathString());
- this.startDeltas();
- this.delete(root);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " " + getExternalJCLPath() + "[*]: {REMOVED FROM CLASSPATH}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src\n" +
- " [default]\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that deleting a jar file that is referenced by 2 projects triggers the right delta
- * and that the model is up-to-date.
- */
-public void testDeleteJarFile2() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, new String[] {"/P1/myLib.jar"}, "bin");
- this.createFile("/P1/myLib.jar", "");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src"}, new String[] {"/P1/myLib.jar"}, "bin");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/myLib.jar");
- this.startDeltas();
- this.delete(root);
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " myLib.jar[-]: {}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " /P1/myLib.jar[-]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertJavaProject(
- "P1\n" +
- " src\n" +
- " [default]\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src\n" +
- " [default]\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that a simple delete of a source root triggers the right delta
- * and that the model is up-to-date.
- */
-public void testDeleteSourceFolder1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("/P/src/p");
- this.createFile(
- "/P/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/src");
- this.startDeltas();
- this.delete(root);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[-]: {}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that deleting a source root triggers the right delta
- * and doesn't delete a nested source folder.
- */
-public void testDeleteSourceFolder2() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {}, "bin");
- project.setRawClasspath(createClasspath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""}), null);
- IFolder folder = this.createFolder("/P/src1/p");
- IFile file = this.createFile(
- "/P/src1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- this.createFolder("/P/src1/src2/q");
- this.createFile(
- "/P/src1/src2/q/Y.java",
- "package q;\n" +
- "public class Y {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/src1");
- this.startDeltas();
- this.delete(root);
-
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src1[*]: {REMOVED FROM CLASSPATH}\n" +
- " src1/src2[*]: {REORDERED}\n" +
- " ResourceDelta(/P/.classpath)[*]\n" +
- " ResourceDelta(/P/src1)[*]"
- );
-
- assertJavaProject(
- "P\n" +
- " src1/src2\n" +
- " [default]\n" +
- " q\n" +
- " Y.java\n" +
- " L/P/.classpath\n" +
- " L/P/.project\n" +
- " F/P/src1",
- project);
-
- assertTrue("Original package folder should not exist", !folder.exists());
- assertTrue("Original cu file should not exist", !file.exists());
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a simple move of a source root to another project triggers the right delta
- * and that the model is up-to-date.
- */
-public void testMoveSourceFolder1() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "bin");
- this.createFolder("/P1/src/p");
- this.createFile(
- "/P1/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- this.startDeltas();
- this.move(root, new Path("/P2/src"));
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src[-]: {MOVED_TO(src [in P2])}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " src[+]: {MOVED_FROM(src [in P1])}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertJavaProject(
- "P1\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that moving and renaming a source root to another project triggers the right delta
- * and that the model is up-to-date.
- */
-public void testMoveSourceFolder2() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "bin");
- this.createFolder("/P1/src/p");
- this.createFile(
- "/P1/src/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
- this.startDeltas();
- this.move(root, new Path("/P2/src2"));
-
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src[-]: {MOVED_TO(src2 [in P2])}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " src2[+]: {MOVED_FROM(src [in P1])}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
-
- assertJavaProject(
- "P1\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src2\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that moving a source root to another project triggers the right delta
- * and doesn't move a nested source folder.
- */
-public void testMoveSourceFolder3() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {}, "bin");
- p1.setRawClasspath(createClasspath(new String[] {"/P1/src1", "src2/**", "/P1/src1/src2", ""}), null);
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "bin");
- this.createFolder("/P1/src1/p");
- this.createFile(
- "/P1/src1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- this.createFolder("/P1/src1/src2/q");
- this.createFile(
- "/P1/src1/src2/q/Y.java",
- "package q;\n" +
- "public class Y {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src1");
- this.startDeltas();
- this.move(root, new Path("/P2/src1"));
-
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src1[*]: {REMOVED FROM CLASSPATH}\n" +
- " src1/src2[*]: {REORDERED}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- " ResourceDelta(/P1/src1)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " src1[+]: {}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
-
- assertJavaProject(
- "P1\n" +
- " src1/src2\n" +
- " [default]\n" +
- " q\n" +
- " Y.java\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project\n" +
- " F/P1/src1",
- p1);
- assertJavaProject(
- "P2\n" +
- " src1\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that moving a source root to another project before the first root triggers the right delta
- * and that the model is up-to-date.
- */
-public void testMoveSourceFolder4() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src1", "src2"}, "bin");
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
-
- // insert first
- IClasspathEntry sibling = JavaCore.newSourceEntry(new Path("/P2/src1"));
- this.startDeltas();
- this.move(root, new Path("/P2/src"), sibling);
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src[-]: {MOVED_TO(src [in P2])}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " src1[*]: {REORDERED}\n" +
- " src2[*]: {REORDERED}\n" +
- " src[+]: {MOVED_FROM(src [in P1])}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertJavaProject(
- "P1\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src\n" +
- " [default]\n" +
- " src1\n" +
- " [default]\n" +
- " src2\n" +
- " [default]\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that moving a source root to another project in the middle of existing roots triggers the right delta
- * and that the model is up-to-date.
- */
-public void testMoveSourceFolder5() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src1", "src2"}, "bin");
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
-
- // insert in the middle
- IClasspathEntry sibling = JavaCore.newSourceEntry(new Path("/P2/src2"));
- this.startDeltas();
- this.move(root, new Path("/P2/src"), sibling);
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src[-]: {MOVED_TO(src [in P2])}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " src2[*]: {REORDERED}\n" +
- " src[+]: {MOVED_FROM(src [in P1])}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertJavaProject(
- "P1\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src1\n" +
- " [default]\n" +
- " src\n" +
- " [default]\n" +
- " src2\n" +
- " [default]\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that moving a source root to another project at the end of the classpath triggers the right delta
- * and that the model is up-to-date.
- */
-public void testMoveSourceFolder6() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src1", "src2"}, "bin");
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/src");
-
- // insert last
- this.startDeltas();
- this.move(root, new Path("/P2/src"), null);
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src[-]: {MOVED_TO(src [in P2])}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " src[+]: {MOVED_FROM(src [in P1])}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertJavaProject(
- "P1\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src1\n" +
- " [default]\n" +
- " src2\n" +
- " [default]\n" +
- " src\n" +
- " [default]\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that a simple rename of a source root triggers the right delta
- * and that the model is up-to-date.
- */
-public void testRenameSourceFolder1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src1"}, "bin");
- this.createFolder("/P/src1/p");
- this.createFile(
- "/P/src1/p/X.java",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/src1");
- this.startDeltas();
- this.move(root, new Path("/P/src2"));
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src1[-]: {MOVED_TO(src2 [in P])}\n" +
- " src2[+]: {MOVED_FROM(src1 [in P])}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src2\n" +
- " [default]\n" +
- " p\n" +
- " X.java\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that renaming a source root keeps the same roots order,
- * and that it triggers the right delta and that the model is up-to-date.
- */
-public void testRenameSourceFolder2() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src1", "src2", "src3"}, "bin");
-
- // rename src1
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/src1");
- this.startDeltas();
- this.move(root, new Path("/P/src4"));
- assertDeltas(
- "Unexpected delta after renaming src1",
- "P[*]: {CHILDREN}\n" +
- " src1[-]: {MOVED_TO(src4 [in P])}\n" +
- " src4[+]: {MOVED_FROM(src1 [in P])}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src4\n" +
- " [default]\n" +
- " src2\n" +
- " [default]\n" +
- " src3\n" +
- " [default]\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
-
- // rename src2
- root = this.getPackageFragmentRoot("/P/src2");
- this.clearDeltas();
- this.move(root, new Path("/P/src5"));
- assertDeltas(
- "Unexpected delta after renaming src2",
- "P[*]: {CHILDREN}\n" +
- " src2[-]: {MOVED_TO(src5 [in P])}\n" +
- " src5[+]: {MOVED_FROM(src2 [in P])}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src4\n" +
- " [default]\n" +
- " src5\n" +
- " [default]\n" +
- " src3\n" +
- " [default]\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
-
- // rename src3
- root = this.getPackageFragmentRoot("/P/src3");
- this.clearDeltas();
- this.move(root, new Path("/P/src6"));
- assertDeltas(
- "Unexpected delta after renaming src3",
- "P[*]: {CHILDREN}\n" +
- " src3[-]: {MOVED_TO(src6 [in P])}\n" +
- " src6[+]: {MOVED_FROM(src3 [in P])}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src4\n" +
- " [default]\n" +
- " src5\n" +
- " [default]\n" +
- " src6\n" +
- " [default]\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that a simple rename of a jar file triggers the right delta
- * and that the model is up-to-date.
- */
-public void testRenameJarFile1() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, new String[] {"/P/myLib.jar"}, "bin");
- this.createFile("/P/myLib.jar", "");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/myLib.jar");
- this.startDeltas();
- this.move(root, new Path("/P/myLib2.jar"));
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " myLib.jar[-]: {MOVED_TO(myLib2.jar [in P])}\n" +
- " myLib2.jar[+]: {MOVED_FROM(myLib.jar [in P])}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src\n" +
- " [default]\n" +
- " myLib2.jar\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-/*
- * Ensure that renaming of a jar file that is referenced by 2 projects triggers the right delta
- * and that the model is up-to-date.
- */
-public void testRenameJarFile2() throws CoreException {
- try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, new String[] {"/P1/myLib.jar"}, "bin");
- this.createFile("/P1/myLib.jar", "");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {"src"}, new String[] {"/P1/myLib.jar"}, "bin");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P1/myLib.jar");
- this.startDeltas();
- this.move(root, new Path("/P1/myLib2.jar"));
- assertDeltas(
- "Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " myLib.jar[-]: {MOVED_TO(myLib2.jar [in P1])}\n" +
- " myLib2.jar[+]: {MOVED_FROM(myLib.jar [in P1])}\n" +
- " ResourceDelta(/P1/.classpath)[*]\n" +
- "P2[*]: {CHILDREN}\n" +
- " /P1/myLib.jar[-]: {MOVED_TO(myLib2.jar [in P1])}\n" +
- " /P1/myLib2.jar[+]: {MOVED_FROM(myLib.jar [in P1])}\n" +
- " ResourceDelta(/P2/.classpath)[*]"
- );
- assertJavaProject(
- "P1\n" +
- " src\n" +
- " [default]\n" +
- " myLib2.jar\n" +
- " L/P1/.classpath\n" +
- " L/P1/.project",
- p1);
- assertJavaProject(
- "P2\n" +
- " src\n" +
- " [default]\n" +
- " /P1/myLib2.jar\n" +
- " L/P2/.classpath\n" +
- " L/P2/.project",
- p2);
- } finally {
- this.stopDeltas();
- this.deleteProject("P1");
- this.deleteProject("P2");
- }
-}
-/*
- * Ensure that renaming of a jar file to an existing file in REPLACE mode
- * triggers the right delta and that the model is up-to-date.
- */
-public void testRenameJarFile3() throws CoreException {
- try {
- IJavaProject project = this.createJavaProject("P", new String[] {"src"}, new String[] {"/P/myLib1.jar", "/P/myLib2.jar"}, "bin");
- this.createFile("/P/myLib1.jar", "");
- this.createFile("/P/myLib2.jar", "");
-
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/P/myLib1.jar");
- this.startDeltas();
- root.move(
- new Path("/P/myLib2.jar"),
- IResource.NONE,
- IPackageFragmentRoot.ORIGINATING_PROJECT_CLASSPATH
- | IPackageFragmentRoot.DESTINATION_PROJECT_CLASSPATH
- | IPackageFragmentRoot.REPLACE,
- null,
- null);
- assertDeltas(
- "Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " myLib1.jar[-]: {MOVED_TO(myLib2.jar [in P])}\n" +
- " myLib2.jar[*]: {REORDERED}\n" +
- " ResourceDelta(/P/.classpath)[*]"
- );
- assertJavaProject(
- "P\n" +
- " src\n" +
- " [default]\n" +
- " myLib2.jar\n" +
- " L/P/.classpath\n" +
- " L/P/.project",
- project);
- } finally {
- this.stopDeltas();
- this.deleteProject("P");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java
deleted file mode 100644
index 06e2566..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java
+++ /dev/null
@@ -1,846 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-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.search.*;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.ITypeNameRequestor;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.tests.model.Semaphore.TimeOutException;
-import org.eclipse.jdt.core.tests.util.Util;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.jdt.internal.core.search.matching.SearchPattern;
-import org.eclipse.jdt.internal.core.search.processing.IJob;
-
-import junit.framework.Test;
-
-/*
- * Test indexing support.
- */
-public class SearchTests extends ModifyingResourceTests implements IJavaSearchConstants {
- /*
- * Empty jar contents.
- * Generated using the following code:
-
- String filePath = "d:\\temp\\empty.jar";
- new JarOutputStream(new FileOutputStream(filePath), new Manifest()).close();
- byte[] contents = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(filePath));
- System.out.print("{");
- for (int i = 0, length = contents.length; i < length; i++) {
- System.out.print(contents[i]);
- System.out.print(", ");
- }
- System.out.print("}");
- */
- static final byte[] EMPTY_JAR = {80, 75, 3, 4, 20, 0, 8, 0, 8, 0, 106, -100, 116, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 4, 0, 77, 69, 84, 65, 45, 73, 78, 70, 47, 77, 65, 78, 73, 70, 69, 83, 84, 46, 77, 70, -2, -54, 0, 0, -29, -27, 2, 0, 80, 75, 7, 8, -84, -123, -94, 20, 4, 0, 0, 0, 2, 0, 0, 0, 80, 75, 1, 2, 20, 0, 20, 0, 8, 0, 8, 0, 106, -100, 116, 46, -84, -123, -94, 20, 4, 0, 0, 0, 2, 0, 0, 0, 20, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 69, 84, 65, 45, 73, 78, 70, 47, 77, 65, 78, 73, 70, 69, 83, 84, 46, 77, 70, -2, -54, 0, 0, 80, 75, 5, 6, 0, 0, 0, 0, 1, 0, 1, 0, 70, 0, 0, 0, 74, 0, 0, 0, 0, 0, };
- class WaitUntilReadyMonitor implements IProgressMonitor {
- public Semaphore sem = new Semaphore();
- public void beginTask(String name, int totalWork) {
- }
- public void internalWorked(double work) {
- }
- public void done() {
- }
- public boolean isCanceled() {
- return false;
- }
- public void setCanceled(boolean value) {
- }
- public void setTaskName(String name) {
- }
- public void subTask(String name) {
- // concurrent job is signaling it is working
- this.sem.release();
- }
- public void worked(int work) {
- }
- }
- class TypeNameRequestor implements ITypeNameRequestor {
- Vector results = new Vector();
- public void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path){
- acceptType(packageName, simpleTypeName, enclosingTypeNames);
- }
- public void acceptInterface(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path){
- acceptType(packageName, simpleTypeName, enclosingTypeNames);
- }
- private void acceptType(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames) {
- char[] typeName =
- CharOperation.concat(
- CharOperation.concatWith(enclosingTypeNames, '$'),
- simpleTypeName,
- '$');
- results.addElement(new String(CharOperation.concat(packageName, typeName, '.')));
- }
- public String toString(){
- int length = results.size();
- String[] strings = new String[length];
- results.toArray(strings);
- org.eclipse.jdt.internal.core.Util.sort(strings);
- StringBuffer buffer = new StringBuffer(100);
- for (int i = 0; i < length; i++){
- buffer.append(strings[i]);
- if (i != length-1) {
- buffer.append('\n');
- }
- }
- return buffer.toString();
- }
- }
- class WaitingJob implements IJob {
- static final int MAX_WAIT = 30000; // wait 30s max
- Semaphore startingSem = new Semaphore();
- Semaphore runningSem = new Semaphore();
- public boolean belongsTo(String jobFamily) {
- return false;
- }
- public void cancel() {
- }
- public boolean execute(IProgressMonitor progress) {
- this.startingSem.release();
- try {
- this.runningSem.acquire(MAX_WAIT);
- } catch (TimeOutException e) {
- e.printStackTrace();
- }
- return true;
- }
- public boolean isReadyToRun() {
- return true;
- }
- }
-public static Test suite() {
- return new Suite(SearchTests.class);
-}
-
-
-public SearchTests(String name) {
- super(name);
-}
-protected void assertAllTypes(int waitingPolicy, IProgressMonitor progressMonitor, String expected) throws JavaModelException {
- assertAllTypes("Unexpected all types", null/* no specific project*/, waitingPolicy, progressMonitor, expected);
-}
-protected void assertAllTypes(String expected) throws JavaModelException {
- assertAllTypes(WAIT_UNTIL_READY_TO_SEARCH, null/* no progress monitor*/, expected);
-}
-protected void assertAllTypes(String message, IJavaProject project, String expected) throws JavaModelException {
- assertAllTypes(message, project, WAIT_UNTIL_READY_TO_SEARCH, null/* no progress monitor*/, expected);
-}
-protected void assertAllTypes(String message, IJavaProject project, int waitingPolicy, IProgressMonitor progressMonitor, String expected) throws JavaModelException {
- IJavaSearchScope scope =
- project == null ?
- SearchEngine.createWorkspaceScope() :
- SearchEngine.createJavaSearchScope(new IJavaElement[] {project});
- SearchEngine searchEngine = new SearchEngine();
- TypeNameRequestor requestor = new TypeNameRequestor();
- searchEngine.searchAllTypeNames(
- ResourcesPlugin.getWorkspace(),
- null,
- null,
- PATTERN_MATCH,
- CASE_INSENSITIVE,
- TYPE,
- scope,
- requestor,
- waitingPolicy,
- progressMonitor);
- String actual = requestor.toString();
- if (!expected.equals(actual)){
- System.out.println(Util.displayString(actual, 3));
- }
- assertEquals(
- message,
- expected,
- actual);
-}
-protected void assertPattern(String expected, ISearchPattern actualPattern) {
- String actual = actualPattern == null ? null : actualPattern.toString();
- if (!expected.equals(actual)) {
- System.out.println(actual == null ? "null" : Util.displayString(actual));
- }
- assertEquals(
- "Unexpected search pattern",
- expected,
- actual);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- createJavaProject("P");
- createFolder("/P/x/y/z");
- createFile(
- "/P/x/y/z/Foo.java",
- "package x.y,z;\n" +
- "import x.y.*;\n" +
- "import java.util.Vector;\n" +
- "public class Foo {\n" +
- " int field;\n" +
- " void bar() {\n" +
- " }\n" +
- "}"
- );
- createFile(
- "/P/x/y/z/I.java",
- "package x.y,z;\n" +
- "public interface I {\n" +
- "}"
- );
-}
-public void tearDownSuite() throws Exception {
- deleteProject("P");
- super.tearDownSuite();
-}
-/*
- * Ensure that changing the classpath in the middle of reindexing
- * a project causes another request to reindex.
- */
-public void testChangeClasspath() throws CoreException, TimeOutException {
- IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager();
- WaitingJob job = new WaitingJob();
- try {
- // setup: suspend indexing and create a project (prj=src) with one cu
- indexManager.disable();
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- createJavaProject("P1");
- createFile(
- "/P1/X.java",
- "public class X {\n" +
- "}"
- );
- }
- }, null);
-
- // add waiting job and wait for it to be executed
- indexManager.request(job);
- indexManager.enable();
- job.startingSem.acquire(30000); // wait for job to start (wait 30s max)
-
- // remove source folder from classpath
- IJavaProject project = getJavaProject("P1");
- project.setRawClasspath(
- new IClasspathEntry[0],
- null);
-
- // resume waiting job
- job.runningSem.release();
-
- assertAllTypes(
- "Unexpected all types after removing source folder",
- project,
- ""
- );
- } finally {
- job.runningSem.release();
- deleteProject("P1");
- indexManager.enable();
- }
-}
-/*
- * Ensure that performing a concurrent job while indexing a jar doesn't use the old index.
- * (regression test for bug 35306 Index update request can be incorrectly handled)
- */
-public void testConcurrentJob() throws CoreException, InterruptedException, IOException, TimeOutException {
- IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager();
- WaitingJob job = new WaitingJob();
- try {
- // setup: suspend indexing and create a project with one empty jar on its classpath
- indexManager.disable();
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- createJavaProject("P1", new String[] {}, new String[] {"/P1/jclMin.jar"}, "bin");
- createFile("/P1/jclMin.jar", EMPTY_JAR);
- }
- }, null);
-
- // add waiting job and wait for it to be executed
- indexManager.request(job);
- indexManager.enable();
- job.startingSem.acquire(30000); // wait for job to start (wait 30s max)
-
- final IJavaProject project = getJavaProject("P1");
-
- // start concurrent job
- final boolean[] success = new boolean[1];
- final WaitUntilReadyMonitor monitor = new WaitUntilReadyMonitor();
- Thread thread = new Thread() {
- public void run() {
- try {
- assertAllTypes(
- "Unexpected all types",
- project,
- WAIT_UNTIL_READY_TO_SEARCH,
- monitor,
- "java.lang.Class\n" +
- "java.lang.CloneNotSupportedException\n" +
- "java.lang.Error\n" +
- "java.lang.Exception\n" +
- "java.lang.IllegalMonitorStateException\n" +
- "java.lang.InterruptedException\n" +
- "java.lang.Object\n" +
- "java.lang.RuntimeException\n" +
- "java.lang.String\n" +
- "java.lang.Throwable"
- );
- } catch (JavaModelException e) {
- e.printStackTrace();
- return;
- }
- success[0] = true;
- }
- };
- thread.setDaemon(true);
- thread.start();
-
- // wait for concurrent job to start
- monitor.sem.acquire(30000); // wait 30s max
-
- // change jar contents
- getFile("/P1/jclMin.jar").setContents(new FileInputStream(getExternalJCLPathString()), IResource.NONE, null);
-
- // resume waiting job
- job.runningSem.release();
-
- // wait for concurrent job to finish
- thread.join(10000); // 10s max
-
- assertTrue("Failed to get all types", success[0]);
-
- } finally {
- job.runningSem.release();
- deleteProject("P1");
- indexManager.enable();
- }
-}
-/*
- * Ensures that passing a null progress monitor with a CANCEL_IF_NOT_READY_TO_SEARCH
- * waiting policy doesn't throw a NullPointerException but an OperationCanceledException.
- * (regression test for bug 33571 SearchEngine.searchAllTypeNames: NPE when passing null as progress monitor)
- */
- public void testNullProgressMonitor() throws CoreException, TimeOutException {
- IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager();
- WaitingJob job = new WaitingJob();
- try {
- // add waiting job and wait for it to be executed
- indexManager.disable();
- indexManager.request(job);
- indexManager.enable();
- job.startingSem.acquire(30000); // wait for job to start (wait 30s max)
-
- // query all type names with a null progress monitor
- boolean operationCanceled = false;
- try {
- assertAllTypes(
- CANCEL_IF_NOT_READY_TO_SEARCH,
- null, // null progress monitor
- "Should not get any type"
- );
- } catch (OperationCanceledException e) {
- operationCanceled = true;
- }
- assertTrue("Should throw an OperationCanceledException", operationCanceled);
- } finally {
- job.runningSem.release();
- }
- }
-/*
- * Ensure that removing the outer folder from the classpath doesn't remove cus in inner folder
- * from index
- * (regression test for bug 32607 Removing outer folder removes nested folder's cus from index)
- */
-public void testRemoveOuterFolder() throws CoreException {
- try {
- // setup: one cu in a nested source folder
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IJavaProject project = createJavaProject("P1");
- project.setRawClasspath(
- createClasspath(new String[] {"/P1/src1", "src2/", "/P1/src1/src2", ""}),
- new Path("/P1/bin"),
- null);
- createFolder("/P1/src1/src2");
- createFile(
- "/P1/src1/src2/X.java",
- "public class X {\n" +
- "}"
- );
- }
- }, null);
- IJavaProject project = getJavaProject("P1");
- assertAllTypes(
- "Unexpected all types after setup",
- project,
- "X"
- );
-
- // remove outer folder from classpath
- project.setRawClasspath(
- createClasspath(new String[] {"/P1/src1/src2", ""}),
- null);
- assertAllTypes(
- "Unexpected all types after removing outer folder",
- project,
- "X"
- );
-
- } finally {
- deleteProject("P1");
- }
-}
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation01() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "main(*)",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "MethodReferencePattern: main(*), pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation02() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "main(*) void",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "MethodReferencePattern: main(*) --> void, pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation03() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "main(String*) void",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "MethodReferencePattern: main(String*) --> void, pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation04() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "main(*[])",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "MethodReferencePattern: main(*[]), pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation05() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "java.lang.*.main ",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "MethodReferencePattern: java.lang.*.main(...), pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation06() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "java.lang.* ",
- IJavaSearchConstants.CONSTRUCTOR,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "ConstructorReferencePattern: java.lang.*(...), pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation07() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "X(*,*)",
- IJavaSearchConstants.CONSTRUCTOR,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "ConstructorReferencePattern: X(*, *), pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation08() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "main(String*,*) void",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.REFERENCES,
- CASE_SENSITIVE);
-
- assertPattern(
- "MethodReferencePattern: main(String*, *) --> void, pattern match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation09() {
-
- SearchPattern searchPattern = (SearchPattern)SearchEngine.createSearchPattern(
- "foo*(X, int, int, X, int)",
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.DECLARATIONS,
- CASE_SENSITIVE);
-
- assertEquals(
- "methodDecl/foo",
- searchPattern == null ? null : new String(searchPattern.indexEntryPrefix()));
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation10() {
-
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- "x.y.z.Bar.field Foo",
- IJavaSearchConstants.FIELD,
- IJavaSearchConstants.DECLARATIONS,
- CASE_SENSITIVE);
-
- assertPattern(
- "FieldDeclarationPattern: x.y.z.Bar.field --> Foo, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation11() {
-
- SearchPattern searchPattern = (SearchPattern)SearchEngine.createSearchPattern(
- "x.y.z.Bar.field Foo",
- IJavaSearchConstants.FIELD,
- IJavaSearchConstants.DECLARATIONS,
- CASE_SENSITIVE);
-
- assertEquals(
- "fieldDecl/field",
- searchPattern == null ? null : new String(searchPattern.indexEntryPrefix()));
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation12() throws CoreException {
- IField field = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo").getField("field");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- field,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "FieldReferencePattern: x.y.z.Foo.field --> int, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation13() throws CoreException {
- IField field = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo").getField("field");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- field,
- IJavaSearchConstants.DECLARATIONS);
-
- assertPattern(
- "FieldDeclarationPattern: x.y.z.Foo.field --> int, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation14() throws CoreException {
- IField field = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo").getField("field");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- field,
- IJavaSearchConstants.ALL_OCCURRENCES);
-
- assertPattern(
- "FieldDeclarationPattern: x.y.z.Foo.field --> int, exact match, case sensitive\n" +
- "| FieldReferencePattern: x.y.z.Foo.field --> int, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation15() throws CoreException {
- IImportDeclaration importDecl = getCompilationUnit("/P/x/y/z/Foo.java").getImport("x.y.*");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- importDecl,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "PackageReferencePattern: <x.y>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation16() throws CoreException {
- IMethod method = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo").getMethod("bar", new String[] {});
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- method,
- IJavaSearchConstants.DECLARATIONS);
-
- assertPattern(
- "MethodDeclarationPattern: x.y.z.Foo.bar() --> void, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation17() throws CoreException {
- IMethod method = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo").getMethod("bar", new String[] {});
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- method,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "MethodReferencePattern: x.y.z.Foo.bar() --> void, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation18() throws CoreException {
- IMethod method = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo").getMethod("bar", new String[] {});
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- method,
- IJavaSearchConstants.ALL_OCCURRENCES);
-
- assertPattern(
- "MethodDeclarationPattern: x.y.z.Foo.bar() --> void, exact match, case sensitive\n" +
- "| MethodReferencePattern: x.y.z.Foo.bar() --> void, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation19() throws CoreException {
- IType type = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- type,
- IJavaSearchConstants.DECLARATIONS);
-
- assertPattern(
- "TypeDeclarationPattern: pkg<x.y.z>, enclosing<>, type<Foo>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation20() throws CoreException {
- IType type = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- type,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "TypeReferencePattern: pkg<x.y.z>, type<Foo>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation21() throws CoreException {
- IType type = getCompilationUnit("/P/x/y/z/I.java").getType("I");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- type,
- IJavaSearchConstants.IMPLEMENTORS);
-
- assertPattern(
- "SuperInterfaceReferencePattern: <I>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation22() throws CoreException {
- IType type = getCompilationUnit("/P/x/y/z/Foo.java").getType("Foo");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- type,
- IJavaSearchConstants.ALL_OCCURRENCES);
-
- assertPattern(
- "TypeDeclarationPattern: pkg<x.y.z>, enclosing<>, type<Foo>, exact match, case sensitive\n" +
- "| TypeReferencePattern: pkg<x.y.z>, type<Foo>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation23() throws CoreException {
- IPackageDeclaration pkg = getCompilationUnit("/P/x/y/z/Foo.java").getPackageDeclaration("x.y.z");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- pkg,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "PackageReferencePattern: <x.y.z>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation24() throws CoreException {
- IPackageFragment pkg = getPackage("/P/x/y/z");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- pkg,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "PackageReferencePattern: <x.y.z>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation25() throws CoreException {
- IImportDeclaration importDecl = getCompilationUnit("/P/x/y/z/Foo.java").getImport("java.util.Vector");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- importDecl,
- IJavaSearchConstants.REFERENCES);
-
- assertPattern(
- "TypeReferencePattern: pkg<java.util>, type<Vector>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation26() throws CoreException {
- IPackageFragment pkg = getPackage("/P/x/y/z");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- pkg,
- IJavaSearchConstants.DECLARATIONS);
-
- assertPattern(
- "PackageDeclarationPattern: <x.y.z>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation27() throws CoreException {
- IPackageDeclaration pkg = getCompilationUnit("/P/x/y/z/Foo.java").getPackageDeclaration("x.y.z");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- pkg,
- IJavaSearchConstants.DECLARATIONS);
-
- assertPattern(
- "PackageDeclarationPattern: <x.y.z>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation28() throws CoreException {
- IImportDeclaration importDecl = getCompilationUnit("/P/x/y/z/Foo.java").getImport("x.y.*");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- importDecl,
- IJavaSearchConstants.DECLARATIONS);
-
- assertPattern(
- "PackageDeclarationPattern: <x.y>, exact match, case sensitive",
- searchPattern);
-}
-
-/**
- * Test pattern creation
- */
-public void testSearchPatternCreation29() throws CoreException {
- IPackageFragment pkg = getPackage("/P/x/y/z");
- ISearchPattern searchPattern = SearchEngine.createSearchPattern(
- pkg,
- IJavaSearchConstants.ALL_OCCURRENCES);
-
- assertPattern(
- "PackageDeclarationPattern: <x.y.z>, exact match, case sensitive\n" +
- "| PackageReferencePattern: <x.y.z>, exact match, case sensitive",
- searchPattern);
-}
-
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Semaphore.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Semaphore.java
deleted file mode 100644
index 9883ecb..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Semaphore.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-/**
- * A semaphore implementation with timeout.
- */
-public class Semaphore {
-
- private String name = null;
- private int permissions = 0;
-
- public class TimeOutException extends Exception {
- }
- public Semaphore() {
- this(null, 0);
- }
- public Semaphore(int initialPermisions) {
- this(null, initialPermisions);
- }
- public Semaphore(String name, int initialPermissions) {
- this.name = name;
- this.permissions = initialPermissions;
- }
- public void acquire() {
- try {
- acquire(Long.MAX_VALUE);
- } catch (TimeOutException e) {
- e.printStackTrace();
- }
- }
- public synchronized void acquire(long timeout) throws TimeOutException {
- long start = System.currentTimeMillis();
- while (this.permissions <= 0 && timeout > 0) {
- try {
- if (this.name != null) System.out.println(Thread.currentThread() + " - waiting to acquire: " + this.name); //$NON-NLS-1$
- if (timeout == Long.MAX_VALUE) {
- wait();
- } else {
- wait(timeout);
- }
- } catch(InterruptedException e){
- }
- timeout -= System.currentTimeMillis() - start;
- }
- if (timeout <= 0) {
- throw new TimeOutException();
- }
- this.permissions--;
- if (this.name != null) System.out.println(Thread.currentThread() + " - acquired: " + this.name); //$NON-NLS-1$
- }
- public synchronized void release() {
- if (this.name != null) System.out.println(Thread.currentThread() + " - releasing: " + this.name); //$NON-NLS-1$
- if (++this.permissions > 0) notifyAll();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SignatureTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SignatureTests.java
deleted file mode 100644
index ce97b7a..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SignatureTests.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.core.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class SignatureTests extends AbstractJavaModelTests {
-public SignatureTests(String name) {
- super(name);
-}
-/**
- * Ensures that creating an invalid type signature throws an IllegalArgumentException or return the expected signature.
- */
-protected void assertInvalidTypeSignature(String typeName, boolean isResolved, String expected) throws JavaModelException {
- String actual;
- try {
- actual = Signature.createTypeSignature(typeName, isResolved);
- } catch (IllegalArgumentException e) {
- return;
- }
- assertEquals(expected, actual);
-}
-public static Test suite() {
- return new TestSuite(SignatureTests.class);
-}
-/**
- * @see Signature
- */
-public void testCreateArraySignature() {
- assertEquals(
- "Signature#createArraySignature not correct",
- "[[[[QString",
- Signature.createArraySignature("QString", 4));
-}
-/**
- * @see Signature
- */
-public void testCreateMethodSignature() throws JavaModelException {
- assertEquals(
- "Signature#createMethodSignature is not correct 1",
- "(QString;QObject;I)I",
- Signature.createMethodSignature(new String[] {"QString;", "QObject;", "I"}, "I"));
- assertEquals(
- "Signature#createMethodSignature is not correct 2",
- "()Ljava.lang.String;",
- Signature.createMethodSignature(new String[] {}, "Ljava.lang.String;"));
-
-}
-/**
- * @see Signature
- */
-public void testCreateTypeSignature() throws JavaModelException {
- assertEquals("Signature#createTypeSignature is not correct1", "I", Signature.createTypeSignature("int".toCharArray(), false));
- assertEquals("Signature#createTypeSignature is not correct2", "Ljava.lang.String;", Signature.createTypeSignature("java.lang.String".toCharArray(), true));
- assertEquals("Signature#createTypeSignature is not correct3", "QString;", Signature.createTypeSignature("String".toCharArray(), false));
- assertEquals("Signature#createTypeSignature is not correct4", "Qjava.lang.String;", Signature.createTypeSignature("java.lang.String".toCharArray(), false));
- assertEquals("Signature#createTypeSignature is not correct5", "[I", Signature.createTypeSignature("int []".toCharArray(), false));
- assertEquals("Signature#createTypeSignature is not correct6", "[QString;", Signature.createTypeSignature("String []".toCharArray(), false));
- assertEquals("Signature#createTypeSignature is not correct7", "[Ljava.util.Vector;", Signature.createTypeSignature("java.util.Vector []".toCharArray(), true));
- assertEquals("Signature#createTypeSignature is not correct8", "[[Ljava.util.Vector;", Signature.createTypeSignature("java .\n util . Vector[ ][]".toCharArray(), true));
-}
-/**
- * Ensures that creating an invalid type signature throws an IllegalArgumentException.
- */
-public void testCreateInvalidTypeSignature() throws JavaModelException {
- assertInvalidTypeSignature(null, false, null);
- assertInvalidTypeSignature("", false, "");
- assertInvalidTypeSignature("int.Y", false, "I");
- assertInvalidTypeSignature("Y [].X", false, "[QY;");
- assertInvalidTypeSignature("X[[]", true, "[[LX;");
-}
-/**
- * @see Signature
- */
-public void testGetArrayCount() {
- assertTrue("Signature#getArrayCount is not correct", Signature.getArrayCount("[[[[QString;") == 4);
- try {
- Signature.getArrayCount("");
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Signature#getArrayCount is not correct, exception", false);
-}
-/**
- * @see Signature
- */
-public void testGetElementType() {
- assertTrue("Signature#getElementType is not correct1", Signature.getElementType("[[[[QString;").equals("QString;"));
- assertTrue("Signature#getElementType is not correct2", Signature.getElementType("QString;").equals("QString;"));
- assertTrue("Signature#getElementType is not correct2", Signature.getElementType("[[I").equals("I"));
- try {
- Signature.getElementType("");
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Signature#getArrayCount is not correct, exception", false);
-}
-/**
- * @see Signature
- */
-public void testGetParameterCount() throws JavaModelException {
- String methodSig = "(QString;QObject;I)I";
- assertTrue("Signature#getParameterCount is not correct1", Signature.getParameterCount(methodSig) == 3);
- try {
- Signature.getParameterCount("");
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Signature#getParameterCount is not correct: exception", false);
-}
-/**
- * @see Signature
- */
-public void testGetParameterTypes() throws JavaModelException {
- String methodSig = "(QString;QObject;I)I";
- String[] types= Signature.getParameterTypes(methodSig);
- assertTrue("Signature#getParameterTypes is not correct1", types.length == 3);
- assertTrue("Signature#getParameterTypes is not correct2", types[1].equals("QObject;"));
- try {
- Signature.getParameterTypes("");
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Signature#getParameterTypes is not correct: exception", false);
-}
-/**
- * @see Signature
- */
-public void testGetQualifier() throws JavaModelException {
- assertTrue("Signature#getQualifier is not correct1", Signature.getQualifier("java.lang.Object").equals("java.lang"));
- assertTrue("Signature#getQualifier is not correct2", Signature.getQualifier("").equals(""));
-
-}
-/**
- * @see Signature
- */
-public void testGetReturnType() throws JavaModelException {
- String methodSig = "(QString;QObject;I)I";
- assertTrue("Signature#getReturnType is not correct1", Signature.getReturnType(methodSig).equals("I"));
- try {
- Signature.getReturnType("");
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Signature#getReturnType is not correct: exception", false);
-}
-/**
- * @see Signature
- */
-public void testGetSimpleName() throws JavaModelException {
- assertTrue("Signature#getSimpleName is not correct1", Signature.getSimpleName("java.lang.Object").equals("Object"));
- assertTrue("Signature#getSimpleName is not correct2", Signature.getSimpleName("").equals(""));
-}
-/**
- * @see Signature
- */
-public void testGetSimpleNames() throws JavaModelException {
- String[] simpleNames = Signature.getSimpleNames("java.lang.Object");
- assertTrue("Signature#getSimpleNames is not correct1", simpleNames.length == 3 && simpleNames[2].equals("Object"));
- simpleNames = Signature.getSimpleNames("");
- assertTrue("Signature#getSimpleNames is not correct2", simpleNames.length == 0);
- simpleNames = Signature.getSimpleNames("Object");
- assertTrue(" Signature #getSimpleNames is not correct3 ", simpleNames.length == 1 && simpleNames[0].equals("Object"));
-}
-/**
- * @see Signature
- */
-public void testToQualifiedName() throws JavaModelException {
- assertTrue("Signature#toQualifiedName is not correct1", Signature.toQualifiedName(new String[] {"java", "lang", "Object"}).equals("java.lang.Object"));
- assertTrue("Signature#toQualifiedName is not correct2", Signature.toQualifiedName(new String[] {"Object"}).equals("Object"));
- assertTrue("Signature#toQualifiedName is not correct3", Signature.toQualifiedName(new String[0]).equals(""));
-}
-/**
- * @see Signature.toString(String)
- */
-public void testToString1() throws JavaModelException {
- assertEquals(
- "Signature#toString is not correct 1",
- "java.lang.String",
- Signature.toString("Ljava.lang.String;"));
- assertEquals(
- "Signature#toString is not correct 2",
- "java.lang.String[]",
- Signature.toString("[Ljava.lang.String;"));
- assertEquals(
- "Signature#toString is not correct 3",
- "String",
- Signature.toString("QString;"));
- assertEquals(
- "Signature#toString is not correct 4",
- "String[][]",
- Signature.toString("[[QString;"));
- assertEquals(
- "Signature#toString is not correct 5",
- "boolean",
- Signature.toString("Z"));
- assertEquals(
- "Signature#toString is not correct 6",
- "byte",
- Signature.toString("B"));
- assertEquals(
- "Signature#toString is not correct 7",
- "char",
- Signature.toString("C"));
- assertEquals(
- "Signature#toString is not correct 8",
- "double",
- Signature.toString("D"));
- assertEquals(
- "Signature#toString is not correct 9",
- "float",
- Signature.toString("F"));
- assertEquals(
- "Signature#toString is not correct 10",
- "int",
- Signature.toString("I"));
- assertEquals(
- "Signature#toString is not correct 11",
- "long",
- Signature.toString("J"));
- assertEquals(
- "Signature#toString is not correct 12",
- "short",
- Signature.toString("S"));
- assertEquals(
- "Signature#toString is not correct 13",
- "void",
- Signature.toString("V"));
- assertEquals(
- "Signature#toString is not correct 14",
- "int[][][]",
- Signature.toString("[[[I"));
-}
-/**
- * @see Signature.toString(String, String, String[], boolean, boolean)
- */
-public void testToString2() throws JavaModelException {
- assertEquals(
- "Signature#toString is not correct 1",
- "void main(String[] args)",
- Signature.toString("([Ljava.lang.String;)V", "main", new String[] {"args"}, false, true));
- assertEquals(
- "Signature#toString is not correct 2",
- "main(String[] args)",
- Signature.toString("([Ljava.lang.String;)V", "main", new String[] {"args"}, false, false));
- assertEquals(
- "Signature#toString is not correct 3",
- "main(java.lang.String[] args)",
- Signature.toString("([Ljava.lang.String;)V", "main", new String[] {"args"}, true, false));
- assertEquals(
- "Signature#toString is not correct 4",
- "(java.lang.String[])",
- Signature.toString("([Ljava.lang.String;)V", null, null, true, false));
- assertEquals(
- "Signature#toString is not correct 5",
- "String main(String[] args)",
- Signature.toString("([Ljava.lang.String;)Ljava.lang.String;", "main", new String[] {"args"}, false, true));
- assertEquals(
- "Signature#toString is not correct 6",
- "java.lang.String main(java.lang.String[] args)",
- Signature.toString("([Ljava.lang.String;)Ljava.lang.String;", "main", new String[] {"args"}, true, true));
- assertEquals(
- "Signature#toString is not correct 7",
- "java.lang.String main(java.lang.String[] args)",
- Signature.toString("main([Ljava.lang.String;)Ljava.lang.String;", "main", new String[] {"args"}, true, true));
- assertEquals(
- "Signature#toString is not correct 8",
- "java.lang.String[] foo()",
- Signature.toString("()[Ljava.lang.String;", "foo", null, true, true));
- assertEquals(
- "Signature#toString is not correct 9",
- "I foo(C, L)",
- Signature.toString("(LC;LL;)LI;", "foo", null, true, true));
- assertEquals(
- "Signature#toString is not correct 10",
- "char[][] foo()",
- Signature.toString("()[[C", "foo", null, true, true));
- assertEquals(
- "Signature#toString is not correct 11",
- "void foo(java.lang.Object, String[][], boolean, byte, char, double, float, int, long, short)",
- Signature.toString("(Ljava.lang.Object;[[QString;ZBCDFIJS)V", "foo", null, true, true));
- try {
- Signature.toString("([Ljava.lang.String;V", null, null, true, false);
- } catch (IllegalArgumentException iae) {
- return;
- }
- assertTrue("Signature#toString is not correct 12: should get an exception", false);
-}
-
-/**
- * Test the toString() signature of an inner type.
- */
-public void testToStringInnerType() throws JavaModelException {
- assertEquals(
- "Signature#toString is not correct",
- "x.y.A.Inner",
- Signature.toString("Lx.y.A$Inner;"));
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java
deleted file mode 100644
index 8380c3b..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.codeassist.RelevanceConstants;
-import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers;
-
-import junit.framework.*;
-
-public class SnippetCompletionTests extends AbstractJavaModelTests implements RelevanceConstants {
-
-public SnippetCompletionTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("SnippetCompletion");
-}
-public void tearDownSuite() throws Exception {
- deleteProject("SnippetCompletion");
-
- super.tearDownSuite();
-}
-
-public static Test suite() {
- TestSuite suite = new Suite(SnippetCompletionTests.class.getName());
-
- suite.addTest(new SnippetCompletionTests("testCodeSnippetAssistForClassFile"));
- suite.addTest(new SnippetCompletionTests("testCodeSnippetAssistForCompilationUnit"));
- suite.addTest(new SnippetCompletionTests("testCodeSnippetAssistForClassFileWithSource"));
- suite.addTest(new SnippetCompletionTests("testCodeSnippetAssistForCompilationUnitWithoutSource"));
- suite.addTest(new SnippetCompletionTests("testCodeSnippetAssistForClassFileInInnerClass"));
-
- return suite;
-}
-
-public void testCodeSnippetAssistForClassFile() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- IClassFile cf = getClassFile("SnippetCompletion", "class-folder", "aa.bb.cc", "AClass.class");
- IType type = cf.getType();
-
- String snippet =
- "int varX;\n" +
- "int varY;\n" +
- "var";
-
- char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()};
- char[][] names = {"varsc".toCharArray(), "var".toCharArray()};
- int[] modifiers = {CompilerModifiers.AccDefault, CompilerModifiers.AccFinal};
-
- type.codeComplete(snippet.toCharArray(), -1, snippet.length()-2, typeNames, names, modifiers, false, requestor);
-
- assertEquals(
- "should have 5 completions",
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varX completion:varX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varY completion:varY relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varsc completion:varsc relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:void completion:void relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCodeSnippetAssistForCompilationUnit() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu = getCompilationUnit("SnippetCompletion", "src", "aa.bb.cc", "BClass.java");
- IType type = cu.getTypes()[0];
- String snippet =
- "int varX;\n" +
- "int varY;\n" +
- "var";
-
- char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()};
- char[][] names = {"varsc".toCharArray(), "var".toCharArray()};
- int[] modifiers = {CompilerModifiers.AccDefault, CompilerModifiers.AccFinal};
-
- String insertAftrer = "Victory{}";
- String s = cu.getSource();
- int insertion = -1;
- if(s != null)
- insertion = s.lastIndexOf(insertAftrer) + insertAftrer.length();
-
- type.codeComplete(snippet.toCharArray(), insertion, snippet.length()-2, typeNames, names, modifiers, false, requestor);
-
- assertEquals(
- "should have 6 completions",
- "element:Victory completion:Victory relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varX completion:varX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varY completion:varY relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varsc completion:varsc relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:void completion:void relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-public void testCodeSnippetAssistForClassFileWithSource() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- IClassFile cf = getClassFile("SnippetCompletion", "class-folder", "aa.bb.cc", "CClass.class");
- IType type = cf.getType();
-
- String snippet =
- "int varX;\n" +
- "int varY;\n" +
- "var";
-
- char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()};
- char[][] names = {"varsc".toCharArray(), "var".toCharArray()};
- int[] modifiers = {CompilerModifiers.AccDefault, CompilerModifiers.AccFinal};
-
- String insertAftrer = "Victory{}";
- String s = cf.getSource();
- int insertion = -1;
- if(s != null)
- insertion = s.lastIndexOf(insertAftrer) + insertAftrer.length();
-
- type.codeComplete(snippet.toCharArray(), insertion, snippet.length()-2, typeNames, names, modifiers, false, requestor);
-
- assertEquals(
- "should have 6 completions",
- "element:Victory completion:Victory relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED)+"\n"+
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varX completion:varX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varY completion:varY relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varsc completion:varsc relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:void completion:void relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE) ,
- requestor.getResults());
-}
-
-
-public void testCodeSnippetAssistForCompilationUnitWithoutSource() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- ICompilationUnit cu = getCompilationUnit("SnippetCompletion", "src", "aa.bb.cc", "BClass.java");
- IType type = cu.getTypes()[0];
-
- String snippet =
- "int varX;\n" +
- "int varY;\n" +
- "var";
-
- char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()};
- char[][] names = {"varsc".toCharArray(), "var".toCharArray()};
- int[] modifiers = {CompilerModifiers.AccDefault, CompilerModifiers.AccFinal};
-
- int insertion = -1;
-
- type.codeComplete(snippet.toCharArray(), insertion, snippet.length()-2, typeNames, names, modifiers, false, requestor);
-
- assertEquals(
- "should have 5 completions",
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varX completion:varX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varY completion:varY relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varsc completion:varsc relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:void completion:void relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-
-public void testCodeSnippetAssistForClassFileInInnerClass() throws JavaModelException {
- CompletionTestsRequestor requestor = new CompletionTestsRequestor();
- IClassFile cf = getClassFile("SnippetCompletion", "class-folder", "aa.bb.cc", "AClass$Inner.class");
- IType type = cf.getType();
-
- String snippet =
- "int varX;\n" +
- "int varY;\n" +
- "var";
-
- char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()};
- char[][] names = {"varsc".toCharArray(), "var".toCharArray()};
- int[] modifiers = {CompilerModifiers.AccDefault, CompilerModifiers.AccFinal};
-
- String insertAftrer = "Victory{}";
- String s = cf.getSource();
- int insertion = -1;
- if(s != null)
- insertion = s.lastIndexOf(insertAftrer) + insertAftrer.length();
-
- type.codeComplete(snippet.toCharArray(), insertion, snippet.length()-2, typeNames, names, modifiers, false, requestor);
-
- assertEquals(
- "should have 5 completions",
- "element:var completion:var relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varX completion:varX relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varY completion:varY relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:varsc completion:varsc relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED)+"\n"+
- "element:void completion:void relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE),
- requestor.getResults());
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
deleted file mode 100644
index f30bf67..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
+++ /dev/null
@@ -1,904 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.lang.reflect.Method;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.util.CompilationUnitSorter;
-
-/**
- *
- * @since 2.1
- */
-public class SortCompilationUnitElementsTests extends ModifyingResourceTests {
-
-private static final boolean DEBUG = false;
-
-public SortCompilationUnitElementsTests(String name) {
- super(name);
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- this.createJavaProject("P", new String[] {"src"}, new String[] {getExternalJCLPathString()}, "bin"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- this.createFolder("/P/src/p"); //$NON-NLS-1$
-}
-private void sortUnit(ICompilationUnit unit, String expectedResult) throws CoreException {
- this.sortUnit(unit, expectedResult, true);
-}
-
-private void sortUnit(ICompilationUnit unit, String expectedResult, boolean testPositions) throws CoreException {
- char[] initialSource = unit.getSource().toCharArray();
- int[] positions = null;
- if (testPositions) {
- positions = new int[initialSource.length];
- for (int i = 0; i < initialSource.length; i++) {
- positions[i] = i;
- }
- }
- ICompilationUnit copy = (ICompilationUnit) unit.getWorkingCopy();
- CompilationUnitSorter.sort(copy , positions, new DefaultJavaElementComparator(1,2,3,4,5,6,7,8,9), 0, new NullProgressMonitor());
- String sortedSource = copy.getBuffer().getContents();
- assertEquals("Different output", sortedSource, expectedResult); //$NON-NLS-1$
- if (testPositions) {
- for (int i = 0, max = positions.length; i < max; i++) {
- assertEquals("wrong mapped positions at " + i + " <-> " + positions[i], initialSource[i], expectedResult.charAt(positions[i])); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-}
-
-void debug(ICompilationUnit unit, String id) throws JavaModelException {
- String source = unit.getBuffer().getContents();
- if (DEBUG) {
- System.out.println("========================== " + id + " =============================="); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(source);
- System.out.println("========================== " + id + " =============================="); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
-
-public static Test suite() {
- TestSuite suite = new Suite(SortCompilationUnitElementsTests.class.getName());
-
- if (true) {
- Class c = SortCompilationUnitElementsTests.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new SortCompilationUnitElementsTests(methods[i].getName()));
- }
- }
- } else {
- suite.addTest(new SortCompilationUnitElementsTests("test011")); //$NON-NLS-1$
- }
- return suite;
-}
-public void tearDownSuite() throws Exception {
- this.deleteProject("P"); //$NON-NLS-1$
- super.tearDownSuite();
-}
-/**
- * Calls methods that do nothing to ensure code coverage
- */
-public void test001() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " static class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // start of static field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " static int i, j = 3, /* */ k = 4;// end of static field declaration\n" + //$NON-NLS-1$
- " void bar(int i) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar7() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n\n" + //$NON-NLS-1$
- " Object b1 = null, a1 = new Object() {\n" + //$NON-NLS-1$
- " void bar2() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar4() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar3() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }, c1 = null; // end of multiple field declaration\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n" //$NON-NLS-1$
- );
- String expectedResult = "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " static class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // start of static field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " static int i, j = 3, /* */ k = 4;// end of static field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " Object b1 = null, a1 = new Object() {\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar2() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar3() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar4() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }, c1 = null; // end of multiple field declaration\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " void bar7() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar(int i) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-public void test002() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " int i, j, k;\n" + //$NON-NLS-1$
- " Object bar() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " return new C();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " return o;\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object a1 = new Object() { }, o1 = null;\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedSource = "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object a1 = new Object() { }, o1 = null;\n" + //$NON-NLS-1$
- " int i, j, k;\n" + //$NON-NLS-1$
- " Object bar() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " return new C();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " return o;\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedSource); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-/**
- * Calls methods that do nothing to ensure code coverage
- */
-public void test003() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X extends java.lang.Object implements java.util.Cloneable {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " // start of field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " int i, j = 3, /* */ k = 4;// end of field declaration\n" + //$NON-NLS-1$
- " void bar(final int i[]) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar7() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n\n" + //$NON-NLS-1$
- " Object b1[] = null, a1 = new Object() {\n" + //$NON-NLS-1$
- " void bar2(int[] j) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar4() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar3() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }, c1 = null; // end of multiple field declaration\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n" //$NON-NLS-1$
- );
- String expectedResult = "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X extends java.lang.Object implements java.util.Cloneable {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " Object b1[] = null, a1 = new Object() {\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar2(int[] j) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar3() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar4() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }, c1 = null; // end of multiple field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " // start of field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " int i, j = 3, /* */ k = 4;// end of field declaration\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " void bar7() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar(final int i[]) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-/**
- * Calls methods that do nothing to ensure code coverage
- */
-public void test004() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X extends java.lang.Object implements java.util.Cloneable {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " // start of method declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " void bar(final int i[]) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " Object bar7() {\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n" //$NON-NLS-1$
- );
- String expectedResult = "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X extends java.lang.Object implements java.util.Cloneable {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " Object bar7() {\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " // start of method declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " void bar(final int i[]) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-public void test005() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " return o;\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedResult = "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " return o;\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-public void test006() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " public void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() throws IOException, Exception, NullPointerException {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedResult = "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " void bar4() throws IOException, Exception, NullPointerException {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " public void bar6() {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-public void test007() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " public static void bar6() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar4() throws IOException, Exception, NullPointerException {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedResult = "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " public static void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() throws IOException, Exception, NullPointerException {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-
-public void test008() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " public static void bar6() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar4() throws IOException, Exception, NullPointerException {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedResult = "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " return new Object() {\n" + //$NON-NLS-1$
- " public static void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() throws IOException, Exception, NullPointerException {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " };\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-/**
- * Calls methods that do nothing to ensure code coverage
- */
-public void test009() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " static class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // start of static field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " static int i, j = 3, /* */ k = 4;// end of static field declaration\n" + //$NON-NLS-1$
- " void bar(int i) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar7() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n\n" + //$NON-NLS-1$
- " Object b1 = null, a1 = new Object() {\n" + //$NON-NLS-1$
- " void bar2() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar4() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar3() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }, c1 = null; // end of multiple field declaration\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n" //$NON-NLS-1$
- );
- String expectedResult = "/**\n" + //$NON-NLS-1$
- " *\n" + //$NON-NLS-1$
- " */\n" + //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " static class D {\n" + //$NON-NLS-1$
- " String toString() {\n" + //$NON-NLS-1$
- " return \"HELLO\";\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // start of static field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " static int i, j = 3, /* */ k = 4;// end of static field declaration\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " Object b1 = null, a1 = new Object() {\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar2() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar3() {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar4() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }, c1 = null; // end of multiple field declaration\n" + //$NON-NLS-1$
- " void bar() {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- " class E {\n" + //$NON-NLS-1$
- " void bar2() {}\n" + //$NON-NLS-1$
- " void bar7() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar9() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " Object o = new E();\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " void bar(int i) {\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " // end of class X\n" + //$NON-NLS-1$
- "}\n" + //$NON-NLS-1$
- "// end of compilation unit\n"; //$NON-NLS-1$
- ICompilationUnit unit = this.getCompilationUnit("/P/src/p/X.java"); //$NON-NLS-1$
- sortUnit(unit, expectedResult, false);
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-public void test010() throws CoreException {
- try {
- this.createFile(
- "/P/src/SuperReference.java", //$NON-NLS-1$
- "public class SuperReference extends ThisReference {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- "public SuperReference(int sourceStart, int sourceEnd) {\r\n" + //$NON-NLS-1$
- " super(sourceStart, sourceEnd);\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public static ExplicitConstructorCall implicitSuperConstructorCall() {\r\n" + //$NON-NLS-1$
- " return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public boolean isImplicitThis() {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- " return false;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public boolean isSuper() {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- " return true;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public boolean isThis() {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- " return false ;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public TypeBinding resolveType(BlockScope scope) {\r\n" + //$NON-NLS-1$
- " constant = NotAConstant;\r\n" + //$NON-NLS-1$
- " if (!checkAccess(scope.methodScope()))\r\n" + //$NON-NLS-1$
- " return null;\r\n" + //$NON-NLS-1$
- " SourceTypeBinding enclosingTb = scope.enclosingSourceType();\r\n" + //$NON-NLS-1$
- " if (scope.isJavaLangObject(enclosingTb)) {\r\n" + //$NON-NLS-1$
- " scope.problemReporter().cannotUseSuperInJavaLangObject(this);\r\n" + //$NON-NLS-1$
- " return null;\r\n" + //$NON-NLS-1$
- " }\r\n" + //$NON-NLS-1$
- " return this.resolvedType = enclosingTb.superclass;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public String toStringExpression(){\r\n" + //$NON-NLS-1$
- "\r\n" + //$NON-NLS-1$
- " return \"super\"; //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {\r\n" + //$NON-NLS-1$
- " visitor.visit(this, blockScope);\r\n" + //$NON-NLS-1$
- " visitor.endVisit(this, blockScope);\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedResult = "public class SuperReference extends ThisReference {\r\n" + //$NON-NLS-1$
- "public static ExplicitConstructorCall implicitSuperConstructorCall() {\r\n" + //$NON-NLS-1$
- " return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- "public SuperReference(int sourceStart, int sourceEnd) {\r\n" + //$NON-NLS-1$
- " super(sourceStart, sourceEnd);\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public boolean isImplicitThis() {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- " return false;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public boolean isSuper() {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- " return true;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public boolean isThis() {\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- " return false ;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public TypeBinding resolveType(BlockScope scope) {\r\n" + //$NON-NLS-1$
- " constant = NotAConstant;\r\n" + //$NON-NLS-1$
- " if (!checkAccess(scope.methodScope()))\r\n" + //$NON-NLS-1$
- " return null;\r\n" + //$NON-NLS-1$
- " SourceTypeBinding enclosingTb = scope.enclosingSourceType();\r\n" + //$NON-NLS-1$
- " if (scope.isJavaLangObject(enclosingTb)) {\r\n" + //$NON-NLS-1$
- " scope.problemReporter().cannotUseSuperInJavaLangObject(this);\r\n" + //$NON-NLS-1$
- " return null;\r\n" + //$NON-NLS-1$
- " }\r\n" + //$NON-NLS-1$
- " return this.resolvedType = enclosingTb.superclass;\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public String toStringExpression(){\r\n" + //$NON-NLS-1$
- "\r\n" + //$NON-NLS-1$
- " return \"super\"; //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " \r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {\r\n" + //$NON-NLS-1$
- " visitor.visit(this, blockScope);\r\n" + //$NON-NLS-1$
- " visitor.endVisit(this, blockScope);\r\n" + //$NON-NLS-1$
- "}\r\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/SuperReference.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/SuperReference.java"); //$NON-NLS-1$
- }
-}
-public void test011() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/BaseTypes.java", //$NON-NLS-1$
- "/*******************************************************************************\r\n" + //$NON-NLS-1$
- " * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.\r\n" + //$NON-NLS-1$
- " * All rights reserved. This program and the accompanying materials \r\n" + //$NON-NLS-1$
- " * are made available under the terms of the Common Public License v0.5 \r\n" + //$NON-NLS-1$
- " * which accompanies this distribution, and is available at\r\n" + //$NON-NLS-1$
- " * http://www.eclipse.org/legal/cpl-v05.html\r\n" + //$NON-NLS-1$
- " * \r\n" + //$NON-NLS-1$
- " * Contributors:\r\n" + //$NON-NLS-1$
- " * IBM Corporation - initial API and implementation\r\n" + //$NON-NLS-1$
- " ******************************************************************************/\r\n" + //$NON-NLS-1$
- "package p;\r\n" + //$NON-NLS-1$
- "\r\n" + //$NON-NLS-1$
- "public interface BaseTypes {\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding IntBinding = new BaseTypeBinding(TypeIds.T_int, \"int\".toCharArray(), new char[] {'I'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding ByteBinding = new BaseTypeBinding(TypeIds.T_byte, \"byte\".toCharArray(), new char[] {'B'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding ShortBinding = new BaseTypeBinding(TypeIds.T_short, \"short\".toCharArray(), new char[] {'S'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding CharBinding = new BaseTypeBinding(TypeIds.T_char, \"char\".toCharArray(), new char[] {'C'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding LongBinding = new BaseTypeBinding(TypeIds.T_long, \"long\".toCharArray(), new char[] {'J'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding FloatBinding = new BaseTypeBinding(TypeIds.T_float, \"float\".toCharArray(), new char[] {'F'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding DoubleBinding = new BaseTypeBinding(TypeIds.T_double, \"double\".toCharArray(), new char[] {'D'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding BooleanBinding = new BaseTypeBinding(TypeIds.T_boolean, \"boolean\".toCharArray(), new char[] {'Z'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding NullBinding = new BaseTypeBinding(TypeIds.T_null, \"null\".toCharArray(), new char[] {'N'}); //N stands for null even if it is never internally used //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding VoidBinding = new BaseTypeBinding(TypeIds.T_void, \"void\".toCharArray(), new char[] {'V'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- "}\r\n" //$NON-NLS-1$
- );
- String expectedResult = "/*******************************************************************************\r\n" + //$NON-NLS-1$
- " * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.\r\n" + //$NON-NLS-1$
- " * All rights reserved. This program and the accompanying materials \r\n" + //$NON-NLS-1$
- " * are made available under the terms of the Common Public License v0.5 \r\n" + //$NON-NLS-1$
- " * which accompanies this distribution, and is available at\r\n" + //$NON-NLS-1$
- " * http://www.eclipse.org/legal/cpl-v05.html\r\n" + //$NON-NLS-1$
- " * \r\n" + //$NON-NLS-1$
- " * Contributors:\r\n" + //$NON-NLS-1$
- " * IBM Corporation - initial API and implementation\r\n" + //$NON-NLS-1$
- " ******************************************************************************/\r\n" + //$NON-NLS-1$
- "package p;\r\n" + //$NON-NLS-1$
- "\r\n" + //$NON-NLS-1$
- "public interface BaseTypes {\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding BooleanBinding = new BaseTypeBinding(TypeIds.T_boolean, \"boolean\".toCharArray(), new char[] {'Z'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding ByteBinding = new BaseTypeBinding(TypeIds.T_byte, \"byte\".toCharArray(), new char[] {'B'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding CharBinding = new BaseTypeBinding(TypeIds.T_char, \"char\".toCharArray(), new char[] {'C'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding DoubleBinding = new BaseTypeBinding(TypeIds.T_double, \"double\".toCharArray(), new char[] {'D'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding FloatBinding = new BaseTypeBinding(TypeIds.T_float, \"float\".toCharArray(), new char[] {'F'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding IntBinding = new BaseTypeBinding(TypeIds.T_int, \"int\".toCharArray(), new char[] {'I'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding LongBinding = new BaseTypeBinding(TypeIds.T_long, \"long\".toCharArray(), new char[] {'J'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding NullBinding = new BaseTypeBinding(TypeIds.T_null, \"null\".toCharArray(), new char[] {'N'}); //N stands for null even if it is never internally used //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding ShortBinding = new BaseTypeBinding(TypeIds.T_short, \"short\".toCharArray(), new char[] {'S'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- " final BaseTypeBinding VoidBinding = new BaseTypeBinding(TypeIds.T_void, \"void\".toCharArray(), new char[] {'V'}); //$NON-NLS-1$\r\n" + //$NON-NLS-1$
- "}\r\n"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/BaseTypes.java"), expectedResult); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/BaseTypes.java"); //$NON-NLS-1$
- }
-}
-public void test012() throws CoreException {
- try {
- this.createFile(
- "/P/src/p/X.java", //$NON-NLS-1$
- "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " return null;\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " bar() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " return new C();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}" //$NON-NLS-1$
- );
- String expectedSource = "package p;\n" + //$NON-NLS-1$
- "public class X {\n" + //$NON-NLS-1$
- " bar() {\n" + //$NON-NLS-1$
- " System.out.println();\n" + //$NON-NLS-1$
- " Object o = new Object() { };\n" + //$NON-NLS-1$
- " System.out.println(o);\n" + //$NON-NLS-1$
- " class C {\n" + //$NON-NLS-1$
- " void bar4() {}\n" + //$NON-NLS-1$
- " void bar5() {}\n" + //$NON-NLS-1$
- " void bar6() {}\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " return new C();\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " \n" + //$NON-NLS-1$
- " Object bar3() {\n" + //$NON-NLS-1$
- " return null;\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- sortUnit(this.getCompilationUnit("/P/src/p/X.java"), expectedSource); //$NON-NLS-1$
- } finally {
- this.deleteFile("/P/src/p/X.java"); //$NON-NLS-1$
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SuiteOfTestCases.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SuiteOfTestCases.java
deleted file mode 100644
index 1f58ec6..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SuiteOfTestCases.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-
-import junit.framework.Protectable;
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-/**
- * A test case class that can be set up (using the setUpSuite() method) and tore down (using the teardDownSuite() method)
- * once for all test cases of this class.
- */
-public class SuiteOfTestCases extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
-
- /*
- * A test suite that initialize the test case's fields once, then that copies the values
- * of these fields intto each subsequent test case.
- */
- protected static class Suite extends TestSuite {
- public SuiteOfTestCases currentTestCase;
-
- /*
- * Creates a new suite on the given class. This class must be a subclass of SetupableTestSuite.
- */
- public Suite(Class theClass) {
- super(theClass);
- }
- public Suite(String name) {
- super(name);
- }
- private void initialize(SuiteOfTestCases test) {
- Class currentClass = test.getClass();
- while (currentClass != null && !currentClass.equals(SuiteOfTestCases.class)) {
- Field[] fields = currentClass.getDeclaredFields();
- for (int i = 0, length = fields.length; i < length; i++) {
- Field field = fields[i];
-
- // skip static fields
- if (Modifier.isStatic(field.getModifiers())) continue;
-
- // make the field accessible
- field.setAccessible(true);
-
- try {
- Object value = field.get(this.currentTestCase);
- field.set(test, value);
- } catch (IllegalAccessException e) {
- }
- }
- currentClass = currentClass.getSuperclass();
- }
- }
- public void run(final TestResult result) {
- Protectable p= new Protectable() {
- public void protect() throws Exception {
- try {
- // run suite (first test run will setup the suite)
- superRun(result);
- } finally {
- // tear down the suite
- if (Suite.this.currentTestCase != null) { // protect against empty test suite
- Suite.this.currentTestCase.tearDownSuite();
- }
- }
- }
- };
- result.runProtected(this, p);
- }
- public void superRun(TestResult result) {
- super.run(result);
- }
- public void runTest(Test test, TestResult result) {
- SuiteOfTestCases current = (SuiteOfTestCases)test;
- if (this.currentTestCase == null) {
- // setup suite
- try {
- current.setUpSuite();
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- // copy the values of the previous current test case's fields into the current one
- this.initialize(current);
- }
- try {
- super.runTest(test, result);
- } finally {
- // make current
- this.currentTestCase = current;
- }
- }
- }
-
- public SuiteOfTestCases(String name) {
- super(name);
- }
-
- /**
- * Setup the test suite once before all test cases run.
- */
- public void setUpSuite() throws Exception {
- }
-
- /**
- * Tear down the test suite once after all test cases have run.
- */
- public void tearDownSuite() throws Exception {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TestProgressMonitor.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TestProgressMonitor.java
deleted file mode 100644
index 7c70eee..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TestProgressMonitor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class TestProgressMonitor implements IProgressMonitor {
-
- private static TestProgressMonitor singleton = new TestProgressMonitor();
- public int isCanceledCounter;
-
-/**
- * @see IProgressMonitor#beginTask
- */
-public void beginTask(String name, int totalWork) {
-}
-/**
- * @see IProgressMonitor#done
- */
-public void done() {
-}
-public static TestProgressMonitor getInstance() {
- return singleton;
-}
-public void internalWorked(double work) {
-}
-/**
- * @see IProgressMonitor#isCanceled
- */
-public boolean isCanceled() {
- return --this.isCanceledCounter < 0;
-}
-public void reset() {
-}
-/**
- * @see IProgressMonitor#setCanceled
- */
-public void setCanceled(boolean b) {
-}
-/*
- * Sets the number of time isCanceled() can be called before it returns true.
- */
-public void setCancelledCounter(int counter) {
- this.isCanceledCounter = counter;
-}
-/**
- * @see IProgressMonitor#setTaskName
- */
-public void setTaskName(String name) {
-}
-/**
- * @see IProgressMonitor#subTask
- */
-public void subTask(String name) {
-}
-/**
- * @see IProgressMonitor#worked
- */
-public void worked(int work) {
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java
deleted file mode 100644
index b129429..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.JavaProject;
-
-import junit.framework.*;
-
-/**
- * DO NOT RELEASE AS PART OF REGRESSION TEST - if failing, can cause testing hang
- */
-public class ThreadSafetyTests extends ModifyingResourceTests {
-
-public ThreadSafetyTests(String name) {
- super(name);
-}
-
-public static Test suite() {
-
- if (false){
- TestSuite suite = new Suite(ThreadSafetyTests.class.getName());
- suite.addTest(new ClasspathTests("testDeadlock01"));
- return suite;
- }
- return new Suite(ThreadSafetyTests.class);
-}
-/**
- * 33231 - deadlocked if activating initializer while some concurrent action is populating the JavaModel
- */
-public void testDeadlock01() throws CoreException {
-
- System.out.println("Test deadlock scenario");
- try {
- final IJavaProject project = this.createJavaProject(
- "P",
- new String[] {},
- new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
- "");
-
- // simulate state on startup (flush containers, and discard their previous values)
- project.getJavaModel().close();
- JavaModelManager.PreviousSessionContainers = new HashMap(5);
- JavaModelManager.Containers = new HashMap(5);
- JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject)project);
-
- // use a thread to hold the lock, so as to recreate potential deadlock situation
- final Semaphore step1 = new Semaphore("<1:permission to populate JavaModel inducing containers inits>", 0); // first acquisition will wait
- final Semaphore step2 = new Semaphore("<2:permission to perform resource modification >", 0); // first acquisition to wait
- final Semaphore hasCompleted = new Semaphore(0);
-
- ContainerInitializer.setInitializer(new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P", ""}){
- public void initialize(IPath containerPath, IJavaProject javaProject) throws CoreException {
- step2.release();
- System.out.println(Thread.currentThread() + " initializer has started: attempting to acquire workspace lock");
- super.initialize(containerPath, javaProject);
- System.out.println(Thread.currentThread() + " initializer has finished");
- }
- });
-
- // trigger some delta notification in different thread
- Thread performJavaOperationInsideWorkspaceLock = new Thread(new Runnable(){
- public void run() {
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- System.out.println(Thread.currentThread() + " got workspace lock");
- step1.release();
- step2.acquire(); // ensure the java model lock is taken
- ThreadSafetyTests.this.createFile("/P/X.java", "public class X {}");
- System.out.println(Thread.currentThread() + " created file X.java");
- }
- }, null);
- } catch (CoreException e) {
- }
- hasCompleted.release();
- System.out.println(Thread.currentThread() +" ResourceModification DONE");
- }
- },"ModifyResource");
- performJavaOperationInsideWorkspaceLock.setDaemon(true);
- performJavaOperationInsideWorkspaceLock.start();
-
- Thread attemptPopulateTheJavaModel = new Thread(new Runnable(){
- public void run() {
- try {
- step1.acquire(); // ensure workspace lock is taken already
- System.out.println(Thread.currentThread() + " about to populate Java model");
- // needs the JavaModel lock to populate the project
- project.getChildren(); // trigger classpath initializer activation (requires workspace lock)
- System.out.println(Thread.currentThread() + " done populating the model");
- } catch (JavaModelException e) {
- }
- hasCompleted.release();
- System.out.println(Thread.currentThread() +" Populate JavaModel DONE");
- }
- },"PopulateModel");
- attemptPopulateTheJavaModel.setDaemon(true);
- attemptPopulateTheJavaModel.start();
-
- hasCompleted.acquire(); // ensure both actions did complete
- hasCompleted.acquire();
- System.out.println("SUCCESS - no deadlock encountered");
- } finally {
- // cleanup
- this.deleteProject("P");
- }
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
deleted file mode 100644
index c3b8e5b..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
+++ /dev/null
@@ -1,1036 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-
-public class TypeHierarchyNotificationTests extends ModifyingResourceTests implements ITypeHierarchyChangedListener {
- /**
- * Whether we received notification of change
- */
- protected boolean changeReceived = false;
-
- /**
- * The hierarchy we received change for
- */
- protected ITypeHierarchy hierarchy = null;
-
- /**
- * The number of notifications
- */
- protected int notifications = 0;
-
-public TypeHierarchyNotificationTests(String name) {
- super(name);
-}
-/**
- * Make sure that one change has been received for the given hierarchy.
- */
-private void assertOneChange(ITypeHierarchy h) {
- assertTrue("Should receive change", this.changeReceived);
- assertTrue("Change should be for this hierarchy", this.hierarchy == h);
- assertTrue("Should be one notification", this.notifications == 1);
-}
-private void addSuper(ICompilationUnit unit, String typeName, String newSuper) throws JavaModelException {
- ICompilationUnit copy = (ICompilationUnit)unit.getWorkingCopy();
- IType type = copy.getTypes()[0];
- String source = type.getSource();
- int superIndex = -1;
- String newSource =
- source.substring(0, (superIndex = source.indexOf(typeName) + typeName.length())) +
- " extends " +
- newSuper +
- source.substring(superIndex);
- type.delete(true, null);
- copy.createType(newSource, null, true, null);
- copy.commit(true, null);
-}
-protected void changeSuper(ICompilationUnit unit, String existingSuper, String newSuper) throws JavaModelException {
- ICompilationUnit copy = (ICompilationUnit)unit.getWorkingCopy();
- IType type = copy.getTypes()[0];
- String source = type.getSource();
- int superIndex = -1;
- String newSource =
- source.substring(0, (superIndex = source.indexOf(" " + existingSuper))) +
- " " +
- newSuper +
- source.substring(superIndex + existingSuper.length() + 1 /*space*/);
- type.delete(true, null);
- copy.createType(newSource, null, true, null);
- copy.commit(true, null);
-}
-protected void changeVisibility(ICompilationUnit unit, String existingModifier, String newModifier) throws JavaModelException {
- ICompilationUnit copy = (ICompilationUnit)unit.getWorkingCopy();
- IType type = copy.getTypes()[0];
- String source = type.getSource();
- int modifierIndex = -1;
- String newSource =
- source.substring(0, (modifierIndex = source.indexOf(existingModifier))) +
- " " +
- newModifier +
- source.substring(modifierIndex + existingModifier.length());
- type.delete(true, null);
- copy.createType(newSource, null, true, null);
- copy.commit(true, null);
-}
-/**
- * Reset the flags that watch notification.
- */
-private void reset() {
- this.changeReceived = false;
- this.hierarchy = null;
- this.notifications = 0;
-}
-protected void setUp() throws Exception {
- super.setUp();
- this.reset();
- this.setUpJavaProject("TypeHierarchyNotification");
-}
-public static Test suite() {
- return new Suite(TypeHierarchyNotificationTests.class);
-}
-protected void tearDown() throws Exception {
- this.deleteProject("TypeHierarchyNotification");
- super.tearDown();
-}
-
-/**
- * When a CU is added the type hierarchy should change
- * only if one of the types of the CU is part of the
- * type hierarchy.
- */
-public void testAddCompilationUnit1() throws CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- // a cu with no types part of the hierarchy
- IPackageFragment pkg = getPackageFragment("TypeHierarchyNotification", "src", "p");
- ICompilationUnit newCU1 = pkg.createCompilationUnit(
- "Z1.java",
- "package p;\n" +
- "\n" +
- "public class Z1 {\n" +
- "\n" +
- " public static main(String[] args) {\n" +
- " System.out.println(\"HelloWorld\");\n" +
- " }\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU1);
- assertTrue("Should not receive change", !this.changeReceived);
- } finally {
- // cleanup
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a CU is added the type hierarchy should change
- * only if one of the types of the CU is part of the
- * type hierarchy.
- */
-public void testAddCompilationUnit2() throws CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- // a cu with a top level type which is part of the hierarchy
- IPackageFragment pkg = getPackageFragment("TypeHierarchyNotification", "src", "p");
- ICompilationUnit newCU2 = pkg.createCompilationUnit(
- "Z2.java",
- "package p;\n" +
- "\n" +
- "public class Z2 extends e.E {\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU2);
- this.assertOneChange(h);
- h.refresh(null);
- IType eE = getCompilationUnit("TypeHierarchyNotification", "src", "e", "E.java").getType("E");
- IType[] subtypes = h.getSubtypes(eE);
- assertTrue("Should be one subtype of e.E", subtypes.length == 1);
- assertEquals("Subtype of e.E should be p.Z2", newCU2.getType("Z2"), subtypes[0]);
- } finally {
- // cleanup
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a CU is added the type hierarchy should change
- * only if one of the types of the CU is part of the
- * type hierarchy.
- */
-public void testAddCompilationUnit3() throws CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- // a cu with an inner type which is part of the hierarchy
- IPackageFragment pkg = getPackageFragment("TypeHierarchyNotification", "src", "p");
- ICompilationUnit newCU3 = pkg.createCompilationUnit(
- "Z3.java",
- "package p;\n" +
- "\n" +
- "public class Z3 {\n" +
- " public class InnerZ extends d.D {\n" +
- " }\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU3);
- this.assertOneChange(h);
- h.refresh(null);
- IType dD = getCompilationUnit("TypeHierarchyNotification", "src", "d", "D.java").getType("D");
- IType[] subtypes = h.getSubtypes(dD);
- assertTrue("Should be one subtype of d.D", subtypes.length == 1);
- assertEquals("Subtype of d.D should be p.Z3.InnerZ", newCU3.getType("Z3").getType("InnerZ"), subtypes[0]);
- } finally {
- // cleanup
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a CU is added, if the type hierarchy doesn't have a focus, it should change
- * only if one of the types of the CU is part of the region.
- */
-public void testAddCompilationUnitInRegion() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- IRegion region = JavaCore.newRegion();
- region.add(javaProject);
- ITypeHierarchy h = javaProject.newTypeHierarchy(region, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- setUpJavaProject("TypeHierarchyDependent");
- // a cu with no types part of the region
- IPackageFragment pkg = getPackageFragment("TypeHierarchyDependent", "", "");
- ICompilationUnit newCU1 = pkg.createCompilationUnit(
- "Z1.java",
- "\n" +
- "public class Z1 {\n" +
- "\n" +
- " public static main(String[] args) {\n" +
- " System.out.println(\"HelloWorld\");\n" +
- " }\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU1);
- assertTrue("Should not receive change", !this.changeReceived);
- } finally {
- // cleanup
- deleteResource(newCU1.getUnderlyingResource());
- this.reset();
- }
-
- // a cu with a type which is part of the region and is a subtype of an existing type of the region
- pkg = getPackageFragment("TypeHierarchyNotification", "src", "p");
- ICompilationUnit newCU2 = pkg.createCompilationUnit(
- "Z2.java",
- "package p;\n" +
- "\n" +
- "public class Z2 extends e.E {\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU2);
- this.assertOneChange(h);
- h.refresh(null);
- IType eE = getCompilationUnit("TypeHierarchyNotification", "src", "e", "E.java").getType("E");
- IType[] subtypes = h.getSubtypes(eE);
- assertTrue("Should be one subtype of e.E", subtypes.length == 1);
- assertEquals("Subtype of e.E should be p.Z2", newCU2.getType("Z2"), subtypes[0]);
- } finally {
- // cleanup
- deleteResource(newCU2.getUnderlyingResource());
- this.reset();
- }
-
- // a cu with a type which is part of the region and is not a sub type of an existing type of the region
- ICompilationUnit newCU3 = pkg.createCompilationUnit(
- "Z3.java",
- "package p;\n" +
- "\n" +
- "public class Z3 extends Throwable {\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU3);
- this.assertOneChange(h);
- h.refresh(null);
- IType throwableClass = getClassFile("TypeHierarchyNotification", getExternalJCLPathString(), "java.lang", "Throwable.class").getType();
- assertEquals("Superclass of Z3 should be java.lang.Throwable", throwableClass, h.getSuperclass(newCU3.getType("Z3")));
- } finally {
- // cleanup
- deleteResource(newCU3.getUnderlyingResource());
- this.reset();
- }
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- this.deleteProject("TypeHierarchyDependent");
- }
-}
-/**
- * When a CU is added if the CU does not intersects package fragments in the type hierarchy,
- * the typehierarchy has not changed.
- */
-public void testAddExternalCompilationUnit() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- IPackageFragment pkg = getPackageFragment("TypeHierarchyNotification", "src", "p.other");
- ICompilationUnit newCU= pkg.createCompilationUnit(
- "Z.java",
- "package p.other;\n" +
- "\n" +
- "public class Z {\n" +
- "\n" +
- " public static main(String[] args) {\n" +
- " System.out.println(\"HelloWorld\");\n" +
- " }\n" +
- "}\n",
- false,
- null);
- try {
- assertCreation(newCU);
- assertTrue("Should not receive changes", !this.changeReceived);
- } finally {
- // cleanup
- deleteResource(newCU.getUnderlyingResource());
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a package is added in an external project, the type hierarchy should not change
- */
-public void testAddExternalPackage() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
-
- try {
- this.createJavaProject("Other", new String[] {"src"}, "bin");
-
- h.addTypeHierarchyChangedListener(this);
-
- IPackageFragmentRoot root= getPackageFragmentRoot("Other", "src");
- IPackageFragment frag= root.createPackageFragment("a.day.in.spain", false, null);
- try {
- assertCreation(frag);
- assertTrue("Should not receive changes", !this.changeReceived);
- } finally {
- // cleanup
- frag.delete(true, null);
- this.reset();
- }
- } finally {
- this.deleteProject("Other");
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a project is added that is not on the class path of the type hierarchy project,
- * the type hierarchy should not change.
- */
-public void testAddExternalProject() throws JavaModelException, CoreException, IOException {
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- project.getJavaModel().getWorkspace().getRoot().getProject("NewProject").create(null);
- try {
- assertTrue("Should not receive change", !this.changeReceived);
- } finally {
- // cleanup
- this.deleteProject("NewProject");
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * Test adding the same listener twice.
- */
-public void testAddListenerTwice() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- ICompilationUnit superCU = getCompilationUnit("TypeHierarchyNotification", "src", "b", "B.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
-
- // add listener twice
- h.addTypeHierarchyChangedListener(this);
- h.addTypeHierarchyChangedListener(this);
-
- IFile file = (IFile) superCU.getUnderlyingResource();
- try {
- deleteResource(file);
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a package is added, the type hierarchy should change
- */
-public void testAddPackage() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- IPackageFragmentRoot root= getPackageFragmentRoot("TypeHierarchyNotification", "src");
- IPackageFragment frag= root.createPackageFragment("one.two.three", false, null);
- try {
- assertCreation(frag);
- this.assertOneChange(h);
- } finally {
- // cleanup
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a package fragment root is added, the type hierarchy should change
- */
-public void testAddPackageFragmentRoot() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- // prepare a classpath entry for the new root
- IClasspathEntry[] originalCP= project.getRawClasspath();
- IClasspathEntry newEntry= JavaCore.newSourceEntry(project.getProject().getFullPath().append("extra"));
- IClasspathEntry[] newCP= new IClasspathEntry[originalCP.length + 1];
- System.arraycopy(originalCP, 0 , newCP, 0, originalCP.length);
- newCP[originalCP.length]= newEntry;
-
- try {
- // set new classpath
- project.setRawClasspath(newCP, null);
-
- // now create the actual resource for the root and populate it
- this.reset();
- project.getProject().getFolder("extra").create(false, true, null);
- IPackageFragmentRoot newRoot= getPackageFragmentRoot("TypeHierarchyNotification", "extra");
- assertTrue("New root should now be visible", newRoot != null);
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a project is added that is on the class path of the type hierarchy project,
- * the type hierarchy should change.
- */
-public void testAddProject() throws JavaModelException, CoreException, IOException {
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- // prepare a new classpath entry for the new project
- IClasspathEntry[] originalCP= project.getRawClasspath();
- IClasspathEntry newEntry= JavaCore.newProjectEntry(new Path("/NewProject"), false);
- IClasspathEntry[] newCP= new IClasspathEntry[originalCP.length + 1];
- System.arraycopy(originalCP, 0 , newCP, 0, originalCP.length);
- newCP[originalCP.length]= newEntry;
-
- IProject newProject = null;
- try {
- // set the new classpath
- project.setRawClasspath(newCP, null);
-
- // now create the actual resource for the root and populate it
- this.reset();
- newProject = project.getJavaModel().getWorkspace().getRoot().getProject("NewProject");
- newProject.create(null);
- newProject.open(null);
- IProjectDescription description = newProject.getDescription();
- description.setNatureIds(new String[] {JavaCore.NATURE_ID});
- newProject.setDescription(description, null);
- this.assertOneChange(h);
- } finally {
- this.deleteProject("NewProject");
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a class file is added or removed if the class file intersects package fragments in the type hierarchy,
- * the type hierarchy has possibly changed (possibly introduce a supertype)
- */
-public void testAddRemoveClassFile() throws JavaModelException, CoreException, IOException {
- // Create type hierarchy on 'java.lang.LinkageError' in 'Minimal.zip'
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit unit = getCompilationUnit("TypeHierarchyNotification", "src", "p", "MyError.java");
- IType type = unit.getType("MyError");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- // Create 'patch' folder and add it to classpath
- IFolder pathFolder = project.getProject().getFolder("patch");
- pathFolder.create(true, true, null);
- IClasspathEntry newEntry = JavaCore.newLibraryEntry(pathFolder.getFullPath(), null, null, false);
- IClasspathEntry[] classpath = project.getRawClasspath();
- IClasspathEntry[] newClassPath = new IClasspathEntry[classpath.length+1];
- newClassPath[0] = newEntry;
- System.arraycopy(classpath, 0, newClassPath, 1, classpath.length);
-
- try {
- // Set new classpath
- setClasspath(project, newClassPath);
-
- // Create package 'java.lang' in 'patch'
- IPackageFragment pf = project.getPackageFragmentRoots()[0].createPackageFragment("java.lang", false, null);
- h.refresh(null);
-
- // Test addition of 'Error.class' in 'java.lang' (it should replace the 'Error.class' of the JCL in the hierarchy)
- this.reset();
- IFile file = getProject("TypeHierarchyNotification").getFile("Error.class");
- ((IFolder) pf.getUnderlyingResource()).getFile("Error.class").create(file.getContents(false), false, null);
- this.assertOneChange(h);
- h.refresh(null);
- assertEquals("Superclass of MyError should be Error in patch", pf.getClassFile("Error.class").getType(), h.getSuperclass(type));
-
- // Test removal of 'Error.class'
- this.reset();
- deleteResource(pf.getClassFile("Error.class").getUnderlyingResource());
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * Ensures that a TypeHierarchyNotification is made invalid when the project is closed.
- */
-public void testCloseProject() throws Exception {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- assertTrue(h.exists());
- javaProject.getProject().close(null);
- assertTrue("Should have been invalidated", !h.exists());
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When editing the extends clause of a source type in a hierarchy, we should be notified of change.
- */
-public void testEditExtendsSourceType() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- // change the superclass to a.A
- changeSuper(cu, "B", "a.A");
- this.assertOneChange(h);
- h.refresh(null);
-
- // change the superclass back to B
- this.reset();
- changeSuper(cu, "a.A", "B");
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When adding an extends clause of a source type in a hierarchy, we should be notified of change.
- * (regression test for bug 4917 Latest build fails updating TypeHierarchyNotification)
- */
-public void testAddExtendsSourceType() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p2", "A.java");
- IType type= cu.getType("A");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- // add p2.B as the superclass of p2.A
- addSuper(cu, "A", "p2.B");
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-
-}
-/**
- * When editing a source type NOT in a hierarchy, we should receive NO CHANGES.
- */
-public void testEditExternalSourceType() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- ICompilationUnit cu2= getCompilationUnit("TypeHierarchyNotification", "src", "p", "External.java");
- IField field= cu2.getType("External").getField("field");
- try {
- field.delete(false, null);
- assertTrue("Should receive NO change", !this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When editing the field of a source type in a hierarchy,
- * we should NOT be notified of a change.
- */
-public void testEditFieldSourceType() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- // remove a field an make sure we don't get any notification
- IField field= type.getField("field");
- String source= field.getSource();
- field.delete(false, null);
- assertTrue("Should not receive change", !this.changeReceived);
-
- // add the field back in and make sure we don't get any notification
- type.createField(source, null, false, null);
- assertTrue("Should receive change", !this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When editing the imports of a source type in a hierarchy,
- * we should be notified of a change.
- */
-public void testEditImportSourceType() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- // remove an import declaration
- IImportDeclaration importDecl = cu.getImport("b.*");
- importDecl.delete(false, null);
- this.assertOneChange(h);
-
- // remove all remaining import declarations
- this.reset();
- importDecl = cu.getImport("i.*");
- importDecl.delete(false, null);
- this.assertOneChange(h);
-
- // add an import back in
- this.reset();
- cu.createImport("b.B", null, null);
- this.assertOneChange(h);
-
- // add a second import back in
- this.reset();
- cu.createImport("i.*", null, null);
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When editing > 1 source type in a hierarchy using a MultiOperation,
- * we should be notified of ONE change.
- */
-public void testEditSourceTypes() throws JavaModelException, CoreException, IOException {
- // TBD: Find a way to do 2 changes in 2 different CUs at once
-
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- final ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- final ICompilationUnit superCU = getCompilationUnit("TypeHierarchyNotification", "src", "b", "B.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- // change the visibility of the super class and the 'extends' of the type we're looking at
- // in a batch operation
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- changeVisibility(superCU, "public", "private");
- changeSuper(cu, "X", "a.A");
- } catch (JavaModelException e) {
- assertTrue("No exception", false);
- }
- }
- },
- null
- );
-
- assertTrue("Should receive change", this.changeReceived);
- assertTrue("Change should be for this hierarchy", this.hierarchy == h);
- assertTrue("Should be one notification", this.notifications == 1);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When editing a super source type in a hierarchy, we should be notified of change only if
- * the change affects the visibility of the type.
- */
-public void testEditSuperType() throws JavaModelException, CoreException, IOException {
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- ICompilationUnit superCU = getCompilationUnit("TypeHierarchyNotification", "src", "b", "B.java");
- IType type = cu.getType("X");
- IType superType= superCU.getType("B");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- // delete a field, there should be no change
- IField superField= superType.getField("value");
- superField.delete(false, null);
- assertTrue("Should receive no change", !this.changeReceived);
-
- // change the visibility of the super class, there should be one change
- changeVisibility(superCU, "public", "private");
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When an involved compilation unit is deleted, the type hierarchy should change
- */
-public void testRemoveCompilationUnit() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- ICompilationUnit superCU = getCompilationUnit("TypeHierarchyNotification", "src", "b", "B.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- IFile file = (IFile) superCU.getUnderlyingResource();
- try {
- deleteResource(file);
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When an uninvolved compilation unit is deleted, the type hierarchy should not change
- */
-public void testRemoveExternalCompilationUnit() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- ICompilationUnit otherCU = getCompilationUnit("TypeHierarchyNotification", "src", "p", "External.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- IFile file = (IFile) otherCU.getUnderlyingResource();
- try {
- deleteResource(file);
- assertTrue("Should not receive changes", !this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a uninvolved package is deleted, the type hierarchy should NOT change
- */
-public void testRemoveExternalPackage() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- IPackageFragment pkg = getPackageFragment("TypeHierarchyNotification", "src", "p.other");
- IFolder folder = (IFolder) pkg.getUnderlyingResource();
- try {
- deleteResource(folder);
- assertTrue("Should receive NO change", !this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a package fragment root is removed from the classpath, but does not impact the
- * package fragments, the type hierarchy should not change.
- */
-public void testRemoveExternalPackageFragmentRoot() throws JavaModelException, CoreException, IOException {
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- // add a classpath entry for the new root
- IClasspathEntry[] originalCP= project.getRawClasspath();
- IClasspathEntry newEntry= JavaCore.newSourceEntry(project.getProject().getFullPath().append("extra"));
- IClasspathEntry[] newCP= new IClasspathEntry[originalCP.length + 1];
- System.arraycopy(originalCP, 0 , newCP, 0, originalCP.length);
- newCP[originalCP.length]= newEntry;
-
- try {
- // set classpath
- project.setRawClasspath(newCP, null);
-
- // now create the actual resource for the root and populate it
- this.reset();
- project.getProject().getFolder("extra").create(false, true, null);
- IPackageFragmentRoot newRoot= getPackageFragmentRoot("TypeHierarchyNotification", "extra");
- assertTrue("New root should now be visible", newRoot != null);
- this.assertOneChange(h);
-
- // remove a classpath entry that does not impact the type hierarchy
- this.reset();
- project.setRawClasspath(originalCP, null);
- assertTrue("Should not receive change", !this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a project is deleted that contains package fragments that impact the
- * type hierarchy, the type hierarchy should change
- */
-public void testRemoveExternalProject() throws JavaModelException, CoreException, IOException {
- try {
- this.createJavaProject("External", new String[] {""}, new String[] {"JCL_LIB"}, new String[]{"/TypeHierarchyNotification"}, "");
- this.createFolder("/External/p");
- this.createFile("/External/p/Y.java", "package p; public class Y extends X {}");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- this.deleteProject("External");
- assertTrue("Should not receive change", this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
- } finally {
- this.deleteProject("External");
- }
-}
-/**
- * Test removing a listener while the type hierarchy is notifying listeners.
- */
-public void testRemoveListener() throws JavaModelException, CoreException, IOException {
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- final ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- final ICompilationUnit superCU = getCompilationUnit("TypeHierarchyNotification", "src", "b", "B.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- ITypeHierarchyChangedListener listener= new ITypeHierarchyChangedListener() {
- public void typeHierarchyChanged(ITypeHierarchy th) {
- changeReceived= true;
- hierarchy= th;
- notifications++;
- th.removeTypeHierarchyChangedListener(this);
- }
- };
- h.addTypeHierarchyChangedListener(listener);
-
- try {
- // change the visibility of the super class and the 'extends' of the type we're looking at
- // in a batch operation
- getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- changeVisibility(superCU, "public", "private");
- changeSuper(cu, "B", "a.A");
- } catch (JavaModelException e) {
- assertTrue("No exception", false);
- }
- }
- },
- null
- );
-
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a package is deleted, the type hierarchy should change
- */
-public void testRemovePackage() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- IPackageFragment pkg = type.getPackageFragment();
- try {
- deleteResource(pkg.getUnderlyingResource());
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a package fragment root is removed from the classpath, the type hierarchy should change
- */
-public void testRemovePackageFragmentRoots() throws JavaModelException, CoreException, IOException {
- IJavaProject project = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- project.setRawClasspath(null, null);
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When a project is deleted that contains package fragments that impact the
- * type hierarchy, the type hierarchy should change (and be made invalid)
- */
-public void testRemoveProject() throws JavaModelException, CoreException, IOException {
- ITypeHierarchy h = null;
- try {
- setUpJavaProject("TypeHierarchyDependent");
- IJavaProject project= getJavaProject("TypeHierarchyDependent");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyDependent", "", "", "Dependent.java");
- IType type = cu.getType("Dependent");
- h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- // Sanity check
- assertEquals("Superclass of Dependent is a.A", "a.A", h.getSuperclass(type).getFullyQualifiedName());
-
- // Delete a related project
- IResource folder = getJavaProject("TypeHierarchyNotification").getUnderlyingResource();
- deleteResource(folder);
- this.assertOneChange(h);
- assertTrue("Should still exist", h.exists());
- h.refresh(null);
- IType superType = h.getSuperclass(type);
- assertTrue("Superclass of Dependent should be null", superType == null);
-
- // Delete the project type lives in.
- folder = getJavaProject("TypeHierarchyDependent").getUnderlyingResource();
- deleteResource(folder);
- assertTrue("Should have been invalidated", ! h.exists());
- } finally {
- this.deleteProject("TypeHierarchyDependent");
- if (h != null) h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When type used to create a TypeHierarchyNotification is deleted,
- * the hierarchy should be made invalid.
- */
-public void testRemoveType() throws JavaModelException, CoreException, IOException {
- IJavaProject project= getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- type.delete(true, null);
- assertTrue("Should have been invalidated", !h.exists());
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When an involved compilation unit is renamed, the type hierarchy may change.
- */
-public void testRenameCompilationUnit() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- try {
- cu.rename("X2.java", false, null);
- this.assertOneChange(h);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * When an uninvolved compilation unit is renamed, the type hierarchy does not change.
- */
-public void testRenameExternalCompilationUnit() throws JavaModelException, CoreException, IOException {
- IJavaProject javaProject = getJavaProject("TypeHierarchyNotification");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java");
- IType type= cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(javaProject, null);
- h.addTypeHierarchyChangedListener(this);
-
- ICompilationUnit cu2= getCompilationUnit("TypeHierarchyNotification", "src", "p", "External.java");
- try {
- cu2.rename("External2.java", false, null);
- assertTrue("Should not receive changes", !this.changeReceived);
- } finally {
- h.removeTypeHierarchyChangedListener(this);
- }
-}
-/**
- * Make a note of the change
- */
-public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
- this.changeReceived= true;
- this.hierarchy= typeHierarchy;
- this.notifications++;
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchySerializationTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchySerializationTests.java
deleted file mode 100644
index 27c53af..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchySerializationTests.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.internal.core.hierarchy.RegionBasedTypeHierarchy;
-import org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy;
-
-import junit.framework.Test;
-
-public class TypeHierarchySerializationTests extends AbstractJavaModelTests {
- private static final String PROJECTNAME = "TypeHierarchySerialization";
-
- IJavaProject project;
-
-public TypeHierarchySerializationTests(String name) {
- super(name);
-}
-public static Test suite() {
- return new Suite(TypeHierarchySerializationTests.class);
-}
-private static void compare(String focus, ITypeHierarchy stored, ITypeHierarchy loaded){
- if(stored instanceof RegionBasedTypeHierarchy) {
- assertTrue("["+focus+"] hierarchies are not the same", loaded instanceof RegionBasedTypeHierarchy);
- compareRegionBasedTypeHierarchy(focus, (RegionBasedTypeHierarchy)stored,(RegionBasedTypeHierarchy)loaded);
- } else if(stored instanceof TypeHierarchy) {
- assertTrue("["+focus+"] hierarchies are not the same", loaded instanceof TypeHierarchy);
- compareTypeHierarchy(focus, (TypeHierarchy)stored,(TypeHierarchy)loaded);
- }
-}
-private static void compareRegionBasedTypeHierarchy(String focus, RegionBasedTypeHierarchy stored, RegionBasedTypeHierarchy loaded){
- compareTypeHierarchy(focus, stored, loaded);
-}
-private static void compareTypeHierarchy(String focus, TypeHierarchy stored, TypeHierarchy loaded){
- //System.out.println(stored.toString());
-
- IType type1 = stored.getType();
- IType type2 = loaded.getType();
- assertEquals("["+focus+"] focus are not the same", type1, type2);
-
- IType[] allTypes1 = stored.getAllTypes();
- IType[] allTypes2 = loaded.getAllTypes();
- compare("["+focus+"] all types are not the same", allTypes1, allTypes2);
-
- IType[] allClasses1 = stored.getAllClasses();
- IType[] allClasses2 = loaded.getAllClasses();
- compare("["+focus+"] all classes are not the same", allClasses1, allClasses2);
-
- IType[] allInterfaces1 = stored.getAllInterfaces();
- IType[] allInterfaces2 = loaded.getAllInterfaces();
- compare("["+focus+"] all interfaces are not the same", allInterfaces1, allInterfaces2);
-
- IType[] rootClasses1 = stored.getRootClasses();
- IType[] rootClasses2 = loaded.getRootClasses();
- compare("["+focus+"] all roots are not the same", rootClasses1, rootClasses2);
-
- IType[] rootInterfaces1 = stored.getRootInterfaces();
- IType[] rootInterfaces2 = loaded.getRootInterfaces();
- compare("["+focus+"] all roots are not the same", rootInterfaces1, rootInterfaces2);
-
- Object[] missingTypes1 = stored.missingTypes.toArray();
- Object[] missingTypes2 = loaded.missingTypes.toArray();
- compare("["+focus+"] all missing types are not the same", missingTypes1, missingTypes2);
-
- for (int i = 0; i < allTypes1.length; i++) {
- IType aType = allTypes1[i];
-
- int cachedFlags1 = stored.getCachedFlags(aType);
- int cachedFlags2 = loaded.getCachedFlags(aType);
- assertEquals("["+focus+"] flags are not the same for "+aType.getFullyQualifiedName(), cachedFlags1, cachedFlags2);
-
- IType superclass1 = stored.getSuperclass(aType);
- IType superclass2 = loaded.getSuperclass(aType);
- assertEquals("["+focus+"] superclass are not the same for "+aType.getFullyQualifiedName(), superclass1, superclass2);
-
- IType[] superInterfaces1 = stored.getSuperInterfaces(aType);
- IType[] superInterfaces2 = loaded.getSuperInterfaces(aType);
- compare("["+focus+"] all super interfaces are not the same for "+aType.getFullyQualifiedName(), superInterfaces1, superInterfaces2);
-
- IType[] superTypes1 = stored.getSupertypes(aType);
- IType[] superTypes2 = loaded.getSupertypes(aType);
- compare("["+focus+"] all super types are not the same for "+aType.getFullyQualifiedName(), superTypes1, superTypes2);
-
- IType[] subclasses1 = stored.getSubclasses(aType);
- IType[] subclasses2 = loaded.getSubclasses(aType);
- compare("["+focus+"] all subclasses are not the same for "+aType.getFullyQualifiedName(), subclasses1, subclasses2);
-
- IType[] subtypes1 = stored.getSubtypes(aType);
- IType[] subtypes2 = loaded.getSubtypes(aType);
- compare("["+focus+"] all subtypes are not the same for "+aType.getFullyQualifiedName(), subtypes1, subtypes2);
-
- IType[] extendingInterfaces1 = stored.getExtendingInterfaces(aType);
- IType[] extendingInterfaces2 = loaded.getExtendingInterfaces(aType);
- compare("["+focus+"] all extending interfaces are not the same for "+aType.getFullyQualifiedName(), extendingInterfaces1, extendingInterfaces2);
-
- IType[] implementingClasses1 = stored.getImplementingClasses(aType);
- IType[] implementingClasses2 = loaded.getImplementingClasses(aType);
- compare("["+focus+"] all implemeting classes are not the same for "+aType.getFullyQualifiedName(), implementingClasses1, implementingClasses2);
-
- }
-}
-private static void compare(String msg, Object[] types1, Object[] types2) {
- if(types1 == null) {
- assertTrue(msg, types2 == null);
- } else {
- assertTrue(msg, types2 != null);
- assertTrue(msg, types1.length == types2.length);
- for (int i = 0; i < types1.length; i++) {
- boolean found = false;
- for (int j = 0; j < types2.length; j++) {
- if(types1[i] == null && types1[j] == null) {
- found = true;
- } else if(types1[i] != null && types1[i].equals(types2[j])) {
- found = true;
- }
- }
- assertTrue(msg, found);
- }
- }
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- project = setUpJavaProject(PROJECTNAME);
-}
-
-/* (non-Javadoc)
- * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#tearDownSuite()
- */
-public void tearDownSuite() throws Exception {
- deleteProject(PROJECTNAME);
-
- super.tearDownSuite();
-}
-private static void testFocusHierarchy(IType type, IJavaProject project) throws JavaModelException{
- ITypeHierarchy h1 = type.newTypeHierarchy(project, null);
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- h1.store(outputStream, null);
-
- byte[] bytes = outputStream.toByteArray();
- ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
- ITypeHierarchy h2 = type.loadTypeHierachy(inputStream, null);
-
- compare(type.getFullyQualifiedName(), h1, h2);
-
- h2.refresh(null);
- compare(type.getFullyQualifiedName(), h1, h2);
-}
-public void test001() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "X.java");
- IType type = cu.getType("X");
- testFocusHierarchy(type, project);
-}
-public void test002() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "Y.java");
- IType type = cu.getType("Y");
- testFocusHierarchy(type, project);
-}
-public void test003() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "Z.java");
- IType type = cu.getType("Z");
- testFocusHierarchy(type, project);
-}
-public void test004() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "I1.java");
- IType type = cu.getType("I1");
- testFocusHierarchy(type, project);
-}
-public void test005() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "I2.java");
- IType type = cu.getType("I2");
- testFocusHierarchy(type, project);
-}
-public void test006() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "I3.java");
- IType type = cu.getType("I3");
- testFocusHierarchy(type, project);
-}
-public void test007() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "I4.java");
- IType type = cu.getType("I4");
- testFocusHierarchy(type, project);
-}
-public void test008() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "I5.java");
- IType type = cu.getType("I5");
- testFocusHierarchy(type, project);
-}
-public void test009() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit(PROJECTNAME, "src", "p1", "I6.java");
- IType type = cu.getType("I6");
- testFocusHierarchy(type, project);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
deleted file mode 100644
index fb34f17..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.runtime.OperationCanceledException;
-
-import org.eclipse.jdt.core.*;
-
-import junit.framework.Test;
-
-public class TypeHierarchyTests extends AbstractJavaModelTests {
- /**
- * A placeholder for a type hierarchy used in some test cases.
- */
- ITypeHierarchy typeHierarchy;
-
-public TypeHierarchyTests(String name) {
- super(name);
-}
-public static Test suite() {
- return new Suite(TypeHierarchyTests.class);
-}
-
-/* (non-Javadoc)
- * @see org.eclipse.jdt.core.tests.model.AbstractJavaModelTests#setUpSuite()
- */
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("TypeHierarchy");
-
- IJavaProject project = this.getJavaProject("TypeHierarchy");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(project.getProject().getFile("lib.jar"));
- IRegion region = JavaCore.newRegion();
- region.add(root);
- this.typeHierarchy = project.newTypeHierarchy(region, null);
-}
-
-/* (non-Javadoc)
- * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#tearDownSuite()
- */
-public void tearDownSuite() throws Exception {
- this.typeHierarchy = null;
- deleteProject("TypeHierarchy");
-
- super.tearDownSuite();
-}
-/**
- * Ensures that the superclass can be retrieved for a binary inner type.
- */
-public void testBinaryInnerTypeGetSuperclass() throws JavaModelException {
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "Y$Inner.class");
- IType type = cf.getType();
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType superclass = h.getSuperclass(type);
- assertTrue("Superclass not found for Y$Inner", superclass != null);
- assertEquals("Unexpected super class", "Z", superclass.getElementName());
-}
-/**
- * Ensures that the superinterfaces can be retrieved for a binary inner type.
- */
-public void testBinaryInnerTypeGetSuperInterfaces() throws JavaModelException {
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "Y$Inner.class");
- IType type = cf.getType();
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- assertTypesEqual(
- "Unexpected super interfaces",
- "binary.I\n",
- h.getSuperInterfaces(type));
-}
-/**
- * Ensures that the superclass can be retrieved for a binary type's superclass.
- */
-public void testBinaryTypeGetSuperclass() throws JavaModelException {
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "Y.class");
- IType type = cf.getType();
- ITypeHierarchy h= type.newSupertypeHierarchy(null);
- IType superclass= h.getSuperclass(type);
- assertTrue("Superclass not found forY", superclass != null);
- assertEquals("Unexpected superclass of Y", "X", superclass.getElementName());
-}
-/**
- * Ensures that the superclass can be retrieved for a binary type's superclass.
- * This is a relatively deep type hierarchy.
- */
-public void testBinaryTypeGetSuperclass2() throws JavaModelException {
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "Deep.class");
- IType type = cf.getType();
- ITypeHierarchy h= type.newSupertypeHierarchy(null);
- IType superclass= h.getSuperclass(type);
- assertTrue("Superclass not found for Deep", superclass != null);
- assertEquals("Unexpected superclass of Deep", "Z", superclass.getElementName());
-}
-/**
- * Ensures that the superinterfaces can be retrieved for a binary type's superinterfaces.
- */
-public void testBinaryTypeGetSuperInterfaces() throws JavaModelException {
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "X.class");
- IType type = cf.getType();
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType[] superInterfaces = h.getSuperInterfaces(type);
- assertTypesEqual(
- "Unexpected super interfaces of X",
- "binary.I\n",
- superInterfaces);
-}
-/**
- * Ensures that the superinterfaces can be retrieved for a binary type's superinterfaces.
- * Test with type that has a "rich" super hierarchy
- */
-public void testBinaryTypeGetSuperInterfaces2() throws JavaModelException {
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "rich", "C.class");
- IType type = cf.getType();
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType[] superInterfaces = h.getSuperInterfaces(type);
- assertTypesEqual(
- "Unexpected super interfaces of C",
- "rich.I\n" +
- "rich.I3\n",
- superInterfaces);
-}
-/**
- * Ensures that contains(...) returns true for a type that is part of the
- * hierarchy and false otherwise.
- */
-public void testContains() throws JavaModelException {
- // regular class
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "X.class");
- IType type = cf.getType();
- assertTrue("X must be included", this.typeHierarchy.contains(type));
-
- // root class
- cf = getClassFile("TypeHierarchy", getExternalJCLPathString(), "java.lang", "Object.class");
- type = cf.getType();
- assertTrue("Object must be included", this.typeHierarchy.contains(type));
-
- // interface
- cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "I.class");
- assertTrue("I must be included", this.typeHierarchy.contains(type));
-}
-/**
- * Ensures that getType() returns the type the hierarchy was created for.
- */
-public void testGetType() throws JavaModelException {
- // hierarchy created on a type
- IClassFile cf = getClassFile("TypeHierarchy", "lib.jar", "binary", "Y.class");
- IType type = cf.getType();
- ITypeHierarchy hierarchy = null;
- try {
- hierarchy = type.newSupertypeHierarchy(null);
- } catch (IllegalArgumentException iae) {
- assertTrue("IllegalArgumentException", false);
- }
- assertEquals("Unexpected focus type", type, hierarchy.getType());
-
- // hierarchy created on a region
- assertTrue("Unexpected focus type for hierarchy on region", this.typeHierarchy.getType() == null);
-}
-/**
- * Ensures that a hierarchy on an inner type is correctly rooted.
- */
-public void testInnerType() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p5", "X.java").getType("X").getType("Inner");
- ITypeHierarchy hierarchy = null;
- try {
- hierarchy = type.newTypeHierarchy(null);
- } catch (IllegalArgumentException iae) {
- assertTrue("IllegalArgumentException", false);
- }
- assertEquals(
- "Unexpected hierarchy",
- "Focus: p5.X$Inner\n" +
- "Super types:\n" +
- " Inner [in X [in X.java [in p5 [in src [in TypeHierarchy]]]]]\n" +
- " Object [in Object.class [in java.lang [in " + getExternalJCLPath() + " [in TypeHierarchy]]]]\n" +
- "Sub types:\n" +
- " Inner [in X [in X.java [in p5 [in src [in TypeHierarchy]]]]]\n",
- hierarchy.toString());
-}
-/**
- * Ensures that a hierarchy on a type that implements a missing interface is correctly rooted.
- * (regression test for bug 24691 Missing interface makes hierarchy incomplete)
- */
-public void testMissingInterface() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p4", "X.java").getType("X");
- ITypeHierarchy hierarchy = null;
- try {
- hierarchy = type.newTypeHierarchy(null);
- } catch (IllegalArgumentException iae) {
- assertTrue("IllegalArgumentException", false);
- }
- assertEquals(
- "Unexpected hierarchy",
- "Focus: p4.X\n" +
- "Super types:\n" +
- " X [in X.java [in p4 [in src [in TypeHierarchy]]]]\n" +
- " Object [in Object.class [in java.lang [in " + getExternalJCLPath() + " [in TypeHierarchy]]]]\n" +
- "Sub types:\n" +
- " X [in X.java [in p4 [in src [in TypeHierarchy]]]]\n",
- hierarchy.toString());
-}
-/**
- * Ensures that a potential subtype that is not in the classpth is handle correctly.
- * (Regression test for PR #1G4GL9R)
- */
-public void testPotentialSubtypeNotInClasspath() throws JavaModelException {
- IJavaProject project = getJavaProject("TypeHierarchy");
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newTypeHierarchy(project, null);
- IType[] types = h.getSubtypes(type);
- this.assertTypesEqual(
- "Unexpected sub types of X",
- "p1.Y\n",
- types
- );
-}
-/**
- * Ensures that the superclass can be retrieved for a source type's unqualified superclass.
- */
-public void testSourceTypeGetSuperclass() throws JavaModelException {
- //unqualified superclass in a source type
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "Y.java");
- IType type = cu.getType("Y");
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType superclass = h.getSuperclass(type);
- assertTrue("Superclass not found for Y", superclass != null);
- assertEquals("Unexpected super class for Y", "X", superclass.getElementName());
-}
-/**
- * Ensures that the superclass can be retrieved for a source type's superclass when no superclass is specified
- * in the source type.
- */
-public void testSourceTypeGetSuperclass2() throws JavaModelException {
- //no superclass specified for a source type
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "X.java");
- IType type = cu.getType("X");
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType superclass = h.getSuperclass(type);
- assertTrue("Superclass not found for X", superclass != null);
- assertEquals("Unexpected super class for X", "Object", superclass.getElementName());
-}
-/**
- * Ensures that the superclass can be retrieved for a source type's superclass.
- * This type hierarchy is relatively deep.
- */
-public void testSourceTypeGetSuperclass3() throws JavaModelException {
- //no superclass specified for a source type
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "Deep.java");
- IType type = cu.getType("Deep");
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType superclass = h.getSuperclass(type);
- assertTrue("Superclass not found for Deep", superclass != null);
- assertEquals("Unexpected super class for Deep", "Z", superclass.getElementName());
-}
-/**
- * Ensures that the superclass can be retrieved when it is defined
- * in the same compilation unit.
- */
-public void testSourceTypeGetSuperclass4() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "A.java");
- IType type = cu.getType("A");
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType superclass = h.getSuperclass(type);
- assertTrue("Superclass not found for A", superclass != null);
- assertEquals("Unexpected super class for A", "B", superclass.getElementName());
-}
-/**
- * Ensures that the superinterfaces can be retrieved for a source type's superinterfaces.
- */
-public void testSourceTypeGetSuperInterfaces() throws JavaModelException {
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "Y.java");
- IType type = cu.getType("Y");
- ITypeHierarchy h = type.newSupertypeHierarchy(null);
- IType[] superInterfaces = h.getSuperInterfaces(type);
- assertTypesEqual("Unexpected super interfaces for Y",
- "p1.I1\n" +
- "p1.I2\n",
- superInterfaces);
-}
-/**
- * Ensures that no subclasses exist in a super type hierarchy for the focus type.
- */
-public void testSupertypeHierarchyGetSubclasses() throws JavaModelException {
- IType type = getClassFile("TypeHierarchy", getExternalJCLPathString(), "java.lang", "Object.class").getType();
- ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null);
- IType[] types = hierarchy.getSubclasses(type);
- assertTypesEqual(
- "Unexpected subclasses of Object",
- "",
- types);
-
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "Y.java");
- type = cu.getType("Y");
- hierarchy = type.newSupertypeHierarchy(null);
- types = hierarchy.getSubclasses(type);
- assertTypesEqual(
- "Unexpected subclasses of Y",
- "",
- types);
-}
-/**
- * Ensures that no subtypes exist in a super type hierarchy for the focus type.
- */
-public void testSupertypeHierarchyGetSubtypes() throws JavaModelException {
- IType type = getClassFile("TypeHierarchy", getExternalJCLPathString(), "java.lang", "Object.class").getType();
- ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null);
- IType[] types = hierarchy.getSubtypes(type);
- assertTypesEqual(
- "Unexpected subtypes of Object",
- "",
- types);
-
- ICompilationUnit cu = getCompilationUnit("TypeHierarchy", "src", "p1", "Y.java");
- type = cu.getType("Y");
- hierarchy = type.newSupertypeHierarchy(null);
- types = hierarchy.getSubtypes(type);
- assertTypesEqual(
- "Unexpected subtypes of Y",
- "",
- types);
-}
-/**
- * Ensures that a super type hierarchy can be created on a working copy.
- * (regression test for bug 3446 type hierarchy: incorrect behavior wrt working copies (1GLDHOA))
- */
-public void testSupertypeHierarchyOnWorkingCopy() throws JavaModelException {
- ICompilationUnit cu = this.getCompilationUnit("TypeHierarchy", "src", "wc", "X.java");
- ICompilationUnit workingCopy = null;
- try {
- workingCopy = (ICompilationUnit)cu.getWorkingCopy();
- workingCopy.createType(
- "class B{\n" +
- " void m(){\n" +
- " }\n" +
- " void f(){\n" +
- " m();\n" +
- " }\n" +
- "}\n",
- null,
- true,
- null);
- workingCopy.createType(
- "class A extends B{\n" +
- " void m(){\n" +
- " }\n" +
- "}",
- null,
- true,
- null);
- IType typeA = workingCopy.getType("A");
- ITypeHierarchy hierarchy = typeA.newSupertypeHierarchy(null);
- IType typeB = workingCopy.getType("B");
- assertTrue("hierarchy should contain B", hierarchy.contains(typeB));
- } finally {
- if (workingCopy != null) {
- workingCopy.destroy();
- }
- }
-}
-/**
- * Ensures that the creation of a type hierarchy can be cancelled.
- */
-public void testCancel() throws JavaModelException {
- boolean isCanceled = false;
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "X.java").getType("X");
- IRegion region = JavaCore.newRegion();
- region.add(getPackageFragmentRoot("TypeHierarchy", "src"));
- try {
- TestProgressMonitor monitor = TestProgressMonitor.getInstance();
- monitor.setCancelledCounter(1);
- type.getJavaProject().newTypeHierarchy(type, region, monitor);
- } catch (OperationCanceledException e) {
- isCanceled = true;
- }
- assertTrue("Operation should have thrown an operation canceled exception", isCanceled);
-}
-/**
- * Ensures the correctness of all classes in a type hierarchy based on a region.
- */
-public void testGetAllClassesInRegion() throws JavaModelException {
- IType[] types = this.typeHierarchy.getAllClasses();
- assertTypesEqual(
- "Unexpected all classes in hierarchy",
- "binary.Deep\n" +
- "binary.X\n" +
- "binary.Y\n" +
- "binary.Y$Inner\n" +
- "binary.Z\n" +
- "java.lang.Object\n" +
- "rich.A\n" +
- "rich.B\n" +
- "rich.C\n",
- types);
-}
-
-
-/**
- * Ensures the correctness of all interfaces in a type hierarchy based on a region.
- */
-public void testGetAllInterfacesInRegion() throws JavaModelException {
- IType[] types = this.typeHierarchy.getAllInterfaces();
- assertTypesEqual(
- "Unexpected all interfaces in hierarchy",
- "binary.I\n" +
- "rich.I\n" +
- "rich.I2\n" +
- "rich.I3\n",
- types);
-}
-/**
- * Ensures that the correct subtypes of a type exist in the type
- * hierarchy.
- */
-public void testGetAllSubtypes() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "X.java").getType("X");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getAllSubtypes(type);
- this.assertTypesEqual(
- "Unexpected sub types of X",
- "p1.Deep\n" +
- "p1.Y\n" +
- "p1.Z\n",
- types
- );
-}
-/**
- * Ensures that the correct subtypes of a binary type
- * exit in the type hierarchy created on a region.
- */
-public void testGetAllSubtypesFromBinary() throws JavaModelException {
- IType type = getClassFile("TypeHierarchy", "lib.jar", "binary", "X.class").getType();
- IRegion region = JavaCore.newRegion();
- region.add(type.getPackageFragment());
- ITypeHierarchy hierarchy = type.getJavaProject().newTypeHierarchy(type, region, null);
- IType[] types = hierarchy.getAllSubtypes(type);
- assertTypesEqual(
- "Unexpected all subtypes of binary.X",
- "binary.Deep\n" +
- "binary.Y\n" +
- "binary.Y$Inner\n" +
- "binary.Z\n",
- types);
-}
-/**
- * Ensures that the correct superclasses of a type exist in the type
- * hierarchy.
- */
-public void testGetAllSuperclasses() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "Z.java").getType("Z");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getAllSuperclasses(type);
- assertTypesEqual(
- "Unexpected all super classes of Z",
- "java.lang.Object\n" +
- "p1.X\n" +
- "p1.Y\n",
- types);
-}
-/**
- * Ensures that the correct superinterfaces of a type exist in the type
- * hierarchy.
- */
-public void testGetAllSuperInterfaces() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "Z.java").getType("Z");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getAllSuperInterfaces(type);
- assertTypesEqual(
- "Unexpected super interfaces of Z",
- "p1.I1\n" +
- "p1.I2\n",
- types);
-}
-/**
- * Ensures that the correct supertypes of a type exist in the type
- * hierarchy.
- */
-public void testGetAllSupertypes() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "Z.java").getType("Z");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getAllSupertypes(type);
- assertTypesEqual(
- "Unexpected all super types of Z",
- "java.lang.Object\n" +
- "p1.I1\n" +
- "p1.I2\n" +
- "p1.X\n" +
- "p1.Y\n",
- types);
-}
-/**
- * Ensures that the correct supertypes of a type exist in the type
- * hierarchy.
- * (regression test for bug 23644 hierarchy: getAllSuperTypes does not include all superinterfaces?)
- */
-public void testGetAllSupertypes2() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p3", "B.java").getType("B");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getAllSupertypes(type);
- assertTypesEqual(
- "Unexpected all super types of B",
- "java.lang.Object\n" +
- "p3.A\n" +
- "p3.I\n" +
- "p3.I1\n",
- types);
-}
-/**
- * Ensures that the correct types exist in the type
- * hierarchy.
- */
-public void testGetAllTypes() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "Y.java").getType("Y");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- this.assertTypesEqual(
- "Unexpected types in hierarchy of Y",
- "java.lang.Object\n" +
- "p1.Deep\n" +
- "p1.I1\n" +
- "p1.I2\n" +
- "p1.X\n" +
- "p1.Y\n" +
- "p1.Z\n",
- hierarchy.getAllTypes()
- );
-}
-/**
- * Ensures that the correct extending interfaces exist in the type
- * hierarchy.
- */
-public void testGetExtendingInterfaces() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p2", "I.java").getType("I");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getExtendingInterfaces(type);
- this.assertTypesEqual(
- "Unexpected extending interfaces of I",
- "p2.I1\n" +
- "p2.I2\n",
- types
- );
-
- type = getCompilationUnit("TypeHierarchy", "src", "p2", "X.java").getType("X");
- hierarchy = type.newTypeHierarchy(null);
- types = hierarchy.getExtendingInterfaces(type);
- this.assertTypesEqual(
- "Unexpected extending interfaces of X",
- "", // interfaces cannot extend a class
- types
- );
-}
-/**
- * Ensures that the correct implementing interfaces exist in the type
- * hierarchy.
- */
-public void testGetImplementingClasses() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p2", "I.java").getType("I");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getImplementingClasses(type);
- this.assertTypesEqual(
- "Unexpected implementing classes of I",
- "p2.X\n",
- types
- );
-
- type = getCompilationUnit("TypeHierarchy", "src", "p2", "X.java").getType("X");
- hierarchy = type.newTypeHierarchy(null);
- types = hierarchy.getImplementingClasses(type);
- this.assertTypesEqual(
- "Unexpected implementing classes of X",
- "", // classes cannot implement a class
- types
- );
-}
-/**
- * Ensures that the correct root classes exist in the type
- * hierarchy.
- */
-public void testGetRootClasses() throws JavaModelException {
- IType[] types = this.typeHierarchy.getRootClasses();
- assertTypesEqual(
- "Unexpected root classes",
- "java.lang.Object\n",
- types);
-}
-/**
- * Ensures that the correct root interfaces exist in the type
- * hierarchy.
- */
-public void testGetRootInterfaces() throws JavaModelException {
- IType type = getCompilationUnit("TypeHierarchy", "src", "p2", "Y.java").getType("Y");
- ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
- IType[] types = hierarchy.getRootInterfaces();
- assertTypesEqual(
- "Unexpected root classes",
- "p2.I\n",
- types);
-}
-/**
- * Ensures that getRootInterfaces() works on a IRegion.
- */
-public void testGetRootInterfacesFromRegion() throws JavaModelException {
- IType[] types = this.typeHierarchy.getRootInterfaces();
- assertTypesEqual(
- "Unexpected root classes",
- "binary.I\n" +
- "rich.I\n" +
- "rich.I3\n",
- types);
-}
-/**
- * Ensures that the correct number of subclasses exist in the type
- * hierarchy created on a region.
- */
-public void testGetSubclasses() throws JavaModelException {
- IType type = getClassFile("TypeHierarchy", "lib.jar", "binary", "X.class").getType();
- IType[] types = this.typeHierarchy.getSubclasses(type);
- this.assertTypesEqual(
- "Unexpected subclasses of binary.X",
- "binary.Y\n",
- types
- );
-
- type = getClassFile("TypeHierarchy", "lib.jar", "binary", "I.class").getType();
- types = this.typeHierarchy.getSubclasses(type);
- this.assertTypesEqual(
- "Unexpected subclasses of binary.I",
- "", // interfaces cannot have a subclass
- types
- );
-}
-/**
- * Ensures that the correct number of subtypes exist in the type
- * hierarchy created on a region.
- */
-public void testGetSubtypes() throws JavaModelException {
- IType type = getClassFile("TypeHierarchy", "lib.jar", "binary", "X.class").getType();
- IType[] types = this.typeHierarchy.getSubtypes(type);
- this.assertTypesEqual(
- "Unexpected subtypes of binary.X",
- "binary.Y\n",
- types
- );
-
- type = getClassFile("TypeHierarchy", "lib.jar", "binary", "I.class").getType();
- types = this.typeHierarchy.getSubtypes(type);
- this.assertTypesEqual(
- "Unexpected subtypes of binary.I",
- "binary.X\n" +
- "binary.Y$Inner\n",
- types
- );
-}
-
-/**
- * Ensures that the superclass is correct in the type
- * hierarchy a type created on a region containing a package.
- */
-public void testGetSuperclassInRegion() throws JavaModelException {
- IRegion r = JavaCore.newRegion();
- IPackageFragment p = getPackageFragment("TypeHierarchy", "src", "p1");
- r.add(p);
- ITypeHierarchy hierarchy = p.getJavaProject().newTypeHierarchy(r, null);
-
- IType type = getCompilationUnit("TypeHierarchy", "src", "p1", "Y.java").getType("Y");
- IType superclass= hierarchy.getSuperclass(type);
- assertEquals("Unexpected super class of Y", "X", superclass.getElementName());
-}
-
-/**
- * Ensures that the correct supertypes exist in the type
- * hierarchy created on a region.
- */
-public void testGetSupertypesInRegion() throws JavaModelException {
- IType type = getClassFile("TypeHierarchy", "lib.jar", "binary", "Y.class").getType();
- IType[] superTypes = this.typeHierarchy.getSupertypes(type);
- assertTypesEqual(
- "Unexpected super types of Y",
- "binary.X\n",
- superTypes);
-}
-/**
- * Ensures that the correct supertypes exist in the type
- * hierarchy created on a region containing a project.
- */
-public void testGetSupertypesWithProjectRegion() throws JavaModelException {
- IJavaProject project = getJavaProject("TypeHierarchy");
- IRegion region= JavaCore.newRegion();
- region.add(project);
- IType type = getClassFile("TypeHierarchy", "lib.jar", "binary", "Y.class").getType();
- ITypeHierarchy hierarchy = project.newTypeHierarchy(type, region, null);
- IType[] superTypes = hierarchy.getSupertypes(type);
- assertTypesEqual(
- "Unexpected super types of Y",
- "binary.X\n",
- superTypes);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java
deleted file mode 100644
index 8ec2066..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.jdt.core.*;
-
-import junit.framework.Test;
-
-public class TypeResolveTests extends ModifyingResourceTests {
- ICompilationUnit cu;
-public TypeResolveTests(String name) {
- super(name);
-}
-private IType getType(IType[] types, String sourceTypeName) throws JavaModelException {
- for (int i = 0; i < types.length; i++) {
- IType sourceType = types[i];
- if (sourceType.getTypeQualifiedName().equals(sourceTypeName)) {
- return sourceType;
- } else if ((sourceType = getType(sourceType.getTypes(), sourceTypeName)) != null) {
- return sourceType;
- }
- }
- return null;
-}
-private IType getType(String sourceTypeName) throws JavaModelException {
- return getType(this.cu.getTypes(), sourceTypeName);
-}
-private String[][] resolveType(String typeName, String sourceTypeName) throws JavaModelException {
- IType sourceType = this.getType(sourceTypeName);
- assertTrue("Type " + sourceTypeName + " was not found", sourceType != null);
- return sourceType.resolveType(typeName);
-}
-private String resultToString(String[][] result) {
- StringBuffer toString = new StringBuffer();
- if(result != null) {
- for (int i = 0; i < result.length; i++) {
- String[] qualifiedName = result[i];
- String packageName = qualifiedName[0];
- if (packageName.length() > 0) {
- toString.append(packageName);
- toString.append(".");
- }
- toString.append(qualifiedName[1]);
- if (i < result.length-1) {
- toString.append("\n");
- }
- }
- }
- return toString.toString();
-}
-/* (non-Javadoc)
- * @see org.eclipse.jdt.core.tests.model.AbstractJavaModelTests#setUpSuite()
- */
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.setUpJavaProject("TypeResolve");
- this.cu = this.getCompilationUnit("TypeResolve", "src", "p", "TypeResolve.java");
-}
-public static Test suite() {
- return new Suite(TypeResolveTests.class);
-}
-/* (non-Javadoc)
- * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#tearDownSuite()
- */
-public void tearDownSuite() throws Exception {
- this.deleteProject("TypeResolve");
- super.tearDownSuite();
-}
-/**
- * Resolve the type "B" within one of the secondary types.
- * (regression test for bug 23829 IType::resolveType incorrectly returns null)
- */
-public void testResolveInSecondaryType() throws JavaModelException {
- IType type = this.getCompilationUnit("/TypeResolve/src/p3/B.java").getType("Test");
- String[][] types = type.resolveType("B");
- assertEquals(
- "Unexpected result",
- "p3.B",
- this.resultToString(types));
-}
-/**
- * Resolve the type "B" within one of its inner classes.
- */
-public void testResolveMemberTypeInInner() throws JavaModelException {
- String[][] types = this.resolveType("B", "TypeResolve$A$B$D");
- assertEquals(
- "Unexpected result",
- "p.TypeResolve.A.B",
- this.resultToString(types));
-}
-/**
- * Resolve the type "C" within one of its sibling classes.
- */
-public void testResolveSiblingTypeInInner() throws JavaModelException {
- String[][] types = this.resolveType("C", "TypeResolve$A$B");
- assertEquals(
- "Unexpected result",
- "p.TypeResolve.A.C",
- this.resultToString(types));
-}
-/**
- * Resolve the type "X" with a type import for it
- * within an inner class
- */
-public void testResolveTypeInInner() throws JavaModelException {
- String[][] types = this.resolveType("X", "TypeResolve$A");
- assertEquals(
- "Unexpected result",
- "p1.X",
- this.resultToString(types));
-}
-/**
- * Resolve the type "String".
- */
-public void testResolveTypeInJavaLang() throws JavaModelException {
- String[][] types = this.resolveType("String", "TypeResolve");
- assertEquals(
- "Unexpected result",
- "java.lang.String",
- this.resultToString(types));
-}
-/**
- * Resolve the type "Vector" with no imports.
- */
-public void testResolveTypeWithNoImports() throws JavaModelException {
- String[][] types = this.resolveType("Vector", "TypeResolve");
- assertEquals(
- "Unexpected result",
- "",
- this.resultToString(types));
-}
-/**
- * Resolve the type "Y" with an on-demand import.
- */
-public void testResolveTypeWithOnDemandImport() throws JavaModelException {
- String[][] types = this.resolveType("Y", "TypeResolve");
- assertEquals(
- "Unexpected result",
- "p2.Y",
- this.resultToString(types));
-}
-/**
- * Resolve the type "X" with a type import for it.
- */
-public void testResolveTypeWithTypeImport() throws JavaModelException {
- String[][] types = this.resolveType("X", "TypeResolve");
- assertEquals(
- "Unexpected result",
- "p1.X",
- this.resultToString(types));
-}
-/**
- * Resolve the type "String".
- */
-public void testResolveString() throws JavaModelException {
- String[][] types = this.resolveType("String", "TypeResolve");
- assertEquals(
- "Unexpected result",
- "java.lang.String",
- this.resultToString(types));
-}
-/**
- * Resolve the type "A.Inner".
- */
-public void testResolveInnerType1() throws JavaModelException {
- IType type = this.getCompilationUnit("/TypeResolve/src/p4/B.java").getType("B");
- String[][] types = type.resolveType("A.Inner");
- assertEquals(
- "Unexpected result",
- "p4.A.Inner",
- this.resultToString(types));
-}
-/**
- * Resolve the type "p4.A.Inner".
- */
-public void testResolveInnerType2() throws JavaModelException {
- IType type = this.getCompilationUnit("/TypeResolve/src/p4/B.java").getType("B");
- String[][] types = type.resolveType("p4.A.Inner");
- assertEquals(
- "Unexpected result",
- "p4.A.Inner",
- this.resultToString(types));
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/VariablesInitializer.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/VariablesInitializer.java
deleted file mode 100644
index 566d1ca..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/VariablesInitializer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.ClasspathVariableInitializer;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-
-public class VariablesInitializer extends ClasspathVariableInitializer {
-
- public static ITestInitializer initializer;
-
- public static interface ITestInitializer {
- public void initialize(String variable) throws JavaModelException;
- }
-
- public static void reset() {
- initializer = null;
- String[] varNames = JavaCore.getClasspathVariableNames();
- try {
- JavaCore.setClasspathVariables(varNames, new IPath[varNames.length], null);
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
- }
-
- public static void setInitializer(ITestInitializer initializer) {
- VariablesInitializer.initializer = initializer;
- }
-
- public void initialize(String variable) {
- if (initializer == null) return;
- try {
- initializer.initialize(variable);
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyNotInClasspathTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyNotInClasspathTests.java
deleted file mode 100644
index f4b4e8e..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyNotInClasspathTests.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IBuffer;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.Util;
-
-public class WorkingCopyNotInClasspathTests extends ModifyingResourceTests {
-
- private ICompilationUnit workingCopy;
-
-public WorkingCopyNotInClasspathTests(String name) {
- super(name);
-}
-
-
-
-public static Test suite() {
- return new Suite(WorkingCopyNotInClasspathTests.class);
-}
-
-public void setUp() throws Exception {
- super.setUp();
- try {
- this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("P/txt");
- IFile file = this.createFile("P/txt/X.java",
- "public class X {\n" +
- "}");
- ICompilationUnit cu = (ICompilationUnit)JavaCore.create(file);
- this.workingCopy = (ICompilationUnit)cu.getWorkingCopy();
- } catch (CoreException e) {
- e.printStackTrace();
- }
-}
-
-public void tearDown() throws Exception {
- try {
- if (this.workingCopy != null) {
- this.workingCopy.destroy();
- this.workingCopy = null;
- }
- this.deleteProject("P");
- } catch (CoreException e) {
- e.printStackTrace();
- }
- super.tearDown();
-}
-
-public void testCommit() throws CoreException {
- ICompilationUnit original = (ICompilationUnit)this.workingCopy.getOriginalElement();
- assertTrue("Original element should not be null", original != null);
-
- IBuffer workingCopyBuffer = this.workingCopy.getBuffer();
- assertTrue("Working copy buffer should not be null", workingCopyBuffer != null);
-
- String newContents =
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}";
- workingCopyBuffer.setContents(newContents);
- this.workingCopy.commit(false, null);
-
- IFile originalFile = (IFile)original.getResource();
- assertSourceEquals(
- "Unexpected contents",
- newContents,
- new String(Util.getResourceContentsAsCharArray(originalFile)));
-}
-
-/*
- * Ensure that a working copy outside the classpath does not exist
- * (but can still be opened).
- */
-public void testExistence() throws CoreException {
- assertTrue("Working copy should exist", this.workingCopy.exists());
-}
-public void testGetSource() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createJavaProject("P1", new String[] {}, "bin");
- this.createFolder("/P1/src/junit/test");
- String source =
- "package junit.test;\n" +
- "public class X {\n" +
- "}";
- IFile file = this.createFile("/P1/src/junit/test/X.java", source);
- ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file);
- copy = (ICompilationUnit) cu.getWorkingCopy();
- assertEquals(
- "Unexpected source",
- source,
- copy.getSource());
- } finally {
- if (copy != null) copy.destroy();
- this.deleteProject("P1");
- }
-}
-public void testParentExistence() throws CoreException {
- assertTrue("Working copy's parent should not exist", !this.workingCopy.getParent().exists());
-}
-/*
- * Ensure that a working copy created on a .java file in a simple project can be opened.
- * (regression test for bug 33748 Cannot open working copy on .java file in simple project)
- */
-public void testSimpleProject() throws CoreException {
- IParent copy = null;
- try {
- createProject("SimpleProject");
- IFile file = createFile(
- "/SimpleProject/X.java",
- "public class X {\n" +
- "}"
- );
- ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file);
- copy = (IParent)cu.getWorkingCopy();
- try {
- copy.getChildren();
- } catch (JavaModelException e) {
- assertTrue("Should not get JavaModelException", false);
- }
- } finally {
- if (copy != null) {
- ((IWorkingCopy)copy).destroy();
- }
- deleteProject("SimpleProject");
- }
-}
-
-/*
- * Ensure that a original cu (which is outside the classpath) does not exist.
- */
-public void testOriginalExistence() throws CoreException {
- ICompilationUnit original = (ICompilationUnit)this.workingCopy.getOriginalElement();
- assertTrue(
- "Original compilation unit should not exist",
- !original.exists());
-}
-public void testOriginalParentExistence() throws CoreException {
- assertTrue(
- "Original compilation unit's parent should not exist",
- !this.workingCopy.getOriginalElement().getParent().exists());
-}
-
-public void testIsOpen() throws CoreException {
- assertTrue("Working copy should be open", this.workingCopy.isOpen());
-}
-/*
- * Ensure that a original cu (which is outside the classpath) is not opened.
- */
-public void testOriginalIsOpen() throws CoreException {
- ICompilationUnit original = (ICompilationUnit)this.workingCopy.getOriginalElement();
- assertTrue(
- "Original compilation should not be opened",
- !original.isOpen());
-}
-// 31799 - asking project options on non-Java project populates the perProjectInfo cache incorrectly
-public void testIsOnClasspath() throws CoreException {
- ICompilationUnit copy = null;
- try {
- this.createProject("SimpleProject");
- this.createFolder("/SimpleProject/src/junit/test");
- String source =
- "package junit.test;\n" +
- "public class X {\n" +
- "}";
- IFile file = this.createFile("/SimpleProject/src/junit/test/X.java", source);
- ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file);
- copy = (ICompilationUnit) cu.getWorkingCopy();
-
- // working creation will cause it to open, and thus request project options
- boolean isOnClasspath = copy.getJavaProject().isOnClasspath(copy);
- assertTrue("working copy shouldn't answer to isOnClasspath", !isOnClasspath);
- } finally {
- if (copy != null) copy.destroy();
- this.deleteProject("SimpleProject");
- }
-}
-
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopySearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopySearchTests.java
deleted file mode 100644
index f0e6855..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopySearchTests.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.IWorkingCopy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-public class WorkingCopySearchTests extends JavaSearchTests {
- ICompilationUnit workingCopy;
-
-public WorkingCopySearchTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- TestSuite suite = new Suite(WorkingCopySearchTests.class.getName());
-
- suite.addTest(new WorkingCopySearchTests("testAddNewType"));
- suite.addTest(new WorkingCopySearchTests("testRemoveType"));
- suite.addTest(new WorkingCopySearchTests("testMoveType"));
- suite.addTest(new WorkingCopySearchTests("testHierarchyScopeOnWorkingCopy"));
- suite.addTest(new WorkingCopySearchTests("testDeclarationOfReferencedTypes"));
-
- return suite;
-}
-/**
- * Get a new working copy.
- */
-protected void setUp() {
- try {
- this.workingCopy = (ICompilationUnit)this.getCompilationUnit("JavaSearch", "src", "wc", "X.java").getWorkingCopy();
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
-}
-/**
- * Destroy the working copy.
- */
-protected void tearDown() throws Exception {
- this.workingCopy.destroy();
- this.workingCopy = null;
-}
-
-
-/**
- * Hierarchy scope on a working copy test.
- */
-public void testHierarchyScopeOnWorkingCopy() throws JavaModelException, CoreException {
- ICompilationUnit unit = this. getCompilationUnit("JavaSearch", "src", "a9", "A.java");
- ICompilationUnit copy = (ICompilationUnit)unit.getWorkingCopy();
- try {
- IType type = copy.getType("A");
- IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
- assertTrue("a9.A should be included in hierarchy scope", scope.encloses(type));
- assertTrue("a9.C should be included in hierarchy scope", scope.encloses(copy.getType("C")));
- assertTrue("a9.B should be included in hierarchy scope", scope.encloses(copy.getType("B")));
- IPath path = unit.getUnderlyingResource().getFullPath();
- assertTrue("a9/A.java should not be included in hierarchy scope", !scope.encloses(path.toString()));
- } finally {
- copy.destroy();
- }
-}
-
-
-/**
- * Type declaration in a working copy test.
- * A new type is added in the working copy only.
- */
-public void testAddNewType() throws JavaModelException, CoreException {
- this.workingCopy.createType(
- "class NewType {\n" +
- "}",
- null,
- false,
- null);
-
- IJavaSearchScope scope =
- SearchEngine.createJavaSearchScope(
- new IJavaElement[] {this.workingCopy.getParent()});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine(new IWorkingCopy[] {this.workingCopy}).search(
- getWorkspace(),
- "NewType",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "src/wc/X.java wc.NewType [NewType]",
- resultCollector.toString());
-}
-/**
- * Declaration of referenced types test.
- * (Regression test for bug 5355 search: NPE in searchDeclarationsOfReferencedTypes )
- */
-public void testDeclarationOfReferencedTypes() throws JavaModelException, CoreException {
- IMethod method = this.workingCopy.getType("X").createMethod(
- "public void foo() {\n" +
- " X x = new X();\n" +
- "}",
- null,
- true,
- null);
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine().searchDeclarationsOfReferencedTypes(
- getWorkspace(),
- method,
- resultCollector
- );
- assertEquals(
- "src/wc/X.java wc.X [X]",
- resultCollector.toString());
-}
-
-
-/**
- * Type declaration in a working copy test.
- * A type is removed from the working copy only.
- */
-public void testRemoveType() throws JavaModelException, CoreException {
- this.workingCopy.getType("X").delete(true, null);
-
- IJavaSearchScope scope =
- SearchEngine.createJavaSearchScope(
- new IJavaElement[] {this.workingCopy.getParent()});
-
- // type X should not be visible when working copy hides it
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- new SearchEngine(new IWorkingCopy[] {this.workingCopy}).search(
- getWorkspace(),
- "X",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-
- // ensure the type is still present in the compilation unit
- resultCollector = new JavaSearchResultCollector();
- new SearchEngine().search(
- getWorkspace(),
- "X",
- TYPE,
- DECLARATIONS,
- scope,
- resultCollector);
- assertEquals(
- "src/wc/X.java wc.X [X]",
- resultCollector.toString());
-
-}
-/**
- * Type declaration in a working copy test.
- * A type is moved from one working copy to another.
- */
-public void testMoveType() throws JavaModelException, CoreException {
-
- // move type X from working copy in one package to a working copy in another package
- IJavaElement element1 = getCompilationUnit("JavaSearch", "src", "wc1", "X.java").getWorkingCopy();
- ICompilationUnit workingCopy1 = (ICompilationUnit)element1;
- IJavaElement element2 = getCompilationUnit("JavaSearch", "src", "wc2", "Y.java").getWorkingCopy();
- ICompilationUnit workingCopy2 = (ICompilationUnit)element2;
-
- try {
- workingCopy1.getType("X").move(workingCopy2, null, null, true, null);
-
- SearchEngine searchEngine = new SearchEngine(new IWorkingCopy[] {workingCopy1, workingCopy2});
-
- // type X should not be visible in old package
- IJavaSearchScope scope1 = SearchEngine.createJavaSearchScope(new IJavaElement[] {workingCopy1.getParent()});
- JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
- searchEngine.search(
- getWorkspace(),
- "X",
- TYPE,
- DECLARATIONS,
- scope1,
- resultCollector);
- assertEquals(
- "",
- resultCollector.toString());
-
- // type X should be visible in new package
- IJavaSearchScope scope2 = SearchEngine.createJavaSearchScope(new IJavaElement[] {workingCopy2.getParent()});
- resultCollector = new JavaSearchResultCollector();
- searchEngine.search(
- getWorkspace(),
- "X",
- TYPE,
- DECLARATIONS,
- scope2,
- resultCollector);
- assertEquals(
- "src/wc2/Y.java wc2.X [X]",
- resultCollector.toString());
- } finally {
- workingCopy1.destroy();
- workingCopy2.destroy();
- }
-}
-
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyTests.java
deleted file mode 100644
index d25297c..0000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyTests.java
+++ /dev/null
@@ -1,858 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import junit.framework.Test;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-
-
-
-public class WorkingCopyTests extends ModifyingResourceTests {
- ICompilationUnit cu = null;
- ICompilationUnit copy = null;
-
- public class BufferFactory implements IBufferFactory {
- /*
- * @see IBufferFactory#createBuffer(IOpenable)
- */
- public IBuffer createBuffer(IOpenable owner) {
- return new Buffer(owner);
- }
-
- }
- public class Buffer implements IBuffer {
- IOpenable owner;
- ArrayList changeListeners;
- char[] contents = null;
- public Buffer(IOpenable owner) {
- this.owner = owner;
- }
- /*
- * @see IBuffer#addBufferChangedListener(IBufferChangedListener)
- */
- public void addBufferChangedListener(IBufferChangedListener listener) {
- if (this.changeListeners == null) {
- this.changeListeners = new ArrayList(5);
- }
- if (!this.changeListeners.contains(listener)) {
- this.changeListeners.add(listener);
- }
- }
-
- /*
- * @see IBuffer#append(char[])
- */
- public void append(char[] text) {
- }
-
- /*
- * @see IBuffer#append(String)
- */
- public void append(String text) {
- }
-
- /*
- * @see IBuffer#close()
- */
- public void close() {
- this.contents = null; // mark as closed
- if (this.changeListeners != null) {
- BufferChangedEvent event = null;
- event = new BufferChangedEvent(this, 0, 0, null);
- for (int i = 0, size = this.changeListeners.size(); i < size; ++i) {
- IBufferChangedListener listener = (IBufferChangedListener) this.changeListeners.get(i);
- listener.bufferChanged(event);
- }
- this.changeListeners = null;
- }
- }
-
- /*
- * @see IBuffer#getChar(int)
- */
- public char getChar(int position) {
- return 0;
- }
-
- /*
- * @see IBuffer#getCharacters()
- */
- public char[] getCharacters() {
- return contents;
- }
-
- /*
- * @see IBuffer#getContents()
- */
- public String getContents() {
- return new String(contents);
- }
-
- /*
- * @see IBuffer#getLength()
- */
- public int getLength() {
- return contents.length;
- }
-
- /*
- * @see IBuffer#getOwner()
- */
- public IOpenable getOwner() {
- return this.owner;
- }
-
- /*
- * @see IBuffer#getText(int, int)
- */
- public String getText(int offset, int length) {
- return null;
- }
-
- /*
- * @see IBuffer#getUnderlyingResource()
- */
- public IResource getUnderlyingResource() {
- return null;
- }
-
- /*
- * @see IBuffer#hasUnsavedChanges()
- */
- public boolean hasUnsavedChanges() {
- return false;
- }
-
- /*
- * @see IBuffer#isClosed()
- */
- public boolean isClosed() {
- return this.contents == null;
- }
-
- /*
- * @see IBuffer#isReadOnly()
- */
- public boolean isReadOnly() {
- return false;
- }
-
- /*
- * @see IBuffer#removeBufferChangedListener(IBufferChangedListener)
- */
- public void removeBufferChangedListener(IBufferChangedListener listener) {
- if (this.changeListeners != null) {
- this.changeListeners.remove(listener);
- if (this.changeListeners.size() == 0) {
- this.changeListeners = null;
- }
- }
- }
-
- /*
- * @see IBuffer#replace(int, int, char[])
- */
- public void replace(int position, int length, char[] text) {
- }
-
- /*
- * @see IBuffer#replace(int, int, String)
- */
- public void replace(int position, int length, String text) {
- }
-
- /*
- * @see IBuffer#save(IProgressMonitor, boolean)
- */
- public void save(IProgressMonitor progress, boolean force)
- throws JavaModelException {
- }
-
- /*
- * @see IBuffer#setContents(char[])
- */
- public void setContents(char[] characters) {
- contents = characters;
- }
-
- /*
- * @see IBuffer#setContents(String)
- */
- public void setContents(String characters) {
- contents = characters.toCharArray();
- }
-
-}
-
-public WorkingCopyTests(String name) {
- super(name);
-}
-
-public static Test suite() {
- return new Suite(WorkingCopyTests.class);
-}
-protected void setUp() {
- try {
- this.createJavaProject(
- "P",
- new String[] {"src"},
- new String[] {this.getExternalJCLPathString(), "lib"},
- "bin");
- this.createFolder("P/src/x/y");
- this.createFile("P/src/x/y/A.java",
- "package x.y;\n" +
- "import java.io.File;\n" +
- "public class A {\n" +
- " public class Inner {\n" +
- " public class InnerInner {\n" +
- " }\n" +
- " int innerField;\n" +
- " void innerMethod() {\n" +
- " }\n" +
- " }\n" +
- " static String FIELD;\n" +
- " {\n" +
- " FIELD = File.pathSeparator;\n" +
- " }\n" +
- " int field1;\n" +
- " boolean field2;\n" +
- " public void foo() {\n" +
- " }\n" +
- "}");
- this.cu = this.getCompilationUnit("P/src/x/y/A.java");
- this.copy = (ICompilationUnit) cu.getWorkingCopy();
- } catch (CoreException e) {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage());
- }
-}
-protected void tearDown() throws Exception {
- if (this.copy != null) this.copy.destroy();
- this.deleteProject("P");
-}
-/**
- */
-public void testChangeContent() throws CoreException {
- String newContents =
- "package x.y;\n" +
- "public class A {\n" +
- " public void bar() {\n" +
- " }\n" +
- "}";
- this.copy.getBuffer().setContents(newContents);
- this.copy.reconcile();
- assertSourceEquals(
- "Unexpected working copy contents",
- newContents,
- this.copy.getBuffer().getContents());
-
- this.copy.commit(true, null);
- assertSourceEquals(
- "Unexpected original cu contents",
- newContents,
- this.cu.getBuffer().getContents());
-}
-/**
- */
-public void testChangeContentOfReadOnlyCU() throws CoreException {
- IResource resource = this.cu.getUnderlyingResource();
- boolean readOnlyFlag = resource.isReadOnly();
- boolean didComplain = false;
- try {
- resource.setReadOnly(true);
- this.copy.getBuffer().setContents("invalid");
- this.copy.commit(true, null);
- } catch(JavaModelException e){
- didComplain = true;
- } finally {
- resource.setReadOnly(readOnlyFlag);
- }
- assertTrue("Should have complained about modifying a read-only unit:", didComplain);
- assertTrue("ReadOnly buffer got modified:", !this.cu.getBuffer().getContents().equals("invalid"));
-}
-
-/**
- * Ensures that the source contents of a working copy are
- * not altered by changes to the source of the original compilation
- * unit.
- */
-public void testContents() throws CoreException {
- String originalSource = this.cu.getSource();
- IType type = this.cu.getType("A");
- assertDeletion(type);
- assertSourceEquals("source code of copy should still be original", originalSource, this.copy.getSource());
-}
-
-/**
- * Test creating a working copy on a class file with a customized buffer.
- */
-public void testOnClassFile() throws JavaModelException {
- this.attachSource(this.getPackageFragmentRoot("P", this.getExternalJCLPathString()), this.getExternalJCLSourcePath().toOSString(), "src");
- IClassFile classFile = this.getClassFile("P", this.getExternalJCLPathString(), "java.lang", "Object.class");
- IBufferFactory factory = new BufferFactory();
- IJavaElement customizedCopy = classFile.getWorkingCopy(null, factory);
- try {
- assertTrue("Should be an IOpenable", customizedCopy instanceof ICompilationUnit);
- IBuffer buffer = ((ICompilationUnit)customizedCopy).getBuffer();
- assertTrue("Unexpected buffer", buffer instanceof Buffer);
- assertTrue("Buffer should be initialized with source", buffer.getCharacters().length > 0);
- } finally {
- if (customizedCopy instanceof IWorkingCopy) {
- ((IWorkingCopy)customizedCopy).destroy();
- }
- }
-}
-/**
- * Create the compilation unit place holder for the working copy tests.
- */
-public void testCreation() throws JavaModelException {
- assertTrue("Failed to create X.java compilation unit", this.cu != null && this.cu.exists());
- assertTrue("Failed to create working copy on X.java", this.copy != null && this.copy.exists());
-}
-
-/**
- * Test creating a working copy with a customized buffer.
- */
-public void testCustomizedBuffer() throws JavaModelException {
- IBufferFactory factory = new BufferFactory();
- IWorkingCopy customizedCopy = (IWorkingCopy)this.cu.getWorkingCopy(null, factory, null);
- try {
- assertTrue("Should be an IOpenable", customizedCopy instanceof IOpenable);
- assertTrue("Unexpected buffer", ((IOpenable)customizedCopy).getBuffer() instanceof Buffer);
- } finally {
- customizedCopy.destroy();
- }
-}
-/**
- * Test closing then reopening a working copy with a customized buffer.
- */
-public void testCustomizedBuffer2() throws JavaModelException {
- IBufferFactory factory = new BufferFactory();
- IWorkingCopy customizedCopy = (IWorkingCopy)this.cu.getWorkingCopy(null, factory, null);
- try {
- assertTrue("Should be an IOpenable", customizedCopy instanceof IOpenable);
- IOpenable openableCopy = (IOpenable)customizedCopy;
- openableCopy.close();
- openableCopy.open(null);
- assertTrue("Unexpected buffer", openableCopy.getBuffer() instanceof Buffer);
- } finally {
- customizedCopy.destroy();
- }
-}
-/*
- * Test that deleting 2 fields in a JavaCore.run() operation reports the correct delta.
- * (regression test for bug 32225 incorrect delta after deleting 2 fields)
- */
-public void testDelete2Fields() throws CoreException {
- try {
- startDeltas();
- JavaCore.run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IType type = copy.getType("A");
- IField field1 = type.getField("field1");
- IField field2 = type.getField("field2");
- field1.delete(false, monitor);
- field2.delete(false, monitor);
- }
- },
- null);
- assertDeltas(
- "Unexpected delta",
- "A[*]: {CHILDREN | FINE GRAINED}\n" +
- " field1[-]: {}\n" +
- " field2[-]: {}"
- );
- } finally {
- stopDeltas();
- }
-}
-/**
- * Tests the general functionality of a working copy:<ul>
- * <li>ensures that the copy and original compilation unit are not equal</li>
- * <li>ensures the correct retrieval of the original element</li>
- * <li>closing the package of the compilation unit does not close the copy</li>
- * <li>ensures that working copies are unique
- * <li>ensures committing changes from working copies
- */
-public void testGeneral() throws JavaModelException, CoreException, IOException {
-
- assertTrue("copy and actual should not be equal", !this.copy.equals(this.cu));
-
- IType copyType= this.copy.getType("A");
-
- assertTrue("can't get original from original", this.cu.getOriginalElement() == null);
-
- assertTrue("getting working copy from a copy should yield original copy", this.copy.getWorkingCopy() == this.copy);
-
- boolean ex= false;
- assertDeletion(copyType);
-
- // closing the package should not close the copy
- ((IOpenable)this.cu.getParent()).close();
- assertTrue("copy should still be open", this.copy.isOpen());
-
- // verify original still present
- assertTrue("actual type should still be present", this.cu.getType("A").exists());
-
- // getAnother working copy
- ICompilationUnit copy2= (ICompilationUnit)this.cu.getWorkingCopy();
- try {
- assertTrue("working copies should be unique ", !(this.copy.equals(copy2)));
-
- // delete a method from the 2nd working copy.
- IMethod method= copy2.getType("A").getMethod("foo", null);
-
- assertDeletion(method);
- IMethod originalMethod= this.cu.getType("A").getMethod("foo", null);
- assertTrue("method should still be present in original", originalMethod.exists());
-
- // commit the changes from the 2nd copy.
- copy2.commit(false, null);
-
- assertTrue("copy always has unsaved changes", copy2.hasUnsavedChanges());
-
- // original method should now be gone
- assertTrue("method should no longer be present in original after commit", !originalMethod.exists());
-
- // commit the changes from the 1st copy - should fail
- try {
- this.copy.commit(false, null);
- assertTrue("commit should have failed", ex);
- } catch (JavaModelException jme) {
- }
-
-
- // now force the update
- try {
- this.copy.commit(true, null);
- } catch (JavaModelException jme) {
- assertTrue("commit should work", false);
- }
-
- // now the type should be gone.
- assertTrue("original type should no longer be present", !this.cu.getType("A").exists());
-
-
- this.copy.close();
- ex= false;
- try {
- this.copy.open(null);
- } catch (JavaModelException e) {
- ex= true;
- }
- assertTrue("should be able to open working copy a 2nd time", !ex);
-
- // now destroy the handle
- this.copy.destroy();
- ex= false;
- try {
- this.copy.open(null);
- } catch (JavaModelException e) {
- ex= true;
- }
- assertTrue("should not be able to open working copy again", ex);
- } finally {
- copy2.destroy();
- }
-}
-/**
- * Ensures that no original element can be retrieved on a binary element.
- * unit.
- */
-public void testGetOriginalBinaryElement() throws CoreException {
- /* Evaluate the following in a scrapbook:
- org.eclipse.jdt.tests.core.ModifyingResourceTests.generateClassFile(
- "A",
- "public class A {\n" +
- "}")
- */
- byte[] bytes = new byte[] {
- -54, -2, -70, -66, 0, 3, 0, 45, 0, 10, 1, 0, 1, 65, 7, 0, 1, 1, 0, 16, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 79, 98, 106, 101, 99, 116, 7, 0, 3, 1, 0, 6, 60, 105, 110, 105, 116, 62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100, 101, 12, 0, 5, 0, 6, 10, 0, 4, 0, 8, 0, 33, 0, 2, 0, 4, 0, 0, 0,
- 0, 0, 1, 0, 1, 0, 5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 17, 0, 1, 0, 1, 0, 0, 0, 5, 42, -73, 0, 9, -79, 0, 0, 0, 0, 0, 0,
- };
- this.createFile("P/lib/A.class", new String(bytes));
- IClassFile cf = this.getClassFile("P/lib/A.class");
- IJavaElement original= this.copy.getOriginal(cf);
- assertTrue("Element should not be found", original == null);
-}
-/**
- * Ensures that the original cu can be retrieved.
- */
-public void testGetOriginalCU() throws JavaModelException {
- IJavaElement original= this.copy.getOriginal(copy);
- assertTrue("Element is not a cu", original instanceof ICompilationUnit && !((ICompilationUnit)original).isWorkingCopy());
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that getting the original element from a different compilation unit returns null.
- */
-public void testGetOriginalElementNotInWorkingCopy() throws CoreException {
- ICompilationUnit copy2 = null;
- try {
- this.createFile(
- "P/src/x/y/B.java",
- "package x.y;\n" +
- "public class B {\n" +
- "}");
- ICompilationUnit cu2 = this.getCompilationUnit("P/src/x/y/B.java");
- copy2 = (ICompilationUnit)cu2.getWorkingCopy();
-
- IPackageDeclaration pkg= copy2.getPackageDeclaration("x.y");
- IJavaElement original= this.copy.getOriginal(pkg);
- assertTrue("Element should not be found as from a different working copy", original == null);
- } finally {
- if (copy2 != null) copy2.destroy();
- }
-}
-/**
- * Ensures that the original field can be retrieved.
- */
-public void testGetOriginalField() throws JavaModelException {
- IType type = this.copy.getType("A");
- IJavaElement original = this.copy.getOriginal(type.getField("FIELD"));
- assertTrue("Element is not a method", original instanceof IField && !((ICompilationUnit)original.getParent().getParent()).isWorkingCopy());
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that the original import declaration can be retrieved.
- */
-public void testGetOriginalImportDeclaration() throws JavaModelException {
- IImportDeclaration imprt = copy.getImport("java.io.File");
- IJavaElement original= this.copy.getOriginal(imprt);
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that the original import container can be retrieved.
- */
-public void testGetOriginalImportContainer() throws JavaModelException {
- IImportContainer container = this.copy.getImportContainer();
- IJavaElement original = this.copy.getOriginal(container);
- assertTrue("Element should not be null", original != null);
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that the original initializer can be retrieved.
- */
-public void testGetOriginalInitializer() throws JavaModelException {
- IType type= copy.getType("A");
- IJavaElement original= copy.getOriginal(type.getInitializer(1));
- assertTrue("Element should exist", original.exists());
-}
-/**
- */
-public void testGetOriginalInnerField() throws JavaModelException {
- IType innerType = this.copy.getType("A").getType("Inner");
- IJavaElement original = this.copy.getOriginal(innerType.getField("innerField"));
- assertTrue("Element is not a field", original instanceof IField);
- assertTrue("Element should exist", original.exists());
-}
-/**
- */
-public void testGetOriginalInnerMethod() throws JavaModelException {
- IType innerType = this.copy.getType("A").getType("Inner");
- IJavaElement original = copy.getOriginal(innerType.getMethods()[0]);
- assertTrue("Element is not a method", original instanceof IMethod);
- assertTrue("Element should exist", original.exists());
-}
-/**
- */
-public void testGetOriginalInnerType() throws JavaModelException {
- IType innerInnerType = this.copy.getType("A").getType("Inner").getType("InnerInner");
- IJavaElement original = this.copy.getOriginal(innerInnerType);
- assertTrue("Element is not a method", original instanceof IType);
- assertTrue("Element should exist", original.exists());
-
- Vector hierarchy = new Vector(5);
- IJavaElement parent= original.getParent();
- while (parent.getElementType() > IJavaElement.COMPILATION_UNIT) {
- hierarchy.addElement(parent);
- parent = parent.getParent();
- }
- hierarchy.addElement(parent);
- assertTrue("Compilation Unit should not be a working copy", !((ICompilationUnit)hierarchy.lastElement()).isWorkingCopy());
-}
-/**
- * Ensures that the original method can be retrieved.
- */
-public void testGetOriginalMethod() throws JavaModelException {
- IType type = this.copy.getType("A");
- IJavaElement original= copy.getOriginal(type.getMethods()[0]);
- assertTrue("Element is not a method", original instanceof IMethod);
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that renaming a method of a working copy does
- * not alter the source of the original compilation
- * unit.
- */
-public void testRenameMethod() throws JavaModelException {
- IType type = this.copy.getType("A");
- IMethod method = type.getMethods()[0];
- IJavaElement original= copy.getOriginal(method);
- method.rename("bar", false, null);
- assertEquals("Invalid name of working copy method", "bar", type.getMethods()[0].getElementName());
- assertEquals("Invalid name of original method", "foo", original.getElementName());
-}
-/**
- * Ensures that the original package declaration can be retrieved.
- */
-public void testGetOriginalPackageDeclaration() throws JavaModelException {
- IPackageDeclaration pkg = this.copy.getPackageDeclaration("x.y");
- IJavaElement original = this.copy.getOriginal(pkg);
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that the original type can be retrieved.
- */
-public void testGetOriginalType() throws JavaModelException {
- IType type = this.copy.getType("A");
- IJavaElement original= copy.getOriginal(type);
- assertTrue("Element should exist", original.exists());
-}
-/**
- * Ensures that a type can be moved to another working copy.
- * (regression test for bug 7881 IType.move() clobbers editing buffer of destination element)
- */
-public void testMoveTypeToAnotherWorkingCopy() throws CoreException {
- this.createFile(
- "P/src/x/y/B.java",
- "package x.y;\n" +
- "public class B {\n" +
- "}");
- ICompilationUnit cu2 = this.getCompilationUnit("P/src/x/y/B.java");
- ICompilationUnit copy2 = (ICompilationUnit)cu2.getWorkingCopy();
- try {
- IType classA = this.copy.getType("A");
- IType classB = copy2.getType("B");
- classA.move(classB, null, null, false, null);
- assertTrue("A should not exist", !classA.exists());
- assertTrue("B.A should exist", classB.getType("A").exists());
- assertTrue("Buffer for A should not be null", this.copy.getBuffer() != null);
- assertSourceEquals("Invalid content for A",
- "package x.y;\n" +
- "import java.io.File;\n",
- this.copy.getBuffer().getContents());
- assertTrue("Buffer for B should not be null", copy2.getBuffer() != null);
- assertSourceEquals("Invalid content for B",
- "package x.y;\n" +
- "public class B {\n" +
- "public class A {\n" +
- " public class Inner {\n" +
- " public class InnerInner {\n" +
- " }\n" +
- " int innerField;\n" +
- " void innerMethod() {\n" +
- " }\n" +
- " }\n" +
- " static String FIELD;\n" +
- " {\n" +
- " FIELD = File.pathSeparator;\n" +
- " }\n" +
- " int field1;\n" +
- " boolean field2;\n" +
- " public void foo() {\n" +
- " }\n" +
- "}\n" +
- "}",
- copy2.getBuffer().getContents());
- } finally {
- copy2.destroy();
- }
-}
-/**
- * Test creating a shared working copy.
- */
-public void testShared1() throws JavaModelException {
- IJavaElement shared = this.cu.getSharedWorkingCopy(null, null, null);
- try {
- assertTrue("Should be an IWorkingCopy", shared instanceof IWorkingCopy);
- assertTrue("Original element should have shared working copy", this.cu.findSharedWorkingCopy(null) == shared);
- } finally {
- if (shared instanceof IWorkingCopy) {
- ((IWorkingCopy)shared).destroy();
- }
- }
- assertTrue("Original element should not have shared working copy", this.cu.findSharedWorkingCopy(null) == null);
-}
-/**
- * Test several call to creating shared working copy.
- */
-public void testShared2() throws JavaModelException {
- IWorkingCopy shared = (IWorkingCopy)this.cu.getSharedWorkingCopy(null, null, null);
- try {
- IWorkingCopy shared2 = (IWorkingCopy)this.cu.getSharedWorkingCopy(null, null, null);
- assertTrue("Second working copy should be identical to first one", shared2 == shared);
- } finally {
- shared.destroy();
- try {
- assertTrue("Original element should still have shared working copy", this.cu.findSharedWorkingCopy(null) == shared);
- } finally {
- shared.destroy();
- }
- }
- assertTrue("Original element should not have shared working copy", this.cu.findSharedWorkingCopy(null) == null);
-}
-/**
- * Tests that multiple commits are possible with the same working copy.
- */
-public void testMultipleCommit() throws JavaModelException, CoreException, IOException {
-
- // Add a method to the working copy
- IType gp = this.copy.getType("A");
- try {
- gp.createMethod("public void anotherMethod() {}\n",null, false, null);
- } catch (JavaModelException jme) {
- assertTrue("creation failed", false);
- }
-
- // commit the changes from the copy.
- try {
- this.copy.commit(false, null);
- } catch (JavaModelException t) {
- assertTrue("commit failed", false);
- }
-
- // new method added
- assertTrue("method should exist after commit",
- this.cu.getType("A").getMethod("anotherMethod", new String[]{}).exists());
-
- //add another method
- try {
- gp.createMethod("public void anotherAnotherMethod() {}\n", null, false, null);
- } catch (JavaModelException x) {
- assertTrue("Creation failed 2", false);
- }
-
- //commit the new method
- try {
- this.copy.commit(false, null);
- } catch (JavaModelException t) {
- assertTrue("commit2 failed", false);
- }
-
- // new method added
- assertTrue("second method added should exist after commit",
- this.cu.getType("A").getMethod("anotherAnotherMethod", new String[]{}).exists());
-}
-/**
- * Creates a working copy on a non-existing compilation unit.
- * (regression test for bug 8921 DCR - Need a way to create a working copy ignoring existing files)
- */
-public void testNonExistingCU() throws JavaModelException {
- ICompilationUnit nonExistingCU = this.getCompilationUnit("P/src/x/y/NonExisting.java");
- IWorkingCopy workingCopy = null;
- try {
- // getBuffer()
- workingCopy = (IWorkingCopy)nonExistingCU.getWorkingCopy();
- assertSourceEquals("Buffer should be empty", "", ((IOpenable)workingCopy).getBuffer().getContents());
-
- // exists()
- assertTrue("Working copy should exists", ((IJavaElement)workingCopy).exists());
-
- // getCorrespondingResource()
- assertEquals("Corresponding resource should be null", null, ((IJavaElement)workingCopy).getCorrespondingResource());
-
- // getOriginalElement()
- assertEquals("Unexpected orginal element", nonExistingCU, workingCopy.getOriginalElement());
-
- // getPath()
- assertEquals("Unexpected path", new Path("/P/src/x/y/NonExisting.java"), ((IJavaElement)workingCopy).getPath());
-
- // getResource()
- assertEquals("Unexpected resource", null, ((IJavaElement)workingCopy).getResource());
-
- // isConsistent()
- assertTrue("Working copy should be consistent", ((IOpenable)workingCopy).isConsistent());
-
- // restore()
- boolean exception = false;
- try {
- workingCopy.restore();
- } catch (JavaModelException e) {
- exception = true;
- }
- assertTrue("Should not be able to restore from original element", exception);
-
- // makeConsistent()
- ((IOpenable)workingCopy).getBuffer().setContents(
- "public class X {\n" +
- "}");
- assertTrue("Working copy should not be consistent", !((IOpenable)workingCopy).isConsistent());
- ((IOpenable)workingCopy).makeConsistent(null);
- assertTrue("Working copy should be consistent", ((IOpenable)workingCopy).isConsistent());
-
- // save()
- ((IOpenable)workingCopy).getBuffer().setContents(
- "public class Y {\n" +
- "}");
- ((IOpenable)workingCopy).save(null, false);
- assertTrue("Working copy should be consistent after save", ((IOpenable)workingCopy).isConsistent());
- assertTrue("Original cu should not exist", !nonExistingCU.exists());
-
- // commit()
- workingCopy.commit(false, null);
- assertTrue("Original cu should exist", nonExistingCU.exists());
-
- // isBasedOn()
- assertTrue("Working copy should not be based on original resource", !workingCopy.isBasedOn(nonExistingCU.getResource()));
-
- } finally {
- if (workingCopy != null) {
- workingCopy.destroy();
- }
- if (nonExistingCU.exists()) {
- nonExistingCU.delete(true, null);
- }
- }
-}
-/**
- * Tests the general functionality of a operations working with working copies:<ul>
- * <li>ensures that the copy cannot be renamed</li>
- * <li>ensures that the copy cannot be moved to the same location as the original cu</li>
- * <li>ensures that the copy can be copied to a different location as the original cu</li>
- */
-public void testOperations() throws JavaModelException {
- // rename working copy
- boolean ex= false;
- try {
- this.copy.rename("someName.java", false, null);
- } catch (JavaModelException jme) {
- assertTrue("Incorrect status code for attempting to rename working copy", jme.getStatus().getCode() == IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
- ex= true;
- }
- assertTrue("renaming a working copy should fail", ex);
-
- // move to same location as original cu
- ex= false;
- try {
- this.copy.move((IPackageFragment)this.cu.getParent(), null, "someName.java", false, null);
- } catch (JavaModelException jme) {
- assertTrue("Incorrect status code for attempting to move working copy", jme.getStatus().getCode() == IJavaModelStatusConstants.INVALID_ELEMENT_TYPES);
- ex= true;
- }
- assertTrue("moving a working copy should fail", ex);
-
- // copy working copy to default package
- IPackageFragment pkg= getPackageFragment("P", "src", "");
- this.copy.copy(pkg, null, "someName.java", false, null);
- assertCreation(this.copy);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/test.xml b/org.eclipse.jdt.core.tests.model/test.xml
deleted file mode 100644
index 9658944..0000000
--- a/org.eclipse.jdt.core.tests.model/test.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <property name="eclipse-home" value="${basedir}\..\.."/>
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="plugin-name" value="org.eclipse.jdt.core.tests.model"/>
- <property name="library-file"
- value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <!-- Java Model tests -->
- <property name="jdt-model-folder"
- value="${eclipse-home}/jdt_model_folder"/>
- <delete dir="${jdt-model-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jdt-model-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jdt.core.tests.model.AllJavaModelTests"/>
- </ant>
-
- <!-- DOM tests -->
- <property name="jdt-dom-folder"
- value="${eclipse-home}/jdt_dom_folder"/>
- <delete dir="${jdt-dom-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jdt-dom-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jdt.core.tests.dom.RunAllTests"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath
deleted file mode 100644
index 8530bb5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="lib" path="attach.jar"/>
- <classpathentry kind="lib" path="attach2.jar"/>
- <classpathentry kind="lib" path="test.jar"/>
- <classpathentry kind="lib" path="update.jar"/>
- <classpathentry kind="lib" path="full.jar"/>
- <classpathentry kind="lib" path="test2.jar"/>
- <classpathentry kind="lib" path="test4.jar"/>
- <classpathentry kind="lib" path="lib"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.project b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach.jar
deleted file mode 100644
index 2a34147..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2.jar
deleted file mode 100644
index de4b989..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2src.zip b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2src.zip
deleted file mode 100644
index 56cc73c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attach2src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.new.zip b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.new.zip
deleted file mode 100644
index 8b17f5a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.new.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.zip b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.zip
deleted file mode 100644
index 02f0d58..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/attachsrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/full.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/full.jar
deleted file mode 100644
index cf3beba..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/full.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/fullsrc.zip b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/fullsrc.zip
deleted file mode 100644
index 5303715..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/fullsrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/lib/p/X.class b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/lib/p/X.class
deleted file mode 100644
index 555a887..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/lib/p/X.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/src.zip b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/src.zip
deleted file mode 100644
index 5184443..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/srcLib/p/X.java b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/srcLib/p/X.java
deleted file mode 100644
index aff3b23..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/srcLib/p/X.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p;
-public class X {
- public void foo() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test.jar
deleted file mode 100644
index b4575c8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test2.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test2.jar
deleted file mode 100644
index 45d4b00..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test2.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4.jar
deleted file mode 100644
index a0c845b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4_src.zip b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4_src.zip
deleted file mode 100644
index c5e7250..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test4_src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/update.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/update.jar
deleted file mode 100644
index 5e0fec3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/update.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.classpath b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.classpath
deleted file mode 100644
index dce3aa7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="lib.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.project b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/lib.jar b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/lib.jar
deleted file mode 100644
index 599826b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/lib.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/libSrc.zip b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/libSrc.zip
deleted file mode 100644
index f933437..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/libSrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectArgument1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectArgument1.java
deleted file mode 100644
index c6e0473..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectArgument1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectArgument1 {
- void foo(int bar0){
- bar = 5;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException1.java
deleted file mode 100644
index 16d768e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectException1 {
- void foo() throws aaa.bbbz.AnException {
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException2.java
deleted file mode 100644
index b85a844..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectException2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectException2 {
- void foo() throws aaa.bbb.AnExceptionz {
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField1.java
deleted file mode 100644
index a877fb8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField1.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CorrectField1 {
- public int bar0;
- void foo(){
- bar = 5;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField2.java
deleted file mode 100644
index 565aaa2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectField2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CorrectField2 {
- public int bar0;
- void foo(){
- CorrectField2 cf = new CorrectField2();
- cf.bar = 5;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType1.java
deleted file mode 100644
index c084f64..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CorrectFieldType1 {
- aaa.dddz.AClass field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType2.java
deleted file mode 100644
index 61811ac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CorrectFieldType2 {
- aaa.ddd.AClassz field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType3.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType3.java
deleted file mode 100644
index 72a0ea1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import aaa.ddd.*;
-
-public class CorrectFieldType3 {
- AClassz field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport1.java
deleted file mode 100644
index 71e8d67..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import aaa.dddz.AClass;
-
-public class CorrectImport1 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport2.java
deleted file mode 100644
index a75f686..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import aaa.dddz.*;
-
-public class CorrectImport2 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport3.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport3.java
deleted file mode 100644
index de17af3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import aaa.ddd.AClassz;
-
-public class CorrectImport3 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariable1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariable1.java
deleted file mode 100644
index 1d87bd9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariable1.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CorrectLocalVariable1 {
- void foo(){
- int bar0;
- bar = 5;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType1.java
deleted file mode 100644
index 76655c5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectLocalVariableType1 {
- void foo(){
- aaa.dddz.AClass local;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType2.java
deleted file mode 100644
index b133f0b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectLocalVariableType2 {
- void foo(){
- aaa.ddd.AClassz local;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod1.java
deleted file mode 100644
index 517fc8a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod1.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CorrectMethod1 {
- public void bar0(){
-
- }
-
- void foo(){
- bar();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod2.java
deleted file mode 100644
index a1c0c46..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod2.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CorrectMethod2 {
- public void bar0(){
-
- }
-
- void foo(){
- CorrectMethod2 cm = new CorrectMethod2();
- cm.bar();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType1.java
deleted file mode 100644
index 3b495ac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectReturnType1 {
- public aaa.dddz.AClass foo(){
- return new aaa.ddd.AClass();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType2.java
deleted file mode 100644
index b523f12..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CorrectReturnType2 {
- public aaa.ddd.AClassz foo(){
- return new aaa.ddd.AClass();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass1.java
deleted file mode 100644
index e3b7972..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CorrectSuperClass1 extends aaa.dddz.AClass {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass2.java
deleted file mode 100644
index 98899b2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CorrectSuperClass2 extends aaa.ddd.AClassz {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface1.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface1.java
deleted file mode 100644
index 4076375..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CorrectSuperInterface1 implements aaa.bbb.cccz.AListener {
- public void foo(){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface2.java b/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface2.java
deleted file mode 100644
index 5c465ab..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CorrectSuperInterface2 implements aaa.bbb.ccc.AListenerz {
- public void foo(){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Completion/.classpath
deleted file mode 100644
index dcd105e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src2"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="zzz.jar" sourcepath="/Completion/zzzsrc.zip"/>
- <classpathentry kind="lib" path="pack.jar"/>
- <classpathentry kind="lib" path="class-folder"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/.project b/org.eclipse.jdt.core.tests.model/workspace/Completion/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/mypackage/MyClass.class b/org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/mypackage/MyClass.class
deleted file mode 100644
index 3745735..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/mypackage/MyClass.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/pack1/PX.class b/org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/pack1/PX.class
deleted file mode 100644
index e3bc960..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/class-folder/pack1/PX.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/lib.jar b/org.eclipse.jdt.core.tests.model/workspace/Completion/lib.jar
deleted file mode 100644
index a0aa3d6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/lib.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/pack.jar b/org.eclipse.jdt.core.tests.model/workspace/Completion/pack.jar
deleted file mode 100644
index c8cba3b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/pack.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/A.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/A.java
deleted file mode 100644
index a6d350f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class A {
- public int bar;
- public void bar(){}
- public void foobar(){}
- public void foobar(int i){}
- public static void foo(){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/B.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/B.java
deleted file mode 100644
index ac3cfb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public interface B {
- public void foobar();
- public void foobar(int i);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CUWithSecondaryType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CUWithSecondaryType.java
deleted file mode 100644
index 75e7251..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CUWithSecondaryType.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CUWithSecondaryType {
-
-}
-class SecondaryType2 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/ClassWithComplexName.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/ClassWithComplexName.java
deleted file mode 100644
index 93e25b8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/ClassWithComplexName.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public class ClassWithComplexName {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance1.java
deleted file mode 100644
index a7de787..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionAbstractMethodRelevance1 extends CompletionAbstractSuperClass {
- foo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance2.java
deleted file mode 100644
index ecc242b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractMethodRelevance2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionAbstractMethodRelevance2 implements CompletionSuperInterface {
- eq
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractSuperClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractSuperClass.java
deleted file mode 100644
index 05d75e3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAbstractSuperClass.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public abstract class CompletionAbstractSuperClass {
- public void foo1(){}
- public abstract void foo2();
- public void foo3(){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase1.java
deleted file mode 100644
index a5c2428..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase1.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionAfterCase1 {
- static final int zzz = 5;
- void foo(){
- switch(1) {
- case zz
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase2.java
deleted file mode 100644
index 634bbe8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAfterCase2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionAfterCase2 {
- static final int zzz = 5;
- void foo(){
- switch(1) {
- case 25:
- case zz
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent1.java
deleted file mode 100644
index 5412816..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent1.java
+++ /dev/null
@@ -1,14 +0,0 @@
-public class CompletionAllocationExpressionIsParent1 {
- CompletionAllocationExpressionIsParent1(int i, long j){super();}
- CompletionAllocationExpressionIsParent1(int i, Object j){super();}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- new CompletionAllocationExpressionIsParent1(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent2.java
deleted file mode 100644
index b0dc48e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent2.java
+++ /dev/null
@@ -1,17 +0,0 @@
-public class CompletionAllocationExpressionIsParent2 {
- public class Inner {
- public Inner(long i, long j){super();}
- public Inner(Object i, Object j){super();}
-
- }
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- this.new Inner(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent3.java
deleted file mode 100644
index a660ae3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent3.java
+++ /dev/null
@@ -1,17 +0,0 @@
-public class CompletionAllocationExpressionIsParent3 {
- public class Inner {
- public Inner(long i, long j){super();}
- public Inner(Object i, Object j){super();}
-
- }
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- new CompletionAllocationExpressionIsParent3().new Inner(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent4.java
deleted file mode 100644
index 546cb4a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent4.java
+++ /dev/null
@@ -1,14 +0,0 @@
-public class CompletionAllocationExpressionIsParent4 {
- CompletionAllocationExpressionIsParent4(long i, long j){}
- CompletionAllocationExpressionIsParent4(Object i, Object j){}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- new CompletionAllocationExpressionIsParent4(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent5.java
deleted file mode 100644
index 91aa6c3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent5.java
+++ /dev/null
@@ -1,13 +0,0 @@
-public class CompletionAllocationExpressionIsParent5 {
- CompletionAllocationExpressionIsParent5(int i){}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- new CompletionAllocationExpressionIsParent5(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent6.java
deleted file mode 100644
index 666588a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent6.java
+++ /dev/null
@@ -1,19 +0,0 @@
-public class CompletionAllocationExpressionIsParent6 {
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- new CompletionAllocation_ERROR_ExpressionIsParent6Plus().new Inner(1, zz
- }
-}
-class CompletionAllocationExpressionIsParent6Plus {
- public class Inner {
- public Inner(long i, long j){
-
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName.java
deleted file mode 100644
index e05d416..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionAmbiguousFieldName {
- int xBar;
- public void foo(int xBar){
- xBa
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName2.java
deleted file mode 100644
index d7a44ad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName2.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionAmbiguousFieldName2 {
- int xBar;
- class classFoo {
- public void foo(int xBar){
- xBa
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName3.java
deleted file mode 100644
index 2a752d9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName3.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionAmbiguousFieldName3 {
- public void foo(){
- class ClassFoo {
- int xBar;
- class ClassFoo2{
- public void foo(int xBar){
- xBa
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName4.java
deleted file mode 100644
index 53db1f4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName4.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionAmbiguousFieldName4 {
- public void foo(){
- new Object() {
- int xBar;
- class ClassFoo {
- public void foo(int xBar){
- xBa
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType.java
deleted file mode 100644
index 70a3e7c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType.java
+++ /dev/null
@@ -1,6 +0,0 @@
-import p1.*;
-import p2.*;
-
-public class CompletionAmbiguousType {
- ABC
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType2.java
deleted file mode 100644
index 7925422..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-import p1.ABC;
-import p2.*;
-
-public class CompletionAmbiguousType2 {
- ABC
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArgumentName.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArgumentName.java
deleted file mode 100644
index 322b610..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArgumentName.java
+++ /dev/null
@@ -1,7 +0,0 @@
-import java.io.FileInputStream;
-
-public class CompletionArgumentName {
- public void foo(ClassWithComplexName complexName, ClassWithComplexName ){
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArrayAccess1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArrayAccess1.java
deleted file mode 100644
index 3ee0003..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionArrayAccess1.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionArrayAccess1 {
- String zzz1;
- int zzz2;
- void foo(){
- String[] s;
- String s2 = s[zzz]
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod1.java
deleted file mode 100644
index 5fdd985..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod1.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionAssignmentInMethod1 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo {
- long o;
- o = zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod2.java
deleted file mode 100644
index 0a64014..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod2.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionAssignmentInMethod2 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo {
- Object o;
- o = zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod3.java
deleted file mode 100644
index 8658569..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionAssignmentInMethod3 {
- void foo {
- Object o;
- o = new Objec
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod4.java
deleted file mode 100644
index 7de5d0b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionAssignmentInMethod4 {
- void foo {
- Object o;
- o = new Objec;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator1.java
deleted file mode 100644
index 3fb2fc2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator1.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionBinaryOperator1 {
- int var1;
- boolean var2;
- Object var3;
- String var4
-
- void foo() {
- int x = 1 + var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator2.java
deleted file mode 100644
index cb0d559..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionBinaryOperator2 {
- int var1;
- boolean var2;
- Object var3;
-
- void foo() {
- boolean b = true || var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator3.java
deleted file mode 100644
index 6bb052e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator3.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionBinaryOperator3 {
- int var1;
- boolean var2;
- Object var3;
-
- void foo() {
- double x = 1 / var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitive.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitive.java
deleted file mode 100644
index baa5a61..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitive.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionCaseInsensitive {
- int field;
- public void foo() {
- this.Field
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitivePackage.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitivePackage.java
deleted file mode 100644
index ab3dce3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitivePackage.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionCaseInsensitivePackage {
- public void foo() {
- Ja
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent1.java
deleted file mode 100644
index 624689c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent1.java
+++ /dev/null
@@ -1,27 +0,0 @@
-public class CompletionCastIsParent1 {
- Object zzOb;
- XX00 zz00;
- XX01 zz01;
- XX02 zz02;
- XX10 zz10;
- XX11 zz11;
- XX12 zz12;
- XX20 zz20;
- XX21 zz21;
- XX22 zz22;
-
- Object zzObM(){}
- XX00 zz00M(){}
- XX01 zz01M(){}
- XX02 zz02M(){}
- XX10 zz10M(){}
- XX11 zz11M(){}
- XX12 zz12M(){}
- XX20 zz20M(){}
- XX21 zz21M(){}
- XX22 zz22M(){}
-
- XX11 foo() {
- return (XX11)zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent2.java
deleted file mode 100644
index e72fef4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionCastIsParent2 {
- XX11 foo() {
- return (XX11)xx
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName.java
deleted file mode 100644
index a958386..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionCatchArgumentName {
- public void foo(){
- try{
-
- } catch (Exception ex)
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName2.java
deleted file mode 100644
index 57e9e0b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionCatchArgumentName2 {
- public void foo(){
- try{
-
- } catch (Exception )
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression1.java
deleted file mode 100644
index a25018c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression1.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionConditionalExpression1 {
- int var1;
- boolean var2;
- Object var3;
- String var4
-
- void foo() {
- boolean a, b;
- int c;
- c = a == b ? var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression2.java
deleted file mode 100644
index 5339cef..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression2.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionConditionalExpression2 {
- int var1;
- boolean var2;
- Object var3;
- String var4
-
- void foo() {
- boolean a, b;
- int c;
- c = a == b ? var1 : var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression3.java
deleted file mode 100644
index ffb97ed..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression3.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionConditionalExpression3 {
- int var1;
- boolean var2;
- Object var3;
- String var4
-
- void foo() {
- boolean a, b;
- int c;
- c = a == b ? var1 : (var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConstructorForAnonymousType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConstructorForAnonymousType.java
deleted file mode 100644
index 8d61715..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionConstructorForAnonymousType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionConstructorForAnonymousType {
- void foo() {
- TypeWithConstructor a = new TypeWithConstructor(
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionDefaultPackage.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionDefaultPackage.java
deleted file mode 100644
index c94feff..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionDefaultPackage.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionDefaultPackage {
- public void foo() {
- Default.foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyToken1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyToken1.java
deleted file mode 100644
index 27a17ea..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyToken1.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionEmptyToken1 {
- int zzyy;
- void foo() {
- zzyy
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName1.java
deleted file mode 100644
index be4ae74..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionEmptyTypeName1 {
- void foo() {
- A a = new
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName2.java
deleted file mode 100644
index 8d681bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionEmptyTypeName2 {
- void foo() {
- A a =
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEndOfCompilationUnit.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEndOfCompilationUnit.java
deleted file mode 100644
index 7d2aafe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionEndOfCompilationUnit.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionEndOfCompilationUnit {
- public void foo() {
- }
- public void foo(int i) {
- foo
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionExpectedTypeIsNotValid.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionExpectedTypeIsNotValid.java
deleted file mode 100644
index da0096a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionExpectedTypeIsNotValid.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionExpectedTypeIsNotValid {
- public void foo() {
- UnknownType var = new
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer1.java
deleted file mode 100644
index 137df61..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer1.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionFieldInitializer1 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- long o = zz
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer2.java
deleted file mode 100644
index ecf2ab4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionFieldInitializer2 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- Object o = zz
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer3.java
deleted file mode 100644
index fa7423a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionFieldInitializer3 {
- Object o = new Objec
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer4.java
deleted file mode 100644
index 04ca439..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionFieldInitializer4 {
- Object o = new Objec;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldName.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldName.java
deleted file mode 100644
index e15b535..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFieldName.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionFieldName {
- ClassWithComplexName complexName;
- ClassWithComplexName
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass.java
deleted file mode 100644
index 5adbd11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionFindClass {
- private A[] a;
- public CompletionFindClass () {
- this.a = new A
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass2.java
deleted file mode 100644
index 62b70ac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindClass2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionFindClass2 {
- public void foo(){
- pack1.PX
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindConstructor.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindConstructor.java
deleted file mode 100644
index ececce4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindConstructor.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionFindConstructor {
- public CompletionFindConstructor (int i) {
- }
- publuc void foo(){
- int x = 45;
- new CompletionFindConstructor(i);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException1.java
deleted file mode 100644
index a0d2a45..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionFindException1 {
- void foo(){
- try{
- } catch(Ex e) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException2.java
deleted file mode 100644
index 8d7173a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindException2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionFindException2 {
- void foo() throws Ex {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField1.java
deleted file mode 100644
index 773fed0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField1.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionFindField1 {
- int var;
- public void foo(int i)
- public void bar(int var) {
- foo(var);
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField2.java
deleted file mode 100644
index 484b6fd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField2.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionFindField2 {
- int var;
- public void foo(int i)
- public void bar(int var) {
- this.var;
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField3.java
deleted file mode 100644
index 63622a7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindField3.java
+++ /dev/null
@@ -1,13 +0,0 @@
-interface A3 {
- public static final String bar = "a";
-}
-interface B3 extends A3 {
- public static final String bar = "b";
-}
-public class CompletionFindField3 {
- public void foo() {
- B3 b = null;
- System.out.println(b.ba);
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport1.java
deleted file mode 100644
index 05d284e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import pac
-
-public class CompletionFindImport1 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport2.java
deleted file mode 100644
index 468b36f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindImport2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import pack1.P
-
-public class CompletionFindImport2 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindLocalVariable.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindLocalVariable.java
deleted file mode 100644
index fad899f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindLocalVariable.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionFindLocalVariable {
- public void foo(int i)
- public void bar() {
- int var
- foo(var);
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType1.java
deleted file mode 100644
index d7653af..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType1.java
+++ /dev/null
@@ -1,13 +0,0 @@
-interface A1 {
- class Inner1 {
- }
-}
-interface B1 extends A1 {
- class Inner1 {
- }
-}
-public class CompletionFindMemberType1 {
- public void foo() {
- B1.Inner
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType2.java
deleted file mode 100644
index 0f45fc9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMemberType2.java
+++ /dev/null
@@ -1,13 +0,0 @@
-interface A2 {
- class Inner2{
- }
-}
-interface B2 extends A2 {
- class Inner2 {
- }
-}
-public class CompletionFindMemberType2 implements B2{
- public void foo() {
- Inner
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod1.java
deleted file mode 100644
index c7fd106..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod1.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionFindMethod1 {
- A a;
- void foo(){
- a.fooba
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod2.java
deleted file mode 100644
index d601986..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethod2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionFindMethod2 {
- void foo(B b){
- b.fooba
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInProcess.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInProcess.java
deleted file mode 100644
index f1b46da..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInProcess.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionFindMethodInProcess {
- public void foobar(){
- }
- public int foo () {
- fooba
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInThis.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInThis.java
deleted file mode 100644
index c754afe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInThis.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionFindMethodInThis {
- public void foobar(int i){
- }
- void foo(){
- foobar(45);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSecondaryType1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSecondaryType1.java
deleted file mode 100644
index 94a013a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSecondaryType1.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionFindSecondaryType1 {
- /**/Secondary
-}
-class SecondaryType1 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSuperInterface.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSuperInterface.java
deleted file mode 100644
index cd2a0c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindSuperInterface.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionFindSuperInterface implements SuperInterface {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindThisDotField.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindThisDotField.java
deleted file mode 100644
index b8d8b9a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionFindThisDotField.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionFindThisDotField {
- public int bar;
- void foo() {
- this.bar = 45;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionInstanceofOperator1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionInstanceofOperator1.java
deleted file mode 100644
index a992f70..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionInstanceofOperator1.java
+++ /dev/null
@@ -1,21 +0,0 @@
-public class CompletionInstanceofOperator1 {
- void foo(WWWCompletionInstanceof2 x) {
- if(x instanceof WWWCompletionInstanceof){}
- }
-}
-
-class WWWCompletionInstanceof1 {
-
-}
-
-class WWWCompletionInstanceof2 extends WWWCompletionInstanceof1 {
-
-}
-
-class WWWCompletionInstanceof3 extends WWWCompletionInstanceof2 {
-
-}
-
-class WWWCompletionInstanceof4 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalName.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalName.java
deleted file mode 100644
index 0f8915e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalName.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionLocalName {
- public void foo(){
- ClassWithComplexName complexName;
- ClassWithComplexName
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalType1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalType1.java
deleted file mode 100644
index ee84602..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionLocalType1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionLocalType1 {
- void foo() {
- class ZZZZ {
- ZZZ
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType.java
deleted file mode 100644
index cc5df5c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionMemberType {
- public class Y {
- public void foo(){
- Y var = new
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType2.java
deleted file mode 100644
index 24e3f80..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMemberType2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionMemberType2 {
- public class MemberException extends Exception {
- }
- void foo() {
- throw new
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent1.java
deleted file mode 100644
index 834b749..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent1.java
+++ /dev/null
@@ -1,14 +0,0 @@
-public class CompletionMessageSendIsParent1 {
- void bar(int i, long j){}
- void bar(int i, Object j){}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- bar(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent2.java
deleted file mode 100644
index f7ea66c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent2.java
+++ /dev/null
@@ -1,16 +0,0 @@
-public class CompletionMessageSendIsParent2 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo(CompletionMessageSendIsParent2Interface i) {
- i.bar(1, zz
- }
-}
-
-interface CompletionMessageSendIsParent2Interface {
- void bar(int i, long j);
- void bar(int i, Object j);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent3.java
deleted file mode 100644
index 1b89e39..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent3.java
+++ /dev/null
@@ -1,16 +0,0 @@
-public class CompletionMessageSendIsParent3 extends CompletionMessageSendIsParent3SuperClass {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- bar(1, zz
- }
-}
-
-class CompletionMessageSendIsParent3SuperClass {
- void bar(int i, long j);
- void bar(int i, Object j);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent4.java
deleted file mode 100644
index 8604ff2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent4.java
+++ /dev/null
@@ -1,14 +0,0 @@
-public class CompletionMessageSendIsParent4 {
- void bar(long i, long j){}
- void bar(Object i, Object j){}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- bar(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent5.java
deleted file mode 100644
index dcff4b3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent5.java
+++ /dev/null
@@ -1,13 +0,0 @@
-public class CompletionMessageSendIsParent5 {
- void bar(int i){}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- bar(1, zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent6.java
deleted file mode 100644
index e83437c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent6.java
+++ /dev/null
@@ -1,13 +0,0 @@
-public class CompletionMessageSendIsParent6 {
- int bar(int i, int j){return 0;}
-
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo() {
- bar(new CompletionMessageSendIsParent6().bar(0,0), zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration.java
deleted file mode 100644
index b108fe0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionMethodDeclaration extends SuperClass {
- eq
-}
-
-class SuperClass {
- public int eqFoo(int a,Object b){
- return 1;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration10.java
deleted file mode 100644
index 92f5dfd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionMethodDeclaration10 {
- clon
- foo();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration2.java
deleted file mode 100644
index c4d911d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionMethodDeclaration2 extends CompletionSuperClass {
- eq
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration3.java
deleted file mode 100644
index 91404dd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration3.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionMethodDeclaration3 extends CompletionSuperClass {
- eq
-
- public int eqFoo(int a,Object b){
- return 1;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration4.java
deleted file mode 100644
index a3746fe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public abstract class CompletionMethodDeclaration4 implements CompletionSuperInterface {
- eq
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration5.java
deleted file mode 100644
index 6070dbe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionMethodDeclaration5 {
- public static void main(String[] args) {
- new CompletionSuperClass() {
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration6.java
deleted file mode 100644
index 40cc573..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration6.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionMethodDeclaration6 {
- void foo() {
- new Object(){
- protected Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- clon
- };
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration7.java
deleted file mode 100644
index 5ec360b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionMethodDeclaration7 {
- clon x
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration8.java
deleted file mode 100644
index 59698cc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionMethodDeclaration8 {
- clon
- x
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration9.java
deleted file mode 100644
index 401f48f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionMethodDeclaration9 {
- clon foo(){
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause.java
deleted file mode 100644
index adb7ff8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionMethodThrowsClause {
- void foo() throws Ex
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause2.java
deleted file mode 100644
index 04a3c1a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionMethodThrowsClause2 {
- void foo() throws java.lang.Ex
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNonEmptyToken1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNonEmptyToken1.java
deleted file mode 100644
index 8692a4f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNonEmptyToken1.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionNonEmptyToken1 {
- int zzyy;
- void foo() {
- zzyy
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNullRequestor.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNullRequestor.java
deleted file mode 100644
index e7d6407..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionNullRequestor.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionNullequestor {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionObjectsMethodWithInterfaceReceiver.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionObjectsMethodWithInterfaceReceiver.java
deleted file mode 100644
index f046330..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionObjectsMethodWithInterfaceReceiver.java
+++ /dev/null
@@ -1,16 +0,0 @@
-interface A {
- int hashCode();
-}
-interface B extends A {
-}
-class C implements B {
- public int hashCode() {
- return super.hashCode();
- }
-}
-public class CompletionObjectsMethodWithInterfaceReceiver {
- public static void main(String[] arguments) {
- C c = new C();
- System.out.println("((A)c).hashCode() : " + ((A) c).hash
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember1.java
deleted file mode 100644
index cbb807a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionOnStaticMember1 {
- public static int var1;
- public int var2;
- void foo() {
- this.var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember2.java
deleted file mode 100644
index aa44e32..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionOnStaticMember2 {
- public static void method1(){}
- public void method2(){}
- void foo(){
- this.method
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOutOfBounds.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOutOfBounds.java
deleted file mode 100644
index 3172c77..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionOutOfBounds.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionOutOfBounds {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName1.java
deleted file mode 100644
index fffce74..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName1.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionPrefixFieldName1 {
- int xBar;
-
- class classFoo {
- int xBar;
-
- public void foo(){
- xBa
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName2.java
deleted file mode 100644
index 8e45ea3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixFieldName2.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionPrefixFieldName2 {
- int xBar;
-
- class classFoo {
- int xBar;
-
- public void foo(){
- new CompletionPrefixFieldName2().xBa
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName1.java
deleted file mode 100644
index 7d39d1a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName1.java
+++ /dev/null
@@ -1,11 +0,0 @@
-ublic class CompletionPrefixMethodName1 {
- int xBar(){}
-
- class classFoo {
- int xBar(){}
-
- public void foo(){
- xBa
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName2.java
deleted file mode 100644
index c54bf1a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName2.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionPrefixMethodName2 {
- int xBar(){}
-
- class classFoo {
- int xBar(){}
-
- public void foo(){
- new CompletionPrefixMethodName2().xBa
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName3.java
deleted file mode 100644
index 22f6b8c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionPrefixMethodName3.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionPrefixMethodName3 {
- int xBar(int a, int b){}
-
- class classFoo {
- int xBar(int a, int b){}
-
- public void foo(){
- xBar(1,
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedAllocationType1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedAllocationType1.java
deleted file mode 100644
index f58661e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedAllocationType1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionQualifiedAllocationType1 {
- public class YYY {
- }
- void foo(){
- this.new YYY
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedExpectedType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedExpectedType.java
deleted file mode 100644
index 6374836..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionQualifiedExpectedType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-import pack1.PX;
-
-public class CompletionQualifiedExpectedType {
- void foo() {
- pack2.PX var = new
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionRepeatedType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionRepeatedType.java
deleted file mode 100644
index 23958f7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionRepeatedType.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionRepeatedType {
- void foo() {
- /**/CompletionRepeated
- }
-}
-
-class CompletionRepeatedOtherType {
-}
-
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnInInitializer.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnInInitializer.java
deleted file mode 100644
index 74ac065..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnInInitializer.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionReturnInInitializer {
- {
- return eq
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent1.java
deleted file mode 100644
index a69e4e0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent1.java
+++ /dev/null
@@ -1,27 +0,0 @@
-public class CompletionReturnStatementIsParent1 {
- Object zzOb;
- XX00 zz00;
- XX01 zz01;
- XX02 zz02;
- XX10 zz10;
- XX11 zz11;
- XX12 zz12;
- XX20 zz20;
- XX21 zz21;
- XX22 zz22;
-
- Object zzObM(){}
- XX00 zz00M(){}
- XX01 zz01M(){}
- XX02 zz02M(){}
- XX10 zz10M(){}
- XX11 zz11M(){}
- XX12 zz12M(){}
- XX20 zz20M(){}
- XX21 zz21M(){}
- XX22 zz22M(){}
-
- XX11 foo() {
- return zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent2.java
deleted file mode 100644
index f2c391a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionReturnStatementIsParent2 {
- XX11 foo() {
- return xx
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSameSuperClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSameSuperClass.java
deleted file mode 100644
index b330990..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSameSuperClass.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionSameSuperClass extends A {
- class Inner extends A {
- void foo(int bar){
- bar
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass.java
deleted file mode 100644
index 4d45311..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionSuperClass{
- public class Inner {}
- public int eqFoo(int a,Object b){
- return 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass2.java
deleted file mode 100644
index 39d1f6c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperClass2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionSuperClass2 {
- public class InnerClass {}
- public interface InnerInterface {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface.java
deleted file mode 100644
index 7908efa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public interface CompletionSuperInterface{
- public int eqFoo(int a,Object b);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface2.java
deleted file mode 100644
index 2c177ec..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperInterface2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public interface CompletionSuperInterface2 {
- public class InnerClass {}
- public interface InnerInterface {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType.java
deleted file mode 100644
index 5b1512c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType.java
+++ /dev/null
@@ -1 +0,0 @@
-public class CompletionSuperType extends CompletionSuperClass.
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType2.java
deleted file mode 100644
index 0ea8624..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType2.java
+++ /dev/null
@@ -1 +0,0 @@
-public class CompletionSuperType2 extends CompletionSuper
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType3.java
deleted file mode 100644
index 3f5a4f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType3.java
+++ /dev/null
@@ -1 +0,0 @@
-public class CompletionSuperType3 implements CompletionSuper
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType4.java
deleted file mode 100644
index 13e7798..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType4.java
+++ /dev/null
@@ -1 +0,0 @@
-public class CompletionSuperType4 extends CompletionSuperClass2.Inner
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType5.java
deleted file mode 100644
index f42027b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType5.java
+++ /dev/null
@@ -1 +0,0 @@
-public class CompletionSuperType5 implements CompletionSuperInterface2.Inner
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType6.java
deleted file mode 100644
index 304719c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType6.java
+++ /dev/null
@@ -1 +0,0 @@
-public interface CompletionSuperType6 extends CompletionSuper
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType7.java
deleted file mode 100644
index 1341e22..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType7.java
+++ /dev/null
@@ -1 +0,0 @@
-public interface CompletionSuperType7 extends CompletionSuperClass2.Inner
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType8.java
deleted file mode 100644
index 9cc2b5a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionSuperType8.java
+++ /dev/null
@@ -1 +0,0 @@
-public interface CompletionSuperType8 extends CompletionSuperInterface2.Inner
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionThrowStatement.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionThrowStatement.java
deleted file mode 100644
index 4a723af..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionThrowStatement.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionThrowStatement {
- void foo(){
- throw new Ex
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionType1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionType1.java
deleted file mode 100644
index ad61935..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionType1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-import q1.*;
-import q1.CT1;
-public class CompletionType1 {
- void foo(){
- CT1
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator1.java
deleted file mode 100644
index c6c92b4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator1.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionUnaryOperator1 {
- int var1;
- boolean var2;
- Object var3;
-
- void foo() {
- int i = -var
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator2.java
deleted file mode 100644
index 47b3c11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionUnaryOperator2 {
- int var1;
- boolean var2;
- Object var3;
-
- void foo() {
- if(!var){}
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedEnclosingType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedEnclosingType.java
deleted file mode 100644
index d77db5f4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedEnclosingType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionUnresolvedEnclosingType {
- public void foo(){
- zzz.new ZZZ(
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedFieldType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedFieldType.java
deleted file mode 100644
index 58d3112..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedFieldType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionUnresolvedFieldType extends pack.Bin3{
- void foo() {
- this.bar
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedParameterType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedParameterType.java
deleted file mode 100644
index 41b7a39..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedParameterType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionUnresolvedParameterType extends pack.Bin2{
- void foo() {
- this.bar
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedReturnType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedReturnType.java
deleted file mode 100644
index 7b1012e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedReturnType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionUnresolvedReturnType extends pack.Bin1{
- void foo() {
- this.bar
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer1.java
deleted file mode 100644
index 6edce90..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer1.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionVariableInitializerInInitializer1 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- {
- long o = zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer2.java
deleted file mode 100644
index 740bc7c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer2.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionVariableInitializerInInitializer2 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- {
- Object o = zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer3.java
deleted file mode 100644
index 5e2fcf8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionVariableInitializerInInitializer3 {
- {
- Object o = new Objec
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer4.java
deleted file mode 100644
index 00d3142..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionVariableInitializerInInitializer4 {
- {
- Object o = new Objec;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod1.java
deleted file mode 100644
index a3e6ee2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod1.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionVariableInitializerInMethod1 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo {
- long o = zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod2.java
deleted file mode 100644
index ce26583..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod2.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class CompletionVariableInitializerInMethod2 {
- long zzlong;
- int zzint;
- double zzdouble;
- boolean zzboolean;
- Object zzObject;
-
- void foo {
- Object o = zz
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod3.java
deleted file mode 100644
index d49fa7f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionVariableInitializerInMethod3 {
- void foo {
- Object o = new Objec
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod4.java
deleted file mode 100644
index ab1c99a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionVariableInitializerInMethod4 {
- void foo {
- Object o = new Objec;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName1.java
deleted file mode 100644
index 49b03f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionVariableName1 {
- void foo() {
- TEST_FOO_MyClass
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName2.java
deleted file mode 100644
index e4979ad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionVariableName2 {
- void foo() {
- Test_Bar_MyClass
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName3.java
deleted file mode 100644
index 513d38a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableName3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionVariableName3 {
- class OneName {}
- void foo() {
- OneName
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray1.java
deleted file mode 100644
index 621b27b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionVariableNameOfArray1 {
- Object[] ob
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray2.java
deleted file mode 100644
index 337c9dc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionVariableNameOfArray2 {
- Class[] cl
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray3.java
deleted file mode 100644
index c9c45ab..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionVariableNameOfArray3 {
- Object[][] ob
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray4.java
deleted file mode 100644
index d2995a8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameOfArray4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionVariableNameOfArray4 {
- Objectz[] ob
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameUnresolvedType.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameUnresolvedType.java
deleted file mode 100644
index fa67af9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVariableNameUnresolvedType.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionVariableNameUnresolvedType {
- Objectz ob
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVisibilityCheck.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVisibilityCheck.java
deleted file mode 100644
index 660bc4c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVisibilityCheck.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class CompletionVisibilityCheck {
- public void foo(){
- CompletionVisibilityCheck1 x = new CompletionVisibilityCheck1();
- x.p
- }
-}
-
-class CompletionVisibilityCheck1{
- private void privateFoo(){}
- protected void protectedFoo(){}
- public void publicFoo(){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVoidMethod.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVoidMethod.java
deleted file mode 100644
index 1f86616..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionVoidMethod.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionVoidMethod {
- int foo1() {return 0;}
- void foo() {}
- Object foo3() {return null;}
- void bar() {
- int i = foo
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionWithBinaryFolder.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionWithBinaryFolder.java
deleted file mode 100644
index d76d750..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/CompletionWithBinaryFolder.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import mypackage.*;
-
-public class CompletionWithBinaryFolder {
- My
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/Default.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/Default.java
deleted file mode 100644
index 5b31d02..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/Default.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class Default {
- public static void foo(){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperClass.java
deleted file mode 100644
index d3d6396..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperClass.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public class SuperClass {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperInterface.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperInterface.java
deleted file mode 100644
index 2ea5260..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/SuperInterface.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public interface SuperInterface {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/TEST_FOO_MyClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/TEST_FOO_MyClass.java
deleted file mode 100644
index 50a0562..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/TEST_FOO_MyClass.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class TEST_FOO_MyClass {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/Test_Bar_MyClass.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/Test_Bar_MyClass.java
deleted file mode 100644
index 9af47a0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/Test_Bar_MyClass.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class Test_Bar_MyClass {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/TypeWithConstructor.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/TypeWithConstructor.java
deleted file mode 100644
index f94558e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/TypeWithConstructor.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public abstract class TypeWithConstructor {
- protected TypeWithConstructor(int i) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX00.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX00.java
deleted file mode 100644
index 0c1a2b1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX00.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX00 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX01.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX01.java
deleted file mode 100644
index 5cea99c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX01.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX01 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX02.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX02.java
deleted file mode 100644
index 79b89dd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX02.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX02 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX10.java
deleted file mode 100644
index 60e638f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX10.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX10 extends XX00 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX11.java
deleted file mode 100644
index d17e89b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX11.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX11 extends XX01 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX12.java
deleted file mode 100644
index 40c7a2a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX12.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX12 extends XX02 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX20.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX20.java
deleted file mode 100644
index aad7430..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX20.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX20 extends XX10{
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX21.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX21.java
deleted file mode 100644
index ffc2fad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX21.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX21 extends XX11 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX22.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX22.java
deleted file mode 100644
index 8f267d2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/XX22.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @author david
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class XX22 extends XX12 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p1/ABC.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p1/ABC.java
deleted file mode 100644
index a55a8ec..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p1/ABC.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p1;
-
-public class ABC {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p2/ABC.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p2/ABC.java
deleted file mode 100644
index d8f0321..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p2/ABC.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p2;
-
-public class ABC {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p3/CompletionToplevelType1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p3/CompletionToplevelType1.java
deleted file mode 100644
index 2a4c7fd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/p3/CompletionToplevelType1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3;
-public class CompletionToplevelType1 {
- p3.CompletionToplevelType1
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/PX.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/PX.java
deleted file mode 100644
index 726e2ab..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/PX.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package pack1;
-
-public class PX {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/pack3/PX.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/pack3/PX.java
deleted file mode 100644
index 695d796..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack1/pack3/PX.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package pack1.pack3;
-
-public class PX {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack2/PX.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack2/PX.java
deleted file mode 100644
index ce949d4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/pack2/PX.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package pack2;
-
-public class PX {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/q1/CT1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/q1/CT1.java
deleted file mode 100644
index 623a27b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/q1/CT1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package q1;
-public class CT1 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/q2/CT1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src/q2/CT1.java
deleted file mode 100644
index fa0a490..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src/q2/CT1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package q2;
-public class CT1 {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract1.java
deleted file mode 100644
index bc05192..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract1.java
+++ /dev/null
@@ -1 +0,0 @@
-abs
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract10.java
deleted file mode 100644
index ba413ce..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract10.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-final abs
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract11.java
deleted file mode 100644
index e41857c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract11.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-abs class
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract12.java
deleted file mode 100644
index ea03ce3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract12.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public abs
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract13.java
deleted file mode 100644
index 38d4e5c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract13.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordAbstract13 {
- abs
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract14.java
deleted file mode 100644
index 24d4e4b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract14.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordAbstract14 {
- final abs
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract15.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract15.java
deleted file mode 100644
index b179cd7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract15.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordAbstract15 {
- abs class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract16.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract16.java
deleted file mode 100644
index 2e28917..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract16.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordAbstract16 {
- public abs
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract2.java
deleted file mode 100644
index a6119aa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract2.java
+++ /dev/null
@@ -1 +0,0 @@
-final abs
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract3.java
deleted file mode 100644
index e274149..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract3.java
+++ /dev/null
@@ -1 +0,0 @@
-abs class
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract4.java
deleted file mode 100644
index fb5ab14..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract4.java
+++ /dev/null
@@ -1 +0,0 @@
-public abs
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract5.java
deleted file mode 100644
index fd5dbed..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordAbstract5 {
- abs
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract6.java
deleted file mode 100644
index bd45745..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordAbstract6 {
- final abs
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract7.java
deleted file mode 100644
index ae47764..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordAbstract7 {
- abs class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract8.java
deleted file mode 100644
index 1d18af8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract8.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordAbstract8 {
- public abs
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract9.java
deleted file mode 100644
index 5e3a006..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract9.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-abs
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert1.java
deleted file mode 100644
index e8a16b0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordAssert1 {
- void foo() {
- as
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert2.java
deleted file mode 100644
index afdcec8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordAssert2 {
- void foo() {
- if(as
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert3.java
deleted file mode 100644
index dfe04a5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordAssert3 {
- as
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert4.java
deleted file mode 100644
index fda05eb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordAssert4 {
- void foo() {
- #
- as
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert5.java
deleted file mode 100644
index 2f0b6f6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordAssert5 {
- void foo() {
- #
- if(as
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert6.java
deleted file mode 100644
index 95d10cd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordAssert6 {
- as
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak1.java
deleted file mode 100644
index 96d71ce..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordBreak1 {
- void foo() {
- for(;;) {
- {
- bre
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak2.java
deleted file mode 100644
index a13b2ae..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordBreak2 {
- void foo() {
- if(true) {
- bre
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak3.java
deleted file mode 100644
index 8e8f000..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak3.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordBreak3 {
- void foo() {
- switch(0) {
- case 1 :
- bre
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak4.java
deleted file mode 100644
index 3450cb8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak4.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordBreak4 {
- void foo() {
- #
- for(;;) {
- {
- bre
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak5.java
deleted file mode 100644
index 928f049..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak5.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordBreak5 {
- void foo() {
- #
- if(true) {
- bre
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak6.java
deleted file mode 100644
index 00e3923..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak6.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordBreak6 {
- void foo() {
- #
- switch(0) {
- case 1 :
- bre
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase1.java
deleted file mode 100644
index 810e4be..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordCase1 {
- void foo(){
- switch(0){
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase10.java
deleted file mode 100644
index 5e885c5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase10.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordCase10 {
- void foo(){
- #
- cas
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase2.java
deleted file mode 100644
index 24654c4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase2.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordCase2 {
- void foo(){
- switch(0){
- case 0:
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase3.java
deleted file mode 100644
index 78bd81e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase3.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordCase3 {
- void foo(){
- switch(0){
- default:
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase4.java
deleted file mode 100644
index 06f3814..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase4.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordCase4 {
- void foo(){
- switch(0){
- case 0:
- break;
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase5.java
deleted file mode 100644
index 0c4ff39..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordCase5 {
- void foo(){
- cas
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase6.java
deleted file mode 100644
index 63f6465..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase6.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordCase6 {
- void foo(){
- #
- switch(0){
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase7.java
deleted file mode 100644
index 1b8e949..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase7.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordCase7 {
- void foo(){
- #
- switch(0){
- case 0:
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase8.java
deleted file mode 100644
index 7605915..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase8.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordCase8 {
- void foo(){
- #
- switch(0){
- default:
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase9.java
deleted file mode 100644
index 829c425..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase9.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionKeywordCase9 {
- void foo(){
- #
- switch(0){
- case 0:
- break;
- cas
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch1.java
deleted file mode 100644
index 41ea397..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch1.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordCatch1 {
- int catchz;
- void foo() {
- try {
-
- } cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch10.java
deleted file mode 100644
index 16b0ca3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch10.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionKeywordCatch10 {
- int catchz;
- void foo() {
- #
- try {
-
- } catch(Exception e) {
- } cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch2.java
deleted file mode 100644
index 9f78558..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordCatch2 {
- void foo() {
- cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch3.java
deleted file mode 100644
index 26c8484..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordCatch3 {
- cat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch4.java
deleted file mode 100644
index 7b1481c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordCatch4 {
- void foo() {
- if(cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch5.java
deleted file mode 100644
index 3a5e512..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch5.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordCatch5 {
- int catchz;
- void foo() {
- try {
-
- } catch(Exception e) {
- } cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch6.java
deleted file mode 100644
index 39ef860..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch6.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordCatch6 {
- int catchz;
- void foo() {
- #
- try {
-
- } cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch7.java
deleted file mode 100644
index 5835010..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch7.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordCatch7 {
- void foo() {
- #
- cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch8.java
deleted file mode 100644
index 315cc04..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordCath8 {
- cat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch9.java
deleted file mode 100644
index f4c9560..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch9.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordCatch9 {
- void foo() {
- #
- if(cat
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass1.java
deleted file mode 100644
index 50f43d4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass1.java
+++ /dev/null
@@ -1 +0,0 @@
-cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass10.java
deleted file mode 100644
index dbb84a4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass10.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordClass10 {
- void foo(){
- cla
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass11.java
deleted file mode 100644
index 5ec5e1a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass11.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordClass11 {
- void foo(){
- final cla
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass12.java
deleted file mode 100644
index fc03798..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass12.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordClass12 {
- void foo(){
- final cla X
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass13.java
deleted file mode 100644
index c46d853..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass13.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass14.java
deleted file mode 100644
index 8007eb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass14.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordClass14 {
- void foo(){
- #
- cla
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass15.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass15.java
deleted file mode 100644
index 57c91df..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass15.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordClass15 {
- void foo(){
- #
- final cla
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass16.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass16.java
deleted file mode 100644
index b7bb317..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass16.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordClass16 {
- void foo(){
- #
- final cla X
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass17.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass17.java
deleted file mode 100644
index c6de1aa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass17.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordClass17 {
-
-}
-cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass18.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass18.java
deleted file mode 100644
index e8f4bbc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass18.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass19.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass19.java
deleted file mode 100644
index 28c56e2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass19.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public abstract cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass2.java
deleted file mode 100644
index 5186205..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordClass2 {
-
-}
-cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass20.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass20.java
deleted file mode 100644
index 48d06ed..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass20.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public cla CompletionKeywordClass20
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass21.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass21.java
deleted file mode 100644
index c8ccfb4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass21.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordClass21 {
- cla
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass22.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass22.java
deleted file mode 100644
index 143c903..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass22.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordClass22 {
- public cla
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass23.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass23.java
deleted file mode 100644
index 62d9459..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass23.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordClass23 {
- public abstract cla
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass24.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass24.java
deleted file mode 100644
index 2ad220b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass24.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordClass24 {
- public cla X
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass3.java
deleted file mode 100644
index ae11224..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass3.java
+++ /dev/null
@@ -1 +0,0 @@
-public cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass4.java
deleted file mode 100644
index cad873b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass4.java
+++ /dev/null
@@ -1 +0,0 @@
-public abstract cla
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass5.java
deleted file mode 100644
index 96e5eba..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass5.java
+++ /dev/null
@@ -1 +0,0 @@
-public cla CompletionKeywordClass5
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass6.java
deleted file mode 100644
index 711577f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordClass6 {
- cla
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass7.java
deleted file mode 100644
index e041ca3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordClass7 {
- public cla
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass8.java
deleted file mode 100644
index 0b40a40..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass8.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordClass8 {
- public abstract cla
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass9.java
deleted file mode 100644
index 4cd3910..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass9.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordClass9 {
- public cla X
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue1.java
deleted file mode 100644
index bedeec1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordContinue1 {
- void foo() {
- for(;;) {
- {
- cont
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue2.java
deleted file mode 100644
index 23593bc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordContinue2 {
- void foo() {
- if(true) {
- cont
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue3.java
deleted file mode 100644
index a62f479..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue3.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordContinue3 {
- void foo() {
- #
- for(;;) {
- {
- cont
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue4.java
deleted file mode 100644
index e200244..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue4.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordContinue4 {
- void foo() {
- #
- if(true) {
- cont
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault1.java
deleted file mode 100644
index 45f303d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordDefault1 {
- void foo(){
- switch(0){
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault10.java
deleted file mode 100644
index e94afad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault10.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordDefault10 {
- void foo(){
- #
- switch(0){
- default:
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault2.java
deleted file mode 100644
index cf61617..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault2.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordDefault2 {
- void foo(){
- switch(0){
- case 0:
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault3.java
deleted file mode 100644
index 641ec0b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault3.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordDefault3 {
- void foo(){
- switch(0){
- case 0:
- break;
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault4.java
deleted file mode 100644
index f1021d6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordDefault4 {
- void foo(){
- def
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault5.java
deleted file mode 100644
index 319b457..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault5.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordDefault5 {
- void foo(){
- switch(0){
- default:
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault6.java
deleted file mode 100644
index 8e63a0d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault6.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordDefault6 {
- void foo(){
- #
- switch(0){
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault7.java
deleted file mode 100644
index b7cc0f7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault7.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordDefault7 {
- void foo(){
- #
- switch(0){
- case 0:
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault8.java
deleted file mode 100644
index 38c1f22..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault8.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionKeywordDefault8 {
- void foo(){
- #
- switch(0){
- case 0:
- break;
- def
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault9.java
deleted file mode 100644
index d96e8f3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault9.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordDefault9 {
- void foo(){
- #
- def
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo1.java
deleted file mode 100644
index 4a3d80a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordDo1 {
- void foo() {
- do
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo2.java
deleted file mode 100644
index 5540724..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordDo2 {
- void foo() {
- if(do
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo3.java
deleted file mode 100644
index 86c4a74..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordDo3 {
- do
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo4.java
deleted file mode 100644
index 803942e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordDo4 {
- void foo() {
- #
- do
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo5.java
deleted file mode 100644
index 984f95f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordDo5 {
- void foo() {
- #
- if(do
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo6.java
deleted file mode 100644
index 4425c09..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordDo6 {
- do
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse1.java
deleted file mode 100644
index b47a67e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordElse1 {
- void foo() {
- if(true) {
-
- } els
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse2.java
deleted file mode 100644
index e967e1e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordElse2 {
- void foo() {
- els
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse3.java
deleted file mode 100644
index be0950d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordElse3 {
- els
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse4.java
deleted file mode 100644
index 60e96e2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordElse4 {
- void foo() {
- if(els
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse5.java
deleted file mode 100644
index 20b3742..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse5.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordElse5 {
- void foo() {
- #
- if(true) {
-
- } els
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse6.java
deleted file mode 100644
index c6b1796..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse6.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordElse6 {
- void foo() {
- #
- els
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse7.java
deleted file mode 100644
index a733074..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordElse7 {
- els
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse8.java
deleted file mode 100644
index f03a2b8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse8.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordElse8 {
- void foo() {
- #
- if(els
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends1.java
deleted file mode 100644
index 882aecd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordExtends1 ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends10.java
deleted file mode 100644
index 9d05f75..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public interface CompletionKeywordExtends10 extends SuperInterface ext{
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends2.java
deleted file mode 100644
index b9b133c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordExtends2 extends SuperClass ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends3.java
deleted file mode 100644
index ce90371..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordExtends3 implements SuperInterface ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends4.java
deleted file mode 100644
index e6c498c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public interface CompletionKeywordExtends4 ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends5.java
deleted file mode 100644
index e08980e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public interface CompletionKeywordExtends5 extends SuperInterface ext{
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends6.java
deleted file mode 100644
index 5ebd3a0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordExtends6 ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends7.java
deleted file mode 100644
index 0758cf4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordExtends7 extends SuperClass ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends8.java
deleted file mode 100644
index 93cfe47..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordExtends8 implements SuperInterface ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends9.java
deleted file mode 100644
index 94cdb6b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public interface CompletionKeywordExtends9 ext {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse1.java
deleted file mode 100644
index 0b94f70..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFalse1 {
- void foo() {
- fal
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse2.java
deleted file mode 100644
index 1eae452..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFalse2 {
- void foo() {
- if(fal
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse3.java
deleted file mode 100644
index 5a24347..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFalse3 {
- void foo() {
- #
- fal
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse4.java
deleted file mode 100644
index d8f449e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFalse4 {
- void foo() {
- #
- if(fal
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal1.java
deleted file mode 100644
index baf752b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal1.java
+++ /dev/null
@@ -1 +0,0 @@
-fin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal10.java
deleted file mode 100644
index adc7630..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal10.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-fin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal11.java
deleted file mode 100644
index 1c92322..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal11.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-abstract fin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal12.java
deleted file mode 100644
index ef49b72..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal12.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-fin class
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal13.java
deleted file mode 100644
index b7fd961..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal13.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public fin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal14.java
deleted file mode 100644
index 8c88924..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal14.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordFinal14 {
- fin
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal15.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal15.java
deleted file mode 100644
index ac3496a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal15.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordFinal15 {
- abstract fin
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal16.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal16.java
deleted file mode 100644
index 3745cd9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal16.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordFinal16 {
- fin class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal17.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal17.java
deleted file mode 100644
index 7631782..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal17.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordFinal17 {
- public fin
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal18.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal18.java
deleted file mode 100644
index 5c0b983..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal18.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFinal18 {
- void foo(){
- #
- fin
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal2.java
deleted file mode 100644
index d44bee0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal2.java
+++ /dev/null
@@ -1 +0,0 @@
-abstract fin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal3.java
deleted file mode 100644
index 33294e2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal3.java
+++ /dev/null
@@ -1 +0,0 @@
-fin class
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal4.java
deleted file mode 100644
index 7f62626..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal4.java
+++ /dev/null
@@ -1 +0,0 @@
-public fin
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal5.java
deleted file mode 100644
index f802f85..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordFinal5 {
- fin
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal6.java
deleted file mode 100644
index 4328670..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordFinal6 {
- abstract fin
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal7.java
deleted file mode 100644
index 0856d4c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordFinal7 {
- fin class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal8.java
deleted file mode 100644
index 41aebbc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal8.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordFinal8 {
- public fin
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal9.java
deleted file mode 100644
index 81abfb2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal9.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFinal9 {
- void foo(){
- fin
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally1.java
deleted file mode 100644
index 7eb94f4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally1.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordFinally1 {
- int finallyz;
- void foo() {
- try {
-
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally10.java
deleted file mode 100644
index f91f524..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordFinally10 {
- finall
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally11.java
deleted file mode 100644
index 7000091..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally11.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFinally11 {
- void foo() {
- #
- if(finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally12.java
deleted file mode 100644
index f26eca9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally12.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionKeywordFinally12 {
- void foo() {
- #
- try {
-
- } catch(E e){
-
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally13.java
deleted file mode 100644
index 179b5b1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally13.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionKeywordFinally13 {
- int finallyz;
- void foo() {
- #
- try {
-
- } catch(Exception e) {
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally14.java
deleted file mode 100644
index 8e81880..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally14.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class CompletionKeywordFinally14 {
- int finallyz;
- void foo() {
- #
- try {
-
- } finally {
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally2.java
deleted file mode 100644
index 669f260..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFinally2 {
- void foo() {
- finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally3.java
deleted file mode 100644
index a27d2f0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordFinally3 {
- finall
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally4.java
deleted file mode 100644
index b780825..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFinally4 {
- void foo() {
- if(finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally5.java
deleted file mode 100644
index 565bda2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally5.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordFinally5 {
- void foo() {
- try {
-
- } catch(E e){
-
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally6.java
deleted file mode 100644
index bce9372..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally6.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordFinally6 {
- int finallyz;
- void foo() {
- try {
-
- } catch(Exception e) {
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally7.java
deleted file mode 100644
index 1112fdf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally7.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordFinally7 {
- int finallyz;
- void foo() {
- try {
-
- } finally {
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally8.java
deleted file mode 100644
index e45ea80..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally8.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class CompletionKeywordFinally8 {
- int finallyz;
- void foo() {
- #
- try {
-
- } finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally9.java
deleted file mode 100644
index 789df13..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally9.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFinally9 {
- void foo() {
- #
- finall
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor1.java
deleted file mode 100644
index 9518483..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFor1 {
- void foo() {
- fo
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor2.java
deleted file mode 100644
index 02774f8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordFor2 {
- void foo() {
- if(fo
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor3.java
deleted file mode 100644
index 091b6f9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordFor3 {
- fo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor4.java
deleted file mode 100644
index 3008203..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFor4 {
- void foo() {
- #
- fo
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor5.java
deleted file mode 100644
index 4aada9f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordFor5 {
- void foo() {
- #
- if(fo
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor6.java
deleted file mode 100644
index 224437d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordFor6 {
- fo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf1.java
deleted file mode 100644
index 2ac64df..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordIf1 {
- void foo() {
- if
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf2.java
deleted file mode 100644
index dc63970..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordIf2 {
- void foo() {
- if(if
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf3.java
deleted file mode 100644
index 9934d16..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordIf3 {
- if
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf4.java
deleted file mode 100644
index dbb3bd3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordIf4 {
- void foo() {
- #
- if
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf5.java
deleted file mode 100644
index 134c17c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordIf5 {
- void foo() {
- #
- if(if
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf6.java
deleted file mode 100644
index 765f0b5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordIf6 {
- if
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements1.java
deleted file mode 100644
index d2aaef1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordImplements1 imp {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements2.java
deleted file mode 100644
index 7c5383d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordImplements2 extends SuperClass imp {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements3.java
deleted file mode 100644
index e605dfc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordImplements3 implements SuperInterface imp {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements4.java
deleted file mode 100644
index 9512f18..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements4.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordImplements4 imp {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements5.java
deleted file mode 100644
index eda2228..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordImplements5 extends SuperClass imp {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements6.java
deleted file mode 100644
index 290653e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordImplements6 implements SuperInterface imp {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport1.java
deleted file mode 100644
index 9f5cd1d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-imp
-
-public class CompletionKeywordImport1 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport3.java
deleted file mode 100644
index 91fa96e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import java.lang.Object;
-imp
-public class CompletionKeywordImport3 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport4.java
deleted file mode 100644
index ab0745b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport4.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordImport4 {
-
-}
-imp
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport5.java
deleted file mode 100644
index ac1da05..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import java.lang.Object;
-imp
-public class CompletionKeywordImport5 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport6.java
deleted file mode 100644
index f06134a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport6.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordImport6 {
-
-}
-imp
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport7.java
deleted file mode 100644
index 3ac498e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport7.java
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-imp
-
-package bbb;
-public class CompletionKeywordImport7 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof1.java
deleted file mode 100644
index df7c7f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordInstanceof1 {
- void foo() {
- if(zzz ins
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof2.java
deleted file mode 100644
index 239c47f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordInstanceof1 {
- void foo() {
- ins
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof3.java
deleted file mode 100644
index 4816692..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordInstanceof1 {
- void foo() {
- if(zzz zzz ins
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof4.java
deleted file mode 100644
index 244101a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordInstanceof4 {
- void foo() {
- #
- if(zzz ins
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof5.java
deleted file mode 100644
index d47e3d0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordInstanceof5 {
- void foo() {
- #
- ins
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof6.java
deleted file mode 100644
index 328880e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof6.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordInstanceof6 {
- void foo() {
- #
- if(zzz zzz ins
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface1.java
deleted file mode 100644
index 2195f20..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface1.java
+++ /dev/null
@@ -1 +0,0 @@
-interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface10.java
deleted file mode 100644
index c401877..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface10.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface11.java
deleted file mode 100644
index b08f40c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface11.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordInterface11 {
-}
-interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface12.java
deleted file mode 100644
index 5647383..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface12.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface13.java
deleted file mode 100644
index 3115174..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface13.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public abstract interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface14.java
deleted file mode 100644
index e2396ea..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface14.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public interf CompletionKeywordInterface14
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface15.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface15.java
deleted file mode 100644
index c1ad791..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface15.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordInterface15 {
- interf
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface16.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface16.java
deleted file mode 100644
index f8eb227..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface16.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordInterface16 {
- public interf
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface17.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface17.java
deleted file mode 100644
index 9158ae0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface17.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordInterface17 {
- public abstract interf
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface18.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface18.java
deleted file mode 100644
index f6948e4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface18.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordInterface18 {
- public interf X
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface2.java
deleted file mode 100644
index 0af9cf1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordInterface2 {
-}
-interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface3.java
deleted file mode 100644
index 786edf8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface3.java
+++ /dev/null
@@ -1 +0,0 @@
-public interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface4.java
deleted file mode 100644
index ceba81f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface4.java
+++ /dev/null
@@ -1 +0,0 @@
-public abstract interf
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface5.java
deleted file mode 100644
index 5586456..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface5.java
+++ /dev/null
@@ -1 +0,0 @@
-public interf CompletionKeywordInterface5
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface6.java
deleted file mode 100644
index d6b46e9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordInterface6 {
- interf
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface7.java
deleted file mode 100644
index 5dfcb60..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordInterface7 {
- public interf
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface8.java
deleted file mode 100644
index 89cb575..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface8.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordInterface8 {
- public abstract interf
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface9.java
deleted file mode 100644
index cbcf4a0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface9.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordInterface9 {
- public interf X
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative1.java
deleted file mode 100644
index 98350fd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordNative1 {
- nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative2.java
deleted file mode 100644
index 25996bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordNative2 {
- volatile nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative3.java
deleted file mode 100644
index dbbb221..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordNative3 {
- public nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative4.java
deleted file mode 100644
index 4c33b9d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordNative4 {
- abstract nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative5.java
deleted file mode 100644
index 09e4a4f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordNative5 {
- nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative6.java
deleted file mode 100644
index e2a4254..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordNative6 {
- volatile nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative7.java
deleted file mode 100644
index c54f87c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordNative7 {
- public nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative8.java
deleted file mode 100644
index 0e211a3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordNative8 {
- abstract nat
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew1.java
deleted file mode 100644
index 9339997..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordNew1 {
- void foo(){
- ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew10.java
deleted file mode 100644
index 5bd2346..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew10.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew10 {
- void foo(){
- #
- ne X
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew11.java
deleted file mode 100644
index 48aaf9b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew11.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew11 {
- void foo(){
- #
- ne X()
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew12.java
deleted file mode 100644
index 277a1cb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew12.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew12 {
- void foo(){
- #
- if(ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew13.java
deleted file mode 100644
index feaa8d4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew13.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordNew13 {
- public class X{}
- void foo(){
- #
- this.ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew14.java
deleted file mode 100644
index 2c48807..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew14.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordNew14 {
- public class X{}
- void foo(){
- #
- this.ne X
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew15.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew15.java
deleted file mode 100644
index 171de30..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew15.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordNew15 {
- public class X{}
- void foo(){
- #
- this.ne X()
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew16.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew16.java
deleted file mode 100644
index 39b819c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew16.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordNew16 {
- public class X{}
- void foo(){
- #
- if(this.ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew2.java
deleted file mode 100644
index 79556c0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordNew2 {
- void foo(){
- ne X
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew3.java
deleted file mode 100644
index b67aecd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordNew3 {
- void foo(){
- ne X()
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew4.java
deleted file mode 100644
index 0c57717..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordNew4 {
- void foo(){
- if(ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew5.java
deleted file mode 100644
index 1afa478..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew5 {
- public class X{}
- void foo(){
- this.ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew6.java
deleted file mode 100644
index 80a097b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew6.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew6 {
- public class X{}
- void foo(){
- this.ne X
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew7.java
deleted file mode 100644
index 5232168..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew7.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew7 {
- public class X{}
- void foo(){
- this.ne X()
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew8.java
deleted file mode 100644
index c8d953f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew8.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew8 {
- public class X{}
- void foo(){
- if(this.ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew9.java
deleted file mode 100644
index 7600f2b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew9.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNew9 {
- void foo(){
- #
- ne
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull1.java
deleted file mode 100644
index 5cfde48..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordNull1 {
- void foo() {
- nul
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull2.java
deleted file mode 100644
index e97982b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordNull2 {
- void foo() {
- if(nul
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull3.java
deleted file mode 100644
index 4e8dbde..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNull2 {
- void foo() {
- #
- nul
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull4.java
deleted file mode 100644
index 3154459..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordNull4 {
- void foo() {
- #
- if(nul
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage1.java
deleted file mode 100644
index b4666ba..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-pac
-
-public class CompletionKeywordPackage1 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage3.java
deleted file mode 100644
index 2775a0f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-import java.lang.Object;
-pac
-
-public class CompletionKeywordPackage3 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage4.java
deleted file mode 100644
index 53d737e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage4.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordPackage4 {
-
-}
-pac
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage5.java
deleted file mode 100644
index 43a928d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage5.java
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-import java.lang.Object;
-pac
-
-public class CompletionKeywordPackage5 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage6.java
deleted file mode 100644
index 4b86ed2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage6.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordPackage6 {
-
-}
-pac
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage7.java
deleted file mode 100644
index 29d13c2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage7.java
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-pac
-
-package bbb;
-public class CompletionKeywordPackage7 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate1.java
deleted file mode 100644
index e80a3db..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPrivate1 {
- pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate10.java
deleted file mode 100644
index 210b21c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPrivate10 {
- public pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate2.java
deleted file mode 100644
index aa86929..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPrivate2 {
- pri class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate3.java
deleted file mode 100644
index 8344779..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPrivate3{
- final pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate4.java
deleted file mode 100644
index 0051dec..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPrivate4 {
- private pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate5.java
deleted file mode 100644
index f40c582..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPrivate5 {
- public pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate6.java
deleted file mode 100644
index 3aa816c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPrivate6 {
- pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate7.java
deleted file mode 100644
index 91e3ae2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPrivate7 {
- pri class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate8.java
deleted file mode 100644
index 67732fc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPrivate8{
- final pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate9.java
deleted file mode 100644
index 377c700..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPrivate9 {
- private pri
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected1.java
deleted file mode 100644
index 2a30b0f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordProtected1 {
- pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected10.java
deleted file mode 100644
index 15e4478..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordProtected10 {
- public pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected2.java
deleted file mode 100644
index a44a5e5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordProtected2 {
- pro class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected3.java
deleted file mode 100644
index e7f8d19..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordProtected3{
- final pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected4.java
deleted file mode 100644
index c0f41b7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordProtected4 {
- protected pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected5.java
deleted file mode 100644
index 465e5db..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordProtected5 {
- public pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected6.java
deleted file mode 100644
index 042d55f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordProtected6 {
- pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected7.java
deleted file mode 100644
index 0d0ac8b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordProtected7 {
- pro class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected8.java
deleted file mode 100644
index d83c65d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordProtected8{
- final pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected9.java
deleted file mode 100644
index c162ca8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordProtected9 {
- protected pro
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic1.java
deleted file mode 100644
index 8b6b7b2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic1.java
+++ /dev/null
@@ -1 +0,0 @@
-pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic10.java
deleted file mode 100644
index 307fd63..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic10.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPublic10 {
- private pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic11.java
deleted file mode 100644
index 954f5cf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic11.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic12.java
deleted file mode 100644
index 1b6a609..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic12.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPublic12 {
- private pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic13.java
deleted file mode 100644
index de50e0d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic13.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-pub class CompletionKeywordPublic13 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic14.java
deleted file mode 100644
index 88996bb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic14.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-final pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic15.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic15.java
deleted file mode 100644
index 0091067..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic15.java
+++ /dev/null
@@ -1,2 +0,0 @@
-#
-public pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic16.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic16.java
deleted file mode 100644
index d1a6e06..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic16.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordPublic16 {
-
-}
-pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic17.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic17.java
deleted file mode 100644
index 8351ac9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic17.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPublic17 {
- pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic18.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic18.java
deleted file mode 100644
index ef27236..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic18.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPublic18 {
- pub class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic19.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic19.java
deleted file mode 100644
index 47954ad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic19.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPublic19 {
- final pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic2.java
deleted file mode 100644
index 51fc957..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-pub class CompletionKeywordPublic2 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic20.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic20.java
deleted file mode 100644
index 057250e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic20.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordPublic20 {
- public pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic3.java
deleted file mode 100644
index 92836e9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic3.java
+++ /dev/null
@@ -1 +0,0 @@
-final pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic4.java
deleted file mode 100644
index 11633a7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic4.java
+++ /dev/null
@@ -1 +0,0 @@
-public pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic5.java
deleted file mode 100644
index eaaa2fd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordPublic5 {
-
-}
-pub
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic6.java
deleted file mode 100644
index d69f268..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPublic6 {
- pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic7.java
deleted file mode 100644
index 1354a19..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPublic7 {
- pub class
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic8.java
deleted file mode 100644
index c1b4c94..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic8.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPublic8 {
- final pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic9.java
deleted file mode 100644
index ccb6c19..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic9.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordPublic9 {
- public pub
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn1.java
deleted file mode 100644
index 48844c1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordReturn1 {
- void foo() {
- re
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn2.java
deleted file mode 100644
index 3acaed8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordReturn2 {
- void foo() {
- if(re
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn3.java
deleted file mode 100644
index 9288492..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordReturn3 {
- re
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn4.java
deleted file mode 100644
index 4aacefe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordReturn4 {
- void foo() {
- #
- re
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn5.java
deleted file mode 100644
index f374aad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordReturn5 {
- void foo() {
- #
- if(re
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn6.java
deleted file mode 100644
index c97665e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordReturn6 {
- re
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic1.java
deleted file mode 100644
index 5cacce7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStatic1 {
- sta
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic10.java
deleted file mode 100644
index bd46887..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStatic10 {
- public sta foo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic2.java
deleted file mode 100644
index f09a6dc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStatic2 {
- public sta
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic3.java
deleted file mode 100644
index 1f0cd31..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStatic3 {
- sta foo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic4.java
deleted file mode 100644
index e4afb43..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStatic4 {
- abstract sta
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic5.java
deleted file mode 100644
index 4cce86c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStatic5 {
- public sta foo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic6.java
deleted file mode 100644
index e65a496..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStatic6 {
- sta
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic7.java
deleted file mode 100644
index 75850e4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStatic7 {
- public sta
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic8.java
deleted file mode 100644
index 038f5dd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStatic8 {
- sta foo
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic9.java
deleted file mode 100644
index 9c33f28..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStatic9 {
- abstract sta
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp1.java
deleted file mode 100644
index a35135d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStrictfp1 {
- stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp2.java
deleted file mode 100644
index a476dab..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStrictfp2 {
- volatile stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp3.java
deleted file mode 100644
index b8017ec..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStrictfp3 {
- public stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp4.java
deleted file mode 100644
index 39c77a3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordStrictfp4 {
- abstract stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp5.java
deleted file mode 100644
index 9db9622..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStrictfp5 {
- stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp6.java
deleted file mode 100644
index a13e50f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStrictfp6 {
- volatile stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp7.java
deleted file mode 100644
index 4a00693..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStrictfp7 {
- public stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp8.java
deleted file mode 100644
index 4d0e717..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordStrictfp8 {
- abstract stric
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper1.java
deleted file mode 100644
index ea15e65..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSuper1 {
- void foo() {
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper10.java
deleted file mode 100644
index faa1caf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper10.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSuper10 {
- {
- #
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper11.java
deleted file mode 100644
index 051ba72..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper11.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSuper11 {
- static void foo() {
- #
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper12.java
deleted file mode 100644
index 03aa2b9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper12.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSuper12 {
- public CompletionKeywordSuper12() {
- #
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper2.java
deleted file mode 100644
index 70de610..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSuper2 {
- void foo() {
- if(sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper3.java
deleted file mode 100644
index c829466..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordSuper3 {
- sup
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper4.java
deleted file mode 100644
index 0784c7e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSuper4 {
- {
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper5.java
deleted file mode 100644
index 1475f0c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSuper5 {
- static void foo() {
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper6.java
deleted file mode 100644
index f6573da..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper6.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSuper6 {
- public CompletionKeywordSuper6() {
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper7.java
deleted file mode 100644
index 0490a11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper7.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSuper7 {
- void foo() {
- #
- sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper8.java
deleted file mode 100644
index f6363dc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper8.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSuper8 {
- void foo() {
- #
- if(sup
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper9.java
deleted file mode 100644
index 57df9b7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordSuper9 {
- sup
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch1.java
deleted file mode 100644
index a177f42..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSwitch1 {
- void foo() {
- sw
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch2.java
deleted file mode 100644
index 9a6f032..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSwitch2 {
- void foo() {
- if(sw
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch3.java
deleted file mode 100644
index c5384b7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordSwitch3 {
- sw
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch4.java
deleted file mode 100644
index c451789..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSwitch4 {
- void foo() {
- #
- sw
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch5.java
deleted file mode 100644
index 94b7593..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSwitch5 {
- void foo() {
- #
- if(sw
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch6.java
deleted file mode 100644
index 9e2e88e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordSwitch6 {
- sw
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized1.java
deleted file mode 100644
index aba0852..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordSynchronized1 {
- syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized10.java
deleted file mode 100644
index 7b58683..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordSynchronized10 {
- abstract syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized11.java
deleted file mode 100644
index b59cd24..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized11.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSynchronized11 {
- void foo() {
- #
- syn
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized12.java
deleted file mode 100644
index 3d149dc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized12.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordSynchronized12 {
- void foo() {
- #
- if(syn
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized2.java
deleted file mode 100644
index 1034f14..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordSynchronized2 {
- volatile syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized3.java
deleted file mode 100644
index 385cb08..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordSynchronized3 {
- public syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized4.java
deleted file mode 100644
index ceba428..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordSynchronized4 {
- abstract syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized5.java
deleted file mode 100644
index b6caecb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSynchronized5 {
- void foo() {
- syn
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized6.java
deleted file mode 100644
index d0ad5df..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized6.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordSynchronized6 {
- void foo() {
- if(syn
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized7.java
deleted file mode 100644
index 9803ae7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordSynchronized7 {
- syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized8.java
deleted file mode 100644
index 7997f2f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordSynchronized8 {
- volatile syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized9.java
deleted file mode 100644
index 7cc7b2b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized9.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordSynchronized9 {
- public syn
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis1.java
deleted file mode 100644
index 8c4a672..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThis1 {
- void foo() {
- thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis10.java
deleted file mode 100644
index 5577948..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis10.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordThis10 {
- thi
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis11.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis11.java
deleted file mode 100644
index b1b3a47..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis11.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThis11 {
- {
- #
- thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis12.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis12.java
deleted file mode 100644
index 7290416..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis12.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThis12 {
- static void foo() {
- #
- thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis13.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis13.java
deleted file mode 100644
index 3711250..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis13.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThis13 {
- void foo() {
- #
- CompletionKeywordThis13.thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis14.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis14.java
deleted file mode 100644
index 8bf2ac5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis14.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThis14 {
- static void foo() {
- #
- CompletionKeywordThis14.thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis2.java
deleted file mode 100644
index b12fbc6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThis2 {
- void foo() {
- if(thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis3.java
deleted file mode 100644
index 01dc7b0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordThis3 {
- thi
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis4.java
deleted file mode 100644
index 3570c1c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThis4 {
- {
- thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis5.java
deleted file mode 100644
index 843f489..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThis5 {
- static void foo() {
- thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis6.java
deleted file mode 100644
index 68c53be..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis6.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThis6 {
- void foo() {
- CompletionKeywordThis6.thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis7.java
deleted file mode 100644
index 875dc20..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis7.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThis7 {
- static void foo() {
- CompletionKeywordThis7.thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis8.java
deleted file mode 100644
index 8443de2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis8.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThis8 {
- void foo() {
- #
- thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis9.java
deleted file mode 100644
index e044787..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis9.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThis9 {
- void foo() {
- #
- if(thi
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow1.java
deleted file mode 100644
index d26f55b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThrow1 {
- void foo() {
- thr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow2.java
deleted file mode 100644
index ca5278d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordThrow2 {
- void foo() {
- if(thr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow3.java
deleted file mode 100644
index ace9d39..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordThrow3 {
- thr
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow4.java
deleted file mode 100644
index 91641a1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThrow4 {
- void foo() {
- #
- thr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow5.java
deleted file mode 100644
index 65a9203..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordThrow5 {
- void foo() {
- #
- if(thr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow6.java
deleted file mode 100644
index 28ad9f4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordThrow6 {
- thr
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows1.java
deleted file mode 100644
index 24f4f0b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordThrows1 {
- void foo() thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows2.java
deleted file mode 100644
index 1bb0d89..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordThrows2 {
- void foo() throw Exception thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows3.java
deleted file mode 100644
index e43a05d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows3.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordThrows3 {
- int foo()[] thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows4.java
deleted file mode 100644
index 4582344..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows4.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class CompletionKeywordThrows4 {
- public CompletionKeywordThrows4() thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows5.java
deleted file mode 100644
index 9b1d101..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordThrows5 {
- void foo() thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows6.java
deleted file mode 100644
index 3bcc7db..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows6.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordThrows6 {
- void foo() throw Exception thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows7.java
deleted file mode 100644
index 381e453..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows7.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordThrows7 {
- int foo()[] thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows8.java
deleted file mode 100644
index 9f261d6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows8.java
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-public class CompletionKeywordThrows8 {
- public CompletionKeywordThrows8() thro {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient1.java
deleted file mode 100644
index 32b83ea..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordTransient1 {
- tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient2.java
deleted file mode 100644
index 95718c5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordTransient2 {
- native tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient3.java
deleted file mode 100644
index 7c3b86c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordTransient3 {
- public tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient4.java
deleted file mode 100644
index 72bbc0e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordTransient4 {
- abstract tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient5.java
deleted file mode 100644
index 8eae6e7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordTransient5 {
- tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient6.java
deleted file mode 100644
index 211c865..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordTransient6 {
- native tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient7.java
deleted file mode 100644
index 5d6ef83..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordTransient7 {
- public tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient8.java
deleted file mode 100644
index 51e376e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordTransient8 {
- abstract tran
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue1.java
deleted file mode 100644
index 10a05ec..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordTrue1 {
- void foo() {
- tru
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue2.java
deleted file mode 100644
index 19dbfdb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordTrue2 {
- void foo() {
- if(tru
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue3.java
deleted file mode 100644
index 7597ba2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordTrue3 {
- void foo() {
- #
- tru
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue4.java
deleted file mode 100644
index e594645..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordTrue4 {
- void foo() {
- #
- if(tru
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry1.java
deleted file mode 100644
index 309f9e2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordTry1 {
- void foo() {
- tr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry2.java
deleted file mode 100644
index e651351..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordTry2 {
- void foo() {
- if(tr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry3.java
deleted file mode 100644
index 417b2c4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordTry3 {
- try
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry4.java
deleted file mode 100644
index e88a4b5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordTry4 {
- void foo() {
- #
- tr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry5.java
deleted file mode 100644
index a65c42f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordTry5 {
- void foo() {
- #
- if(tr
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry6.java
deleted file mode 100644
index d2558e4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordTry6 {
- try
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile1.java
deleted file mode 100644
index 4f905e7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordVolatile1 {
- vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile2.java
deleted file mode 100644
index 61e3db1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordVolatile2 {
- native vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile3.java
deleted file mode 100644
index 1c05b37..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordVolatile3 {
- public vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile4.java
deleted file mode 100644
index 735c1cb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordVolatile4 {
- abstract vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile5.java
deleted file mode 100644
index 7b44483..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordVolatile5 {
- vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile6.java
deleted file mode 100644
index def2379..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordVolatile6 {
- native vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile7.java
deleted file mode 100644
index 14ff9fc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile7.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordVolatile7 {
- public vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile8.java
deleted file mode 100644
index cabfd25..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordVolatile8 {
- abstract vol
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile1.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile1.java
deleted file mode 100644
index 4e1f95c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordWhile1 {
- void foo() {
- wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile10.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile10.java
deleted file mode 100644
index 95b39da..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile10.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class CompletionKeywordWhile10 {
- int whilez;
- void foo(){
- #
- do {
- } wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile2.java
deleted file mode 100644
index 7c7cd10..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class CompletionKeywordWhile2 {
- void foo() {
- if(wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile3.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile3.java
deleted file mode 100644
index 5b0d0c1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class CompletionKeywordWhile3 {
- wh
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile4.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile4.java
deleted file mode 100644
index 4c322ed..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile4.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordWhile4 {
- void foo(){
- do {
- } wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile5.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile5.java
deleted file mode 100644
index 8ebd8ea..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile5.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordWhile5 {
- int whilez;
- void foo(){
- do {
- } wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile6.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile6.java
deleted file mode 100644
index 64584e0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile6.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordWhile6 {
- void foo() {
- #
- wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile7.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile7.java
deleted file mode 100644
index f748c4b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile7.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class CompletionKeywordWhile7 {
- void foo() {
- #
- if(wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile8.java
deleted file mode 100644
index a030f56..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-public class CompletionKeywordWhile8 {
- wh
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile9.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile9.java
deleted file mode 100644
index 3b15277..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile9.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class CompletionKeywordWhile9 {
- void foo(){
- #
- do {
- } wh
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport2.java
deleted file mode 100644
index b0aa24b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package p;
-imp
-
-public class CompletionKeywordImport2 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport8.java
deleted file mode 100644
index 5fffb18..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport8.java
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-package p;
-imp
-
-public class CompletionKeywordImport8 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage2.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage2.java
deleted file mode 100644
index 0f4736d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p;
-pac
-public class CompletionKeywordPackage2 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage8.java b/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage8.java
deleted file mode 100644
index de8d898..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage8.java
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-package p;
-pac
-public class CompletionKeywordPackage8 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/zzz.jar b/org.eclipse.jdt.core.tests.model/workspace/Completion/zzz.jar
deleted file mode 100644
index 3aca5b1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/zzz.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Completion/zzzsrc.zip b/org.eclipse.jdt.core.tests.model/workspace/Completion/zzzsrc.zip
deleted file mode 100644
index fa08ccb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Completion/zzzsrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Converter/.classpath
deleted file mode 100644
index 553236c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="var" path="CONVERTER_JCL_LIB" sourcepath="CONVERTER_JCL_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
- <classpathentry kind="output" path=""/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/.project b/org.eclipse.jdt.core.tests.model/workspace/Converter/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/Hello.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/Hello.java
deleted file mode 100644
index 2a1ad07..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/Hello.java
+++ /dev/null
@@ -1,23 +0,0 @@
-void ___eval() {
- new Runnable() {
- void ___run() throws Throwable {
- return blah;
- }
- private String blarg;
- public void run() {
- }
- };
-}
-public class Hello {
- private static int x;
- private String blah;
- public static void main(String[] args) {
- }
- public void hello() {
- }
- public boolean blah() {
- return false;
- }
- public void foo() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/NO_WORKING.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/NO_WORKING.java
deleted file mode 100644
index 52516af..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/NO_WORKING.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class NO_WORKING {
-
- public void method() { }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0157.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0157.java
deleted file mode 100644
index cb5a1d2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0157.java
+++ /dev/null
@@ -1,6 +0,0 @@
-import java.util.*;
-class Test0157 {
- int[] tab;
- String[] t;
- Test0157[] t2;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0158.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0158.java
deleted file mode 100644
index 8e72131..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0158.java
+++ /dev/null
@@ -1,4 +0,0 @@
-import java.util.*;
-class Test0158 {
- Test0158[] t2;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0170.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0170.java
deleted file mode 100644
index 3101283..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test0170.java
+++ /dev/null
@@ -1,3 +0,0 @@
-import java.util.*;
-class Test0170 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test462.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/Test462.java
deleted file mode 100644
index f7ba132..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/Test462.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public interface Test462 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/codeManipulation/bug.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/codeManipulation/bug.java
deleted file mode 100644
index b2c651f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/codeManipulation/bug.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package codeManipulation;
-
-public class bug {
- static private int dummyFct3() {
- return 3;
- }
- static private int dummyFct2() {
- return 3;
- }
- static private void pipo () {
- int z = bug.dummyFct3(),y=bug.dummyFct2();
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/examples.oneofeach/ASTPosterChild.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/examples.oneofeach/ASTPosterChild.java
deleted file mode 100644
index ad55aa8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/examples.oneofeach/ASTPosterChild.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial implementation
- ******************************************************************************/
-/*
- * Syntactically correct Java program containing at least an instance of
- * each different kind of construct in the Java language (1.4).
- */
-// PackageDeclaration
-package examples.oneofeach;
-
-// ImportDeclaration (single-type)
-import java.io.Serializable;
-// ImportDeclaration (on-demand)
-import java.util.*;
-
-/**
- * TypeDeclaration (class)
- */
-public final class ASTPosterChild extends java.lang.Object
- implements Serializable, ASTPosterInterface {
-
- /**
- * FieldDeclaration
- */
- public transient boolean[] f1 = {true, false};
-
- // Initializer
- {
- f1 = null;
- }
-
- /**
- * MethodDeclaration (constructor)
- */
- ASTPosterChild() {
- // ConstructorInvocation
- this(true);
- }
-
- /**
- * MethodDeclaration (constructor)
- */
- ASTPosterChild(boolean flag) {
- // SuperConstructorInvocation
- super();
- }
-
- /**
- * MethodDeclaration (method)
- */
- public void op() {
-
- // PrimitiveType, NumberLiteral
- byte a = 0;
- // BooleanLiteral
- boolean b = true;
- // CharacterLiteral
- char c = 'x';
- short s = 1;
- long l = 1L;
- float f = 1.0f;
- double d = 1e6;
- // SimpleType, StringLiteral
- String z = "hello";//$NON-NLS-1$
- // NullLiteral
- Vector o1 = null;
- // ArrayType, ArrayInitializer
- int[] t1 = {1};
- int[][] t2 = {{1,2}, {3,4}};
- int[][][] t3 = null;
- // ClassInstanceCreation
- java.lang.Object o = new Object();
- // ArrayCreation (initializer)
- Object[] o2 = new Object[]{"0", "1"};//$NON-NLS-1$//$NON-NLS-2$
- // ArrayCreation (dimensions)
- Object[][] o3 = new Object[3][];
- // Assigment
- o3 = null;
- // ArrayAccess
- Object x1 = o3[0];
- // CastExpression
- Object x2 = (Object) o3;
- // ConditionalExpression
- int x3 = b ? 1 : 2;
- // FieldAccess
- Object x4 = System.out;
- // InfixExpression
- String x5 = "a" + "b";//$NON-NLS-1$//$NON-NLS-2$
- // InfixExpression (extended operands)
- String x6 = "a" + "b" + "c" + "d";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- // MethodInvocation
- notifyAll();
- // ParenthesizedExpression
- Object x7 = ((o));
- // PostfixExpression
- l++;
- // PrefixExpression
- --l;
- // ThisExpression
- Object x8 = ASTPosterChild.this;
- // TypeLiteral
- Object x9 = void.class;
-
- // AssertStatement
- // assert true: "unhappy";//$NON-NLS-1$
- // Block
- {}
- // DoStatement
- do {
- } while (false);
- // VariableDeclarationStatement
- int i;
- // ExpressionStatement
- i = 1;
- // LabeledStatement
- looping:
- // ForStatement, VariableDeclarationExpression
- for (int j=0; j<10; j++) {
- // ContinueStatement
- continue looping;
- }
- // IfStatement
- if (false)
- System.exit(0);
- else
- i++;
- // SwitchStatement
- switch (2) {
- // SwitchCase
- case 2:
- // BreakStatement
- break;
- default:
- // EmptyStatement
- ;
- }
- // SynchronizedStatement
- synchronized (this) {
- }
- // TryStatement
- try {
- // ThrowStatement
- throw new RuntimeException();
- } catch (Exception e) // CatchClause
- {
- } finally {
- }
-
- // TypeDeclarationStatement
- abstract class X {
- int f;
- void m() {
- }
- }
- // ClassInstanceCreation (with body declarations)
- Object anon = new X() {
- void m() {
- // SuperMethodInvocation
- super.m();
- // SuperFieldAccess
- super.f = 1;
- }
- };
- // WhileStatement
- boolean b1 = true;
- while (b1);
- // ReturnStatement;
- return;
- }
-
-}
-
-/**
- * TypeDeclaration (interface)
- */
-interface ASTPosterInterface {
-
- String FOO = "hi";//$NON-NLS-1$
- void op();
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/AboutDialog.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/AboutDialog.java
deleted file mode 100644
index 79e4410..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/AboutDialog.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package junit.awtui;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import junit.runner.Version;
-
-class AboutDialog extends Dialog {
- public AboutDialog(Frame parent) {
- super(parent);
-
- setResizable(false);
- setLayout(new GridBagLayout());
- setSize(330, 138);
- setTitle("About");
-
- Button button= new Button("Close");
- button.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- dispose();
- }
- }
- );
-
- Label label1= new Label("JUnit");
- label1.setFont(new Font("dialog", Font.PLAIN, 36));
-
- Label label2= new Label("JUnit "+Version.id()+ " by Kent Beck and Erich Gamma");
- label2.setFont(new Font("dialog", Font.PLAIN, 14));
-
- Logo logo= new Logo();
-
- GridBagConstraints constraintsLabel1= new GridBagConstraints();
- constraintsLabel1.gridx = 3; constraintsLabel1.gridy = 0;
- constraintsLabel1.gridwidth = 1; constraintsLabel1.gridheight = 1;
- constraintsLabel1.anchor = GridBagConstraints.CENTER;
- add(label1, constraintsLabel1);
-
- GridBagConstraints constraintsLabel2= new GridBagConstraints();
- constraintsLabel2.gridx = 2; constraintsLabel2.gridy = 1;
- constraintsLabel2.gridwidth = 2; constraintsLabel2.gridheight = 1;
- constraintsLabel2.anchor = GridBagConstraints.CENTER;
- add(label2, constraintsLabel2);
-
- GridBagConstraints constraintsButton1= new GridBagConstraints();
- constraintsButton1.gridx = 2; constraintsButton1.gridy = 2;
- constraintsButton1.gridwidth = 2; constraintsButton1.gridheight = 1;
- constraintsButton1.anchor = GridBagConstraints.CENTER;
- constraintsButton1.insets= new Insets(8, 0, 8, 0);
- add(button, constraintsButton1);
-
- GridBagConstraints constraintsLogo1= new GridBagConstraints();
- constraintsLogo1.gridx = 2; constraintsLogo1.gridy = 0;
- constraintsLogo1.gridwidth = 1; constraintsLogo1.gridheight = 1;
- constraintsLogo1.anchor = GridBagConstraints.CENTER;
- add(logo, constraintsLogo1);
-
- addWindowListener(
- new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- dispose();
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/Logo.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/Logo.java
deleted file mode 100644
index a5cafc8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/Logo.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package junit.awtui;
-
-import java.awt.*;
-import java.awt.image.*;
-import java.net.URL;
-
-import junit.runner.BaseTestRunner;
-
-public class Logo extends Canvas {
- private Image fImage;
- private int fWidth;
- private int fHeight;
-
- public Logo() {
- fImage= loadImage("logo.gif");
- MediaTracker tracker= new MediaTracker(this);
- tracker.addImage(fImage, 0);
- try {
- tracker.waitForAll();
- } catch (Exception e) {
- }
-
- if (fImage != null) {
- fWidth= fImage.getWidth(this);
- fHeight= fImage.getHeight(this);
- } else {
- fWidth= 20;
- fHeight= 20;
- }
- setSize(fWidth, fHeight);
- }
-
- public Image loadImage(String name) {
- Toolkit toolkit= Toolkit.getDefaultToolkit();
- try {
- URL url= BaseTestRunner.class.getResource(name);
- return toolkit.createImage((ImageProducer) url.getContent());
- } catch (Exception ex) {
- }
- return null;
- }
-
- public void paint(Graphics g) {
- paintBackground(g);
- if (fImage != null)
- g.drawImage(fImage, 0, 0, fWidth, fHeight, this);
- }
-
- public void paintBackground( java.awt.Graphics g) {
- g.setColor(SystemColor.control);
- g.fillRect(0, 0, getBounds().width, getBounds().height);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/ProgressBar.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/ProgressBar.java
deleted file mode 100644
index 5374298..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/ProgressBar.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package junit.awtui;
-
-import java.awt.*;
-
-public class ProgressBar extends Canvas {
- public boolean fError= false;
- public int fTotal= 0;
- public int fProgress= 0;
- public int fProgressX= 0;
-
- public ProgressBar() {
- super();
- setSize(20, 30);
- }
-
- private Color getStatusColor() {
- if (fError)
- return Color.red;
- return Color.green;
- }
-
- public void paint(Graphics g) {
- paintBackground(g);
- paintStatus(g);
- }
-
- public void paintBackground(Graphics g) {
- g.setColor(SystemColor.control);
- Rectangle r= getBounds();
- g.fillRect(0, 0, r.width, r.height);
- g.setColor(Color.darkGray);
- g.drawLine(0, 0, r.width-1, 0);
- g.drawLine(0, 0, 0, r.height-1);
- g.setColor(Color.white);
- g.drawLine(r.width-1, 0, r.width-1, r.height-1);
- g.drawLine(0, r.height-1, r.width-1, r.height-1);
- }
-
- public void paintStatus(Graphics g) {
- g.setColor(getStatusColor());
- Rectangle r= new Rectangle(0, 0, fProgressX, getBounds().height);
- g.fillRect(1, 1, r.width-1, r.height-2);
- }
-
- private void paintStep(int startX, int endX) {
- repaint(startX, 1, endX-startX, getBounds().height-2);
- }
-
- public void reset() {
- fProgressX= 1;
- fProgress= 0;
- fError= false;
- paint(getGraphics());
- }
-
- public int scale(int value) {
- if (fTotal > 0)
- return Math.max(1, value*(getBounds().width-1)/fTotal);
- return value;
- }
-
- public void setBounds(int x, int y, int w, int h) {
- super.setBounds(x, y, w, h);
- fProgressX= scale(fProgress);
- }
-
- public void start(int total) {
- fTotal= total;
- reset();
- }
-
- public void step(boolean successful) {
- fProgress++;
- int x= fProgressX;
-
- fProgressX= scale(fProgress);
-
- if (!fError && !successful) {
- fError= true;
- x= 1;
- }
- paintStep(x, fProgressX);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/TestRunner.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/TestRunner.java
deleted file mode 100644
index d1b9499..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/awtui/TestRunner.java
+++ /dev/null
@@ -1,481 +0,0 @@
-package junit.awtui;
-
-import junit.framework.*;
-import junit.runner.*;
-
-import java.util.Vector;
-import java.lang.reflect.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import java.io.*;
-
-/**
- * An AWT based user interface to run tests.
- * Enter the name of a class which either provides a static
- * suite method or is a subclass of TestCase.
- * <pre>
- * Synopsis: java junit.awtui.TestRunner [-noloading] [TestCase]
- * </pre>
- * TestRunner takes as an optional argument the name of the testcase class to be run.
- */
- public class TestRunner extends BaseTestRunner {
- protected Frame fFrame;
- protected Vector fExceptions;
- protected Vector fFailedTests;
- protected Thread fRunner;
- protected TestResult fTestResult;
-
- protected TextArea fTraceArea;
- protected TextField fSuiteField;
- protected Button fRun;
- protected ProgressBar fProgressIndicator;
- protected List fFailureList;
- protected Logo fLogo;
- protected Label fNumberOfErrors;
- protected Label fNumberOfFailures;
- protected Label fNumberOfRuns;
- protected Button fQuitButton;
- protected Button fRerunButton;
- protected TextField fStatusLine;
- protected Checkbox fUseLoadingRunner;
-
- protected static Font PLAIN_FONT= new Font("dialog", Font.PLAIN, 12);
- private static final int GAP= 4;
- private static final String SUITE_METHODNAME= "suite";
-
- public TestRunner() {
- }
-
- private void about() {
- AboutDialog about= new AboutDialog(fFrame);
- about.setModal(true);
- about.setLocation(300, 300);
- about.setVisible(true);
- }
-
- public void addError(Test test, Throwable t) {
- fNumberOfErrors.setText(Integer.toString(fTestResult.errorCount()));
- appendFailure("Error", test, t);
- }
-
- public void addFailure(Test test, AssertionFailedError t) {
- fNumberOfFailures.setText(Integer.toString(fTestResult.failureCount()));
- appendFailure("Failure", test, t);
- }
-
- protected void addGrid(Panel p, Component co, int x, int y, int w, int fill, double wx, int anchor) {
- GridBagConstraints c= new GridBagConstraints();
- c.gridx= x; c.gridy= y;
- c.gridwidth= w;
- c.anchor= anchor;
- c.weightx= wx;
- c.fill= fill;
- if (fill == GridBagConstraints.BOTH || fill == GridBagConstraints.VERTICAL)
- c.weighty= 1.0;
- c.insets= new Insets(y == 0 ? GAP : 0, x == 0 ? GAP : 0, GAP, GAP);
- p.add(co, c);
- }
-
- private void appendFailure(String kind, Test test, Throwable t) {
- kind+= ": " + test;
- String msg= t.getMessage();
- if (msg != null) {
- kind+= ":" + truncate(msg);
- }
- fFailureList.add(kind);
- fExceptions.addElement(t);
- fFailedTests.addElement(test);
- if (fFailureList.getItemCount() == 1) {
- fFailureList.select(0);
- failureSelected();
- }
- }
- /**
- * Creates the JUnit menu. Clients override this
- * method to add additional menu items.
- */
- protected Menu createJUnitMenu() {
- Menu menu= new Menu("JUnit");
- MenuItem mi= new MenuItem("About...");
- mi.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- about();
- }
- }
- );
- menu.add(mi);
-
- menu.addSeparator();
- mi= new MenuItem("Exit");
- mi.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- System.exit(0);
- }
- }
- );
- menu.add(mi);
- return menu;
- }
-
- protected void createMenus(MenuBar mb) {
- mb.add(createJUnitMenu());
- }
- protected TestResult createTestResult() {
- return new TestResult();
- }
-
- protected Frame createUI(String suiteName) {
- Frame frame= new Frame("JUnit");
- Image icon= loadFrameIcon();
- if (icon != null)
- frame.setIconImage(icon);
-
- frame.setLayout(new BorderLayout(0, 0));
- frame.setBackground(SystemColor.control);
- final Frame finalFrame= frame;
-
- frame.addWindowListener(
- new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- finalFrame.dispose();
- System.exit(0);
- }
- }
- );
-
- MenuBar mb = new MenuBar();
- createMenus(mb);
- frame.setMenuBar(mb);
-
- //---- first section
- Label suiteLabel= new Label("Test class name:");
-
- fSuiteField= new TextField(suiteName != null ? suiteName : "");
- fSuiteField.selectAll();
- fSuiteField.requestFocus();
- fSuiteField.setFont(PLAIN_FONT);
- fSuiteField.setColumns(40);
- fSuiteField.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- runSuite();
- }
- }
- );
- fSuiteField.addTextListener(
- new TextListener() {
- public void textValueChanged(TextEvent e) {
- fRun.setEnabled(fSuiteField.getText().length() > 0);
- fStatusLine.setText("");
- }
- }
- );
- fRun= new Button("Run");
- fRun.setEnabled(false);
- fRun.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- runSuite();
- }
- }
- );
- boolean useLoader= useReloadingTestSuiteLoader();
- fUseLoadingRunner= new Checkbox("Reload classes every run", useLoader);
- if (inVAJava())
- fUseLoadingRunner.setVisible(false);
-
- //---- second section
- fProgressIndicator= new ProgressBar();
-
- //---- third section
- fNumberOfErrors= new Label("0000", Label.RIGHT);
- fNumberOfErrors.setText("0");
- fNumberOfErrors.setFont(PLAIN_FONT);
-
- fNumberOfFailures= new Label("0000", Label.RIGHT);
- fNumberOfFailures.setText("0");
- fNumberOfFailures.setFont(PLAIN_FONT);
-
- fNumberOfRuns= new Label("0000", Label.RIGHT);
- fNumberOfRuns.setText("0");
- fNumberOfRuns.setFont(PLAIN_FONT);
-
- Panel numbersPanel= new Panel(new FlowLayout());
- numbersPanel.add(new Label("Runs:")); numbersPanel.add(fNumberOfRuns);
- numbersPanel.add(new Label(" Errors:")); numbersPanel.add(fNumberOfErrors);
- numbersPanel.add(new Label(" Failures:")); numbersPanel.add(fNumberOfFailures);
-
-
- //---- fourth section
- Label failureLabel= new Label("Errors and Failures:");
-
- fFailureList= new List(5);
- fFailureList.addItemListener(
- new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- failureSelected();
- }
- }
- );
- fRerunButton= new Button("Run");
- fRerunButton.setEnabled(false);
- fRerunButton.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- rerun();
- }
- }
- );
-
- Panel failedPanel= new Panel(new GridLayout(0, 1, 0, 2));
- failedPanel.add(fRerunButton);
-
- fTraceArea= new TextArea();
- fTraceArea.setRows(5);
- fTraceArea.setColumns(60);
-
- //---- fifth section
- fStatusLine= new TextField();
- fStatusLine.setFont(PLAIN_FONT);
- fStatusLine.setEditable(false);
- fStatusLine.setForeground(Color.red);
-
- fQuitButton= new Button("Exit");
- fQuitButton.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.exit(0);
- }
- }
- );
-
- // ---------
- fLogo= new Logo();
-
- //---- overall layout
- Panel panel= new Panel(new GridBagLayout());
-
- addGrid(panel, suiteLabel, 0, 0, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
-
- addGrid(panel, fSuiteField, 0, 1, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fRun, 2, 1, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
- addGrid(panel, fUseLoadingRunner, 0, 2, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fProgressIndicator, 0, 3, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fLogo, 2, 3, 1, GridBagConstraints.NONE, 0.0, GridBagConstraints.NORTH);
-
- addGrid(panel, numbersPanel, 0, 4, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.CENTER);
-
- addGrid(panel, failureLabel, 0, 5, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fFailureList, 0, 6, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);
- addGrid(panel, failedPanel, 2, 6, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
- addGrid(panel, fTraceArea, 0, 7, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);
-
- addGrid(panel, fStatusLine, 0, 8, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.CENTER);
- addGrid(panel, fQuitButton, 2, 8, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
-
- frame.add(panel, BorderLayout.CENTER);
- frame.pack();
- return frame;
- }
-
- public void failureSelected() {
- fRerunButton.setEnabled(isErrorSelected());
- showErrorTrace();
- }
-
- public void endTest(Test test) {
- setLabelValue(fNumberOfRuns, fTestResult.runCount());
- synchronized(this) {
- fProgressIndicator.step(fTestResult.wasSuccessful());
- }
- }
-
- private boolean isErrorSelected() {
- return fFailureList.getSelectedIndex() != -1;
- }
-
- private Image loadFrameIcon() {
- Toolkit toolkit= Toolkit.getDefaultToolkit();
- try {
- java.net.URL url= BaseTestRunner.class.getResource("smalllogo.gif");
- return toolkit.createImage((ImageProducer) url.getContent());
- } catch (Exception ex) {
- }
- return null;
- }
-
- public Thread getRunner() {
- return fRunner;
- }
-
- public static void main(String[] args) {
- new TestRunner().start(args);
- }
-
- public static void run(Class test) {
- String args[]= { test.getName() };
- main(args);
- }
-
- public void rerun() {
- int index= fFailureList.getSelectedIndex();
- if (index == -1)
- return;
-
- Test test= (Test)fFailedTests.elementAt(index);
- if (!(test instanceof TestCase)) {
- showInfo("Could not reload "+ test.toString());
- return;
- }
- Test reloadedTest= null;
- try {
- Class reloadedTestClass= getLoader().reload(test.getClass());
- Class[] classArgs= { String.class };
- Constructor constructor= reloadedTestClass.getConstructor(classArgs);
- Object[] args= new Object[]{((TestCase)test).getName()};
- reloadedTest=(Test)constructor.newInstance(args);
- } catch(Exception e) {
- showInfo("Could not reload "+ test.toString());
- return;
- }
- TestResult result= new TestResult();
- reloadedTest.run(result);
-
- String message= reloadedTest.toString();
- if(result.wasSuccessful())
- showInfo(message+" was successful");
- else if (result.errorCount() == 1)
- showStatus(message+" had an error");
- else
- showStatus(message+" had a failure");
- }
-
- protected void reset() {
- setLabelValue(fNumberOfErrors, 0);
- setLabelValue(fNumberOfFailures, 0);
- setLabelValue(fNumberOfRuns, 0);
- fProgressIndicator.reset();
- fRerunButton.setEnabled(false);
- fFailureList.removeAll();
- fExceptions= new Vector(10);
- fFailedTests= new Vector(10);
- fTraceArea.setText("");
-
- }
- /**
- * runs a suite.
- * @deprecated use runSuite() instead
- */
- public void run() {
- runSuite();
- }
-
- protected void runFailed(String message) {
- showStatus(message);
- fRun.setLabel("Run");
- fRunner= null;
- }
-
- synchronized public void runSuite() {
- if (fRunner != null) {
- fTestResult.stop();
- } else {
- setLoading(shouldReload());
- fRun.setLabel("Stop");
- showInfo("Initializing...");
- reset();
-
- showInfo("Load Test Case...");
-
- final Test testSuite= getTest(fSuiteField.getText());
- if (testSuite != null) {
- fRunner= new Thread() {
- public void run() {
- fTestResult= createTestResult();
- fTestResult.addListener(TestRunner.this);
- fProgressIndicator.start(testSuite.countTestCases());
- showInfo("Running...");
-
- long startTime= System.currentTimeMillis();
- testSuite.run(fTestResult);
-
- if (fTestResult.shouldStop()) {
- showStatus("Stopped");
- } else {
- long endTime= System.currentTimeMillis();
- long runTime= endTime-startTime;
- showInfo("Finished: " + elapsedTimeAsString(runTime) + " seconds");
- }
- fTestResult= null;
- fRun.setLabel("Run");
- fRunner= null;
- System.gc();
- }
- };
- fRunner.start();
- }
- }
- }
-
- private boolean shouldReload() {
- return !inVAJava() && fUseLoadingRunner.getState();
- }
-
- private void setLabelValue(Label label, int value) {
- label.setText(Integer.toString(value));
- label.invalidate();
- label.getParent().validate();
-
- }
-
- public void setSuiteName(String suite) {
- fSuiteField.setText(suite);
- }
-
- private void showErrorTrace() {
- int index= fFailureList.getSelectedIndex();
- if (index == -1)
- return;
-
- Throwable t= (Throwable) fExceptions.elementAt(index);
- fTraceArea.setText(getFilteredTrace(t));
- }
-
-
- private void showInfo(String message) {
- fStatusLine.setFont(PLAIN_FONT);
- fStatusLine.setForeground(Color.black);
- fStatusLine.setText(message);
- }
-
- protected void clearStatus() {
- showStatus("");
- }
-
- private void showStatus(String status) {
- fStatusLine.setFont(PLAIN_FONT);
- fStatusLine.setForeground(Color.red);
- fStatusLine.setText(status);
- }
- /**
- * Starts the TestRunner
- */
- public void start(String[] args) {
- String suiteName= processArguments(args);
- fFrame= createUI(suiteName);
- fFrame.setLocation(200, 200);
- fFrame.setVisible(true);
-
- if (suiteName != null) {
- setSuiteName(suiteName);
- runSuite();
- }
- }
-
- public void startTest(Test test) {
- showInfo("Running: "+test);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ActiveTestSuite.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ActiveTestSuite.java
deleted file mode 100644
index 52b5918..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ActiveTestSuite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package junit.extensions;
-
-import junit.framework.*;
-
-/**
- * A TestSuite for active Tests. It runs each
- * test in a separate thread and waits until all
- * threads have terminated.
- * -- Aarhus Radisson Scandinavian Center 11th floor
- */
-public class ActiveTestSuite extends TestSuite {
- private volatile int fActiveTestDeathCount;
-
- public void run(TestResult result) {
- fActiveTestDeathCount= 0;
- super.run(result);
- waitUntilFinished();
- }
-
- public void runTest(final Test test, final TestResult result) {
- Thread t= new Thread() {
- public void run() {
- try {
- // inlined due to limitation in VA/Java
- //ActiveTestSuite.super.runTest(test, result);
- test.run(result);
- } finally {
- ActiveTestSuite.this.runFinished(test);
- }
- }
- };
- t.start();
- }
-
- synchronized void waitUntilFinished() {
- while (fActiveTestDeathCount < testCount()) {
- try {
- wait();
- } catch (InterruptedException e) {
- return; // ignore
- }
- }
- }
-
- synchronized public void runFinished(Test test) {
- fActiveTestDeathCount++;
- notifyAll();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ExceptionTestCase.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ExceptionTestCase.java
deleted file mode 100644
index fe71424..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/ExceptionTestCase.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package junit.extensions;
-
-import junit.framework.*;
-
-/**
- * A TestCase that expects an Exception of class fExpected to be thrown.
- * The other way to check that an expected exception is thrown is:
- * <pre>
- * try {
- * shouldThrow();
- * }
- * catch (SpecialException e) {
- * return;
- * }
- * fail("Expected SpecialException");
- * </pre>
- *
- * To use ExceptionTestCase, create a TestCase like:
- * <pre>
- * new ExceptionTestCase("testShouldThrow", SpecialException.class);
- * </pre>
- */
-public class ExceptionTestCase extends TestCase {
- Class fExpected;
-
- public ExceptionTestCase(String name, Class exception) {
- super(name);
- fExpected= exception;
- }
- /**
- * Execute the test method expecting that an Exception of
- * class fExpected or one of its subclasses will be thrown
- */
- protected void runTest() throws Throwable {
- try {
- super.runTest();
- }
- catch (Exception e) {
- if (fExpected.isAssignableFrom(e.getClass()))
- return;
- else
- throw e;
- }
- fail("Expected exception " + fExpected);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/RepeatedTest.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/RepeatedTest.java
deleted file mode 100644
index e16e350..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/RepeatedTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package junit.extensions;
-
-import junit.framework.*;
-
-/**
- * A Decorator that runs a test repeatedly.
- *
- */
-public class RepeatedTest extends TestDecorator {
- private int fTimesRepeat;
-
- public RepeatedTest(Test test, int repeat) {
- super(test);
- if (repeat < 0)
- throw new IllegalArgumentException("Repetition count must be > 0");
- fTimesRepeat= repeat;
- }
- public int countTestCases() {
- return super.countTestCases()*fTimesRepeat;
- }
- public void run(TestResult result) {
- for (int i= 0; i < fTimesRepeat; i++) {
- if (result.shouldStop())
- break;
- super.run(result);
- }
- }
- public String toString() {
- return super.toString()+"(repeated)";
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestDecorator.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestDecorator.java
deleted file mode 100644
index 4b98c4f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestDecorator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package junit.extensions;
-
-import junit.framework.*;
-
-/**
- * A Decorator for Tests. Use TestDecorator as the base class
- * for defining new test decorators. Test decorator subclasses
- * can be introduced to add behaviour before or after a test
- * is run.
- *
- */
-public class TestDecorator extends Assert implements Test {
- protected Test fTest;
-
- public TestDecorator(Test test) {
- fTest= test;
- }
- /**
- * The basic run behaviour.
- */
- public void basicRun(TestResult result) {
- fTest.run(result);
- }
- public int countTestCases() {
- return fTest.countTestCases();
- }
- public void run(TestResult result) {
- basicRun(result);
- }
-
- public String toString() {
- return fTest.toString();
- }
-
- public Test getTest() {
- return fTest;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestSetup.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestSetup.java
deleted file mode 100644
index 137e1a2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/extensions/TestSetup.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package junit.extensions;
-
-import junit.framework.*;
-
-/**
- * A Decorator to set up and tear down additional fixture state.
- * Subclass TestSetup and insert it into your tests when you want
- * to set up additional state once before the tests are run.
- */
-public class TestSetup extends TestDecorator {
-
- public TestSetup(Test test) {
- super(test);
- }
- public void run(final TestResult result) {
- Protectable p= new Protectable() {
- public void protect() throws Exception {
- setUp();
- basicRun(result);
- tearDown();
- }
- };
- result.runProtected(this, p);
- }
- /**
- * Sets up the fixture. Override to set up additional fixture
- * state.
- */
- protected void setUp() throws Exception {
- }
- /**
- * Tears down the fixture. Override to tear down the additional
- * fixture state.
- */
- protected void tearDown() throws Exception {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Assert.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Assert.java
deleted file mode 100644
index a038fdb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Assert.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package junit.framework;
-
-/**
- * A set of assert methods.
- */
-
-public class Assert {
- /**
- * Protect constructor since it is a static only class
- */
- protected Assert() {
- }
- /**
- * Asserts that a condition is true. If it isn't it throws
- * an AssertionFailedError with the given message.
- * @deprecated use assertTrue
- */
- static public void assert(String message, boolean condition) {
- if (!condition)
- fail(message);
- }
- /**
- * Asserts that a condition is true. If it isn't it throws
- * an AssertionFailedError.
- * @deprecated use assertTrue
- *
- */
- static public void assert(boolean condition) {
- assert(null, condition);
- }
-
- /**
- * Asserts that a condition is true. If it isn't it throws
- * an AssertionFailedError with the given message.
- */
- static public void assertTrue(String message, boolean condition) {
- if (!condition)
- fail(message);
- }
- /**
- * Asserts that a condition is true. If it isn't it throws
- * an AssertionFailedError.
- */
- static public void assertTrue(boolean condition) {
- assertTrue(null, condition);
- }
- /**
- * Fails a test with the given message.
- */
- static public void fail(String message) {
- throw new AssertionFailedError(message);
- }
- /**
- * Fails a test with no message.
- */
- static public void fail() {
- fail(null);
- }
- /**
- * Asserts that two objects are equal. If they are not
- * an AssertionFailedError is thrown.
- */
- static public void assertEquals(String message, Object expected, Object actual) {
- if (expected == null && actual == null)
- return;
- if (expected != null && expected.equals(actual))
- return;
- failNotEquals(message, expected, actual);
- }
- /**
- * Asserts that two objects are equal. If they are not
- * an AssertionFailedError is thrown.
- */
- static public void assertEquals(Object expected, Object actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that two doubles are equal concerning a delta. If the expected
- * value is infinity then the delta value is ignored.
- */
- static public void assertEquals(String message, double expected, double actual, double delta) {
- // handle infinity specially since subtracting to infinite values gives NaN and the
- // the following test fails
- if (Double.isInfinite(expected)) {
- if (!(expected == actual))
- failNotEquals(message, new Double(expected), new Double(actual));
- } else if (!(Math.abs(expected-actual) <= delta)) // Because comparison with NaN always returns false
- failNotEquals(message, new Double(expected), new Double(actual));
- }
- /**
- * Asserts that two doubles are equal concerning a delta. If the expected
- * value is infinity then the delta value is ignored.
- */
- static public void assertEquals(double expected, double actual, double delta) {
- assertEquals(null, expected, actual, delta);
- }
- /**
- * Asserts that two floats are equal concerning a delta. If the expected
- * value is infinity then the delta value is ignored.
- */
- static public void assertEquals(String message, float expected, float actual, float delta) {
- // handle infinity specially since subtracting to infinite values gives NaN and the
- // the following test fails
- if (Float.isInfinite(expected)) {
- if (!(expected == actual))
- failNotEquals(message, new Float(expected), new Float(actual));
- } else if (!(Math.abs(expected-actual) <= delta))
- failNotEquals(message, new Float(expected), new Float(actual));
- }
- /**
- * Asserts that two floats are equal concerning a delta. If the expected
- * value is infinity then the delta value is ignored.
- */
- static public void assertEquals(float expected, float actual, float delta) {
- assertEquals(null, expected, actual, delta);
- }
- /**
- * Asserts that two longs are equal.
- */
- static public void assertEquals(String message, long expected, long actual) {
- assertEquals(message, new Long(expected), new Long(actual));
- }
- /**
- * Asserts that two longs are equal.
- */
- static public void assertEquals(long expected, long actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that two booleans are equal.
- */
- static public void assertEquals(String message, boolean expected, boolean actual) {
- assertEquals(message, new Boolean(expected), new Boolean(actual));
- }
- /**
- * Asserts that two booleans are equal.
- */
- static public void assertEquals(boolean expected, boolean actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that two bytes are equal.
- */
- static public void assertEquals(String message, byte expected, byte actual) {
- assertEquals(message, new Byte(expected), new Byte(actual));
- }
- /**
- * Asserts that two bytes are equal.
- */
- static public void assertEquals(byte expected, byte actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that two chars are equal.
- */
- static public void assertEquals(String message, char expected, char actual) {
- assertEquals(message, new Character(expected), new Character(actual));
- }
- /**
- * Asserts that two chars are equal.
- */
- static public void assertEquals(char expected, char actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that two shorts are equal.
- */
- static public void assertEquals(String message, short expected, short actual) {
- assertEquals(message, new Short(expected), new Short(actual));
- }
- /**
- * Asserts that two shorts are equal.
- */
- static public void assertEquals(short expected, short actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that two ints are equal.
- */
- static public void assertEquals(String message, int expected, int actual) {
- assertEquals(message, new Integer(expected), new Integer(actual));
- }
- /**
- * Asserts that two ints are equal.
- */
- static public void assertEquals(int expected, int actual) {
- assertEquals(null, expected, actual);
- }
- /**
- * Asserts that an object isn't null.
- */
- static public void assertNotNull(Object object) {
- assertNotNull(null, object);
- }
- /**
- * Asserts that an object isn't null.
- */
- static public void assertNotNull(String message, Object object) {
- assertTrue(message, object != null);
- }
- /**
- * Asserts that an object is null.
- */
- static public void assertNull(Object object) {
- assertNull(null, object);
- }
- /**
- * Asserts that an object is null.
- */
- static public void assertNull(String message, Object object) {
- assertTrue(message, object == null);
- }
- /**
- * Asserts that two objects refer to the same object. If they are not
- * an AssertionFailedError is thrown.
- */
- static public void assertSame(String message, Object expected, Object actual) {
- if (expected == actual)
- return;
- failNotSame(message, expected, actual);
- }
- /**
- * Asserts that two objects refer to the same object. If they are not
- * the same an AssertionFailedError is thrown.
- */
- static public void assertSame(Object expected, Object actual) {
- assertSame(null, expected, actual);
- }
-
- static private void failNotEquals(String message, Object expected, Object actual) {
- String formatted= "";
- if (message != null)
- formatted= message+" ";
- fail(formatted+"expected:<"+expected+"> but was:<"+actual+">");
- }
-
- static private void failNotSame(String message, Object expected, Object actual) {
- String formatted= "";
- if (message != null)
- formatted= message+" ";
- fail(formatted+"expected same");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/AssertionFailedError.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/AssertionFailedError.java
deleted file mode 100644
index 6679a89..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/AssertionFailedError.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package junit.framework;
-
-/**
- * Thrown when an assertion failed.
- */
-public class AssertionFailedError extends Error {
-
- public AssertionFailedError () {
- }
- public AssertionFailedError (String message) {
- super (message);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Protectable.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Protectable.java
deleted file mode 100644
index e143237..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Protectable.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package junit.framework;
-
-/**
- * A <em>Protectable</em> can be run and can throw a Throwable.
- *
- * @see TestResult
- */
-public interface Protectable {
-
- /**
- * Run the the following method protected.
- */
- public abstract void protect() throws Throwable;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Test.java
deleted file mode 100644
index a016ee8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/Test.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package junit.framework;
-
-/**
- * A <em>Test</em> can be run and collect its results.
- *
- * @see TestResult
- */
-public interface Test {
- /**
- * Counts the number of test cases that will be run by this test.
- */
- public abstract int countTestCases();
- /**
- * Runs a test and collects its result in a TestResult instance.
- */
- public abstract void run(TestResult result);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestCase.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestCase.java
deleted file mode 100644
index c8d68e7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestCase.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package junit.framework;
-
-import java.lang.reflect.*;
-
-/**
- * A test case defines the fixture to run multiple tests. To define a test case<br>
- * 1) implement a subclass of TestCase<br>
- * 2) define instance variables that store the state of the fixture<br>
- * 3) initialize the fixture state by overriding <code>setUp</code><br>
- * 4) clean-up after a test by overriding <code>tearDown</code>.<br>
- * Each test runs in its own fixture so there
- * can be no side effects among test runs.
- * Here is an example:
- * <pre>
- * public class MathTest extends TestCase {
- * protected double fValue1;
- * protected double fValue2;
- *
- * public MathTest(String name) {
- * super(name);
- * }
- *
- * protected void setUp() {
- * fValue1= 2.0;
- * fValue2= 3.0;
- * }
- * }
- * </pre>
- *
- * For each test implement a method which interacts
- * with the fixture. Verify the expected results with assertions specified
- * by calling <code>assert</code> with a boolean.
- * <pre>
- * protected void testAdd() {
- * double result= fValue1 + fValue2;
- * assert(result == 5.0);
- * }
- * </pre>
- * Once the methods are defined you can run them. The framework supports
- * both a static type safe and more dynamic way to run a test.
- * In the static way you override the runTest method and define the method to
- * be invoked. A convenient way to do so is with an anonymous inner class.
- * <pre>
- * Test test= new MathTest("add") {
- * public void runTest() {
- * testAdd();
- * }
- * };
- * test.run();
- * </pre>
- * The dynamic way uses reflection to implement <code>runTest</code>. It dynamically finds
- * and invokes a method.
- * In this case the name of the test case has to correspond to the test method
- * to be run.
- * <pre>
- * Test= new MathTest("testAdd");
- * test.run();
- * </pre>
- * The tests to be run can be collected into a TestSuite. JUnit provides
- * different <i>test runners</i> which can run a test suite and collect the results.
- * A test runner either expects a static method <code>suite</code> as the entry
- * point to get a test to run or it will extract the suite automatically.
- * <pre>
- * public static Test suite() {
- * suite.addTest(new MathTest("testAdd"));
- * suite.addTest(new MathTest("testDivideByZero"));
- * return suite;
- * }
- * </pre>
- * @see TestResult
- * @see TestSuite
- */
-
-public abstract class TestCase extends Assert implements Test {
- /**
- * the name of the test case
- */
- private String fName;
-
- /**
- * No-arg constructor to enable serialization. This method
- * is not intended to be used by mere mortals.
- */
- TestCase() {
- fName= null;
- }
-
- /**
- * Constructs a test case with the given name.
- */
- public TestCase(String name) {
- fName= name;
- }
-
- /**
- * Counts the number of test cases executed by run(TestResult result).
- */
- public int countTestCases() {
- return 1;
- }
- /**
- * Creates a default TestResult object
- *
- * @see TestResult
- */
- protected TestResult createResult() {
- return new TestResult();
- }
- /**
- * Gets the name of the test case.
- * @deprecated use getName()
- */
- public String name() {
- return fName;
- }
- /**
- * A convenience method to run this test, collecting the results with a
- * default TestResult object.
- *
- * @see TestResult
- */
- public TestResult run() {
- TestResult result= createResult();
- run(result);
- return result;
- }
- /**
- * Runs the test case and collects the results in TestResult.
- */
- public void run(TestResult result) {
- result.run(this);
- }
- /**
- * Runs the bare test sequence.
- * @exception Throwable if any exception is thrown
- */
- public void runBare() throws Throwable {
- setUp();
- try {
- runTest();
- }
- finally {
- tearDown();
- }
- }
- /**
- * Override to run the test and assert its state.
- * @exception Throwable if any exception is thrown
- */
- protected void runTest() throws Throwable {
- Method runMethod= null;
- try {
- // use getMethod to get all public inherited
- // methods. getDeclaredMethods returns all
- // methods of this class but excludes the
- // inherited ones.
- runMethod= getClass().getMethod(fName, null);
- } catch (NoSuchMethodException e) {
- fail("Method \""+fName+"\" not found");
- }
- if (!Modifier.isPublic(runMethod.getModifiers())) {
- fail("Method \""+fName+"\" should be public");
- }
-
- try {
- runMethod.invoke(this, new Class[0]);
- }
- catch (InvocationTargetException e) {
- e.fillInStackTrace();
- throw e.getTargetException();
- }
- catch (IllegalAccessException e) {
- e.fillInStackTrace();
- throw e;
- }
- }
- /**
- * Sets up the fixture, for example, open a network connection.
- * This method is called before a test is executed.
- */
- protected void setUp() throws Exception {
- }
- /**
- * Tears down the fixture, for example, close a network connection.
- * This method is called after a test is executed.
- */
- protected void tearDown() throws Exception {
- }
- /**
- * Returns a string representation of the test case
- */
- public String toString() {
- return name()+"("+getClass().getName()+")";
- }
- /**
- * Gets the name of a TestCase
- * @return returns a String
- */
- public String getName() {
- return fName;
- }
-
- /**
- * Sets the name of a TestCase
- * @param name The name to set
- */
- public void setName(String name) {
- fName= name;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestFailure.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestFailure.java
deleted file mode 100644
index aa75dc7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestFailure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package junit.framework;
-
-/**
- * A <code>TestFailure</code> collects a failed test together with
- * the caught exception.
- * @see TestResult
- */
-public class TestFailure extends Object {
- protected Test fFailedTest;
- protected Throwable fThrownException;
-
- /**
- * Constructs a TestFailure with the given test and exception.
- */
- public TestFailure(Test failedTest, Throwable thrownException) {
- fFailedTest= failedTest;
- fThrownException= thrownException;
- }
- /**
- * Gets the failed test.
- */
- public Test failedTest() {
- return fFailedTest;
- }
- /**
- * Gets the thrown exception.
- */
- public Throwable thrownException() {
- return fThrownException;
- }
- /**
- * Returns a short description of the failure.
- */
- public String toString() {
- StringBuffer buffer= new StringBuffer();
- buffer.append(fFailedTest+": "+fThrownException.getMessage());
- return buffer.toString();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestListener.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestListener.java
deleted file mode 100644
index 9b69443..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package junit.framework;
-
-/**
- * A Listener for test progress
- */
-public interface TestListener {
- /**
- * An error occurred.
- */
- public void addError(Test test, Throwable t);
- /**
- * A failure occurred.
- */
- public void addFailure(Test test, AssertionFailedError t);
- /**
- * A test ended.
- */
- public void endTest(Test test);
- /**
- * A test started.
- */
- public void startTest(Test test);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestResult.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestResult.java
deleted file mode 100644
index f8625c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestResult.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package junit.framework;
-
-import java.util.Vector;
-import java.util.Enumeration;
-
-/**
- * A <code>TestResult</code> collects the results of executing
- * a test case. It is an instance of the Collecting Parameter pattern.
- * The test framework distinguishes between <i>failures</i> and <i>errors</i>.
- * A failure is anticipated and checked for with assertions. Errors are
- * unanticipated problems like an <code>ArrayIndexOutOfBoundsException</code>.
- *
- * @see Test
- */
-public class TestResult extends Object {
- protected Vector fFailures;
- protected Vector fErrors;
- protected Vector fListeners;
- protected int fRunTests;
- private boolean fStop;
-
- public TestResult() {
- fFailures= new Vector();
- fErrors= new Vector();
- fListeners= new Vector();
- fRunTests= 0;
- fStop= false;
- }
- /**
- * Adds an error to the list of errors. The passed in exception
- * caused the error.
- */
- public synchronized void addError(Test test, Throwable t) {
- fErrors.addElement(new TestFailure(test, t));
- for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
- ((TestListener)e.nextElement()).addError(test, t);
- }
- }
- /**
- * Adds a failure to the list of failures. The passed in exception
- * caused the failure.
- */
- public synchronized void addFailure(Test test, AssertionFailedError t) {
- fFailures.addElement(new TestFailure(test, t));
- for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
- ((TestListener)e.nextElement()).addFailure(test, t);
- }
- }
- /**
- * Registers a TestListener
- */
- public synchronized void addListener(TestListener listener) {
- fListeners.addElement(listener);
- }
- /**
- * Unregisters a TestListener
- */
- public synchronized void removeListener(TestListener listener) {
- fListeners.removeElement(listener);
- }
- /**
- * Returns a copy of the listeners.
- */
- private synchronized Vector cloneListeners() {
- return (Vector)fListeners.clone();
- }
- /**
- * Informs the result that a test was completed.
- */
- public void endTest(Test test) {
- for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
- ((TestListener)e.nextElement()).endTest(test);
- }
- }
- /**
- * Gets the number of detected errors.
- */
- public synchronized int errorCount() {
- return fErrors.size();
- }
- /**
- * Returns an Enumeration for the errors
- */
- public synchronized Enumeration errors() {
- return fErrors.elements();
- }
- /**
- * Gets the number of detected failures.
- */
- public synchronized int failureCount() {
- return fFailures.size();
- }
- /**
- * Returns an Enumeration for the failures
- */
- public synchronized Enumeration failures() {
- return fFailures.elements();
- }
- /**
- * Runs a TestCase.
- */
- protected void run(final TestCase test) {
- startTest(test);
- Protectable p= new Protectable() {
- public void protect() throws Throwable {
- test.runBare();
- }
- };
- runProtected(test, p);
-
- endTest(test);
- }
- /**
- * Gets the number of run tests.
- */
- public synchronized int runCount() {
- return fRunTests;
- }
- /**
- * Runs a TestCase.
- */
- public void runProtected(final Test test, Protectable p) {
- try {
- p.protect();
- }
- catch (AssertionFailedError e) {
- addFailure(test, e);
- }
- catch (ThreadDeath e) { // don't catch ThreadDeath by accident
- throw e;
- }
- catch (Throwable e) {
- addError(test, e);
- }
- }
- /**
- * Gets the number of run tests.
- * @deprecated use <code>runCount</code> instead
- */
- public synchronized int runTests() {
- return runCount();
- }
- /**
- * Checks whether the test run should stop
- */
- public synchronized boolean shouldStop() {
- return fStop;
- }
- /**
- * Informs the result that a test will be started.
- */
- public void startTest(Test test) {
- final int count= test.countTestCases();
- synchronized(this) {
- fRunTests+= count;
- }
- for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
- ((TestListener)e.nextElement()).startTest(test);
- }
- }
- /**
- * Marks that the test run should stop.
- */
- public synchronized void stop() {
- fStop= true;
- }
- /**
- * Gets the number of detected errors.
- * @deprecated use <code>errorCount</code> instead
- */
- public synchronized int testErrors() {
- return errorCount();
- }
- /**
- * Gets the number of detected failures.
- * @deprecated use <code>failureCount</code> instead
- */
- public synchronized int testFailures() {
- return failureCount();
- }
- /**
- * Returns whether the entire test was successful or not.
- */
- public synchronized boolean wasSuccessful() {
- return testFailures() == 0 && testErrors() == 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestSuite.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestSuite.java
deleted file mode 100644
index fb04742..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/framework/TestSuite.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package junit.framework;
-
-import java.util.Vector;
-import java.util.Enumeration;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.*;
-
-/**
- * A <code>TestSuite</code> is a <code>Composite</code> of Tests.
- * It runs a collection of test cases. Here is an example using
- * the dynamic test definition.
- * <pre>
- * TestSuite suite= new TestSuite();
- * suite.addTest(new MathTest("testAdd"));
- * suite.addTest(new MathTest("testDivideByZero"));
- * </pre>
- * Alternatively, a TestSuite can extract the tests to be run automatically.
- * To do so you pass the class of your TestCase class to the
- * TestSuite constructor.
- * <pre>
- * TestSuite suite= new TestSuite(MathTest.class);
- * </pre>
- * This constructor creates a suite with all the methods
- * starting with "test" that take no arguments.
- *
- * @see Test
- */
-public class TestSuite implements Test {
-
- private Vector fTests= new Vector(10);
- private String fName;
-
- /**
- * Constructs an empty TestSuite.
- */
- public TestSuite() {
- }
- /**
- * Constructs a TestSuite from the given class. Adds all the methods
- * starting with "test" as test cases to the suite.
- * Parts of this method was written at 2337 meters in the Hüffihütte,
- * Kanton Uri
- */
-
- public TestSuite(final Class theClass) {
- fName= theClass.getName();
- Constructor constructor= null;
- try {
- constructor= getConstructor(theClass);
- } catch (NoSuchMethodException e) {
- addTest(warning("Class "+theClass.getName()+" has no public constructor TestCase(String name)"));
- return;
- }
-
- if (!Modifier.isPublic(theClass.getModifiers())) {
- addTest(warning("Class "+theClass.getName()+" is not public"));
- return;
- }
-
- Class superClass= theClass;
- Vector names= new Vector();
- while (Test.class.isAssignableFrom(superClass)) {
- Method[] methods= superClass.getDeclaredMethods();
- for (int i= 0; i < methods.length; i++) {
- addTestMethod(methods[i], names, constructor);
- }
- superClass= superClass.getSuperclass();
- }
- if (fTests.size() == 0)
- addTest(warning("No tests found in "+theClass.getName()));
- }
- /**
- * Constructs an empty TestSuite.
- */
- public TestSuite(String name) {
- fName= name;
- }
- /**
- * Adds a test to the suite.
- */
- public void addTest(Test test) {
- fTests.addElement(test);
- }
-
- /**
- * Adds the tests from the given class to the suite
- */
- public void addTestSuite(Class testClass) {
- addTest(new TestSuite(testClass));
- }
-
- private void addTestMethod(Method m, Vector names, Constructor constructor) {
- String name= m.getName();
- if (names.contains(name))
- return;
- if (isPublicTestMethod(m)) {
- names.addElement(name);
-
- Object[] args= new Object[]{name};
- try {
- addTest((Test)constructor.newInstance(args));
- } catch (InstantiationException e) {
- addTest(warning("Cannot instantiate test case: "+name+" ("+exceptionToString(e)+")"));
- } catch (InvocationTargetException e) {
- addTest(warning("Exception in constructor: "+name+" ("+exceptionToString(e.getTargetException())+")"));
- } catch (IllegalAccessException e) {
- addTest(warning("Cannot access test case: "+name+" ("+exceptionToString(e)+")"));
- }
-
- } else { // almost a test method
- if (isTestMethod(m))
- addTest(warning("Test method isn't public: "+m.getName()));
- }
- }
-
- /**
- * Converts the stack trace into a string
- */
- private String exceptionToString(Throwable t) {
- StringWriter stringWriter= new StringWriter();
- PrintWriter writer= new PrintWriter(stringWriter);
- t.printStackTrace(writer);
- return stringWriter.toString();
-
- }
- /**
- * Counts the number of test cases that will be run by this test.
- */
- public int countTestCases() {
- int count= 0;
- for (Enumeration e= tests(); e.hasMoreElements(); ) {
- Test test= (Test)e.nextElement();
- count= count + test.countTestCases();
- }
- return count;
- }
- /**
- * Gets a constructor which takes a single String as
- * its argument.
- */
- private Constructor getConstructor(Class theClass) throws NoSuchMethodException {
- Class[] args= { String.class };
- return theClass.getConstructor(args);
- }
-
- /**
- */
- private boolean isPublicTestMethod(Method m) {
- return isTestMethod(m) && Modifier.isPublic(m.getModifiers());
- }
- /**
- */
- private boolean isTestMethod(Method m) {
- String name= m.getName();
- Class[] parameters= m.getParameterTypes();
- Class returnType= m.getReturnType();
- return parameters.length == 0 && name.startsWith("test") && returnType.equals(Void.TYPE);
- }
- /**
- * Runs the tests and collects their result in a TestResult.
- */
- public void run(TestResult result) {
- for (Enumeration e= tests(); e.hasMoreElements(); ) {
- if (result.shouldStop() )
- break;
- Test test= (Test)e.nextElement();
- runTest(test, result);
- }
- }
-
- public void runTest(Test test, TestResult result) {
- test.run(result);
- }
-
- /**
- * Returns the test at the given index
- */
- public Test testAt(int index) {
- return (Test)fTests.elementAt(index);
- }
- /**
- * Returns the number of tests in this suite
- */
- public int testCount() {
- return fTests.size();
- }
- /**
- * Returns the tests as an enumeration
- */
- public Enumeration tests() {
- return fTests.elements();
- }
- /**
- */
- public String toString() {
- if (getName() != null)
- return getName();
- return super.toString();
- }
-
- /**
- * Sets the name of the suite.
- * @param name The name to set
- */
- public void setName(String name) {
- fName= name;
- }
-
- /**
- * Returns the name of the suite. Not all
- * test suites have a name and this method
- * can return null.
- */
- public String getName() {
- return fName;
- }
-
- /**
- * Returns a test which will fail and log a warning message.
- */
- private Test warning(final String message) {
- return new TestCase("warning") {
- protected void runTest() {
- fail(message);
- }
- };
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/BaseTestRunner.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/BaseTestRunner.java
deleted file mode 100644
index 018021b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/BaseTestRunner.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package junit.runner;
-
-import junit.framework.*;
-import java.lang.reflect.*;
-import java.text.NumberFormat;
-import java.io.*;
-import java.util.*;
-
-/**
- * Base class for all test runners.
- * This class was born live on stage in Sardinia during XP2000.
- */
-public abstract class BaseTestRunner implements TestListener {
- public static final String SUITE_METHODNAME= "suite";
-
- static Properties fPreferences;
- static int fgMaxMessageLength= 500;
- static boolean fgFilterStack= true;
- boolean fLoading= true;
-
- /**
- * Returns the Test corresponding to the given suite. This is
- * a template method, subclasses override runFailed(), clearStatus().
- */
- public Test getTest(String suiteClassName) {
- if (suiteClassName.length() <= 0) {
- clearStatus();
- return null;
- }
- Class testClass= null;
- try {
- testClass= loadSuiteClass(suiteClassName);
- } catch (ClassNotFoundException e) {
- String clazz= e.getMessage();
- if (clazz == null)
- clazz= suiteClassName;
- runFailed("Class not found \""+clazz+"\"");
- return null;
- } catch(Exception e) {
- runFailed("Error: "+e.toString());
- return null;
- }
- Method suiteMethod= null;
- try {
- suiteMethod= testClass.getMethod(SUITE_METHODNAME, new Class[0]);
- } catch(Exception e) {
- // try to extract a test suite automatically
- clearStatus();
- return new TestSuite(testClass);
- }
- Test test= null;
- try {
- test= (Test)suiteMethod.invoke(null, new Class[0]); // static method
- if (test == null)
- return test;
- }
- catch (InvocationTargetException e) {
- runFailed("Failed to invoke suite():" + e.getTargetException().toString());
- return null;
- }
- catch (IllegalAccessException e) {
- runFailed("Failed to invoke suite():" + e.toString());
- return null;
- }
-
- clearStatus();
- return test;
- }
-
- /**
- * Returns the formatted string of the elapsed time.
- */
- public String elapsedTimeAsString(long runTime) {
- return NumberFormat.getInstance().format((double)runTime/1000);
- }
-
- /**
- * Processes the command line arguments and
- * returns the name of the suite class to run or null
- */
- protected String processArguments(String[] args) {
- String suiteName= null;
- for (int i= 0; i < args.length; i++) {
- if (args[i].equals("-noloading")) {
- setLoading(false);
- } else if (args[i].equals("-nofilterstack")) {
- fgFilterStack= false;
- } else if (args[i].equals("-c")) {
- if (args.length > i+1)
- suiteName= extractClassName(args[i+1]);
- else
- System.out.println("Missing Test class name");
- i++;
- } else {
- suiteName= args[i];
- }
- }
- return suiteName;
- }
-
- /**
- * Sets the loading behaviour of the test runner
- */
- public void setLoading(boolean enable) {
- fLoading= enable;
- }
- /**
- * Extract the class name from a String in VA/Java style
- */
- public String extractClassName(String className) {
- if(className.startsWith("Default package for"))
- return className.substring(className.lastIndexOf(".")+1);
- return className;
- }
-
- /**
- * Truncates a String to the maximum length.
- */
- public static String truncate(String s) {
- if (fgMaxMessageLength != -1 && s.length() > fgMaxMessageLength)
- s= s.substring(0, fgMaxMessageLength)+"...";
- return s;
- }
-
- /**
- * Override to define how to handle a failed loading of
- * a test suite.
- */
- protected abstract void runFailed(String message);
-
- /**
- * Returns the loaded Class for a suite name.
- */
- protected Class loadSuiteClass(String suiteClassName) throws ClassNotFoundException {
- return getLoader().load(suiteClassName);
- }
-
- /**
- * Clears the status message.
- */
- protected void clearStatus() { // Belongs in the GUI TestRunner class
- }
-
- /**
- * Returns the loader to be used.
- */
- public TestSuiteLoader getLoader() {
- if (useReloadingTestSuiteLoader())
- return new ReloadingTestSuiteLoader();
- return new StandardTestSuiteLoader();
- }
-
- protected boolean useReloadingTestSuiteLoader() {
- return getPreference("loading").equals("true") && !inVAJava() && fLoading;
- }
-
- private static File getPreferencesFile() {
- String home= System.getProperty("user.home");
- return new File(home, "junit.properties");
- }
-
- private static void readPreferences() {
- InputStream is= null;
- try {
- is= new FileInputStream(getPreferencesFile());
- fPreferences= new Properties(fPreferences);
- fPreferences.load(is);
- } catch (IOException e) {
- try {
- if (is != null)
- is.close();
- } catch (IOException e1) {
- }
- }
- }
-
- public static String getPreference(String key) {
- return fPreferences.getProperty(key);
- }
-
- public static int getPreference(String key, int dflt) {
- String value= getPreference(key);
- int intValue= dflt;
- if (value == null)
- return intValue;
- try {
- intValue= Integer.parseInt(value);
- } catch (NumberFormatException ne) {
- }
- return intValue;
- }
-
- public static boolean inVAJava() {
- try {
- Class.forName("com.ibm.uvm.tools.DebugSupport");
- }
- catch (Exception e) {
- return false;
- }
- return true;
- }
-
-
- /**
- * Returns a filtered stack trace
- */
- public static String getFilteredTrace(Throwable t) {
- StringWriter stringWriter= new StringWriter();
- PrintWriter writer= new PrintWriter(stringWriter);
- t.printStackTrace(writer);
- StringBuffer buffer= stringWriter.getBuffer();
- String trace= buffer.toString();
- return BaseTestRunner.filterStack(trace);
- }
-
- /**
- * Filters stack frames from internal JUnit classes
- */
- public static String filterStack(String stack) {
- if (!getPreference("filterstack").equals("true") || fgFilterStack == false)
- return stack;
-
- StringWriter sw= new StringWriter();
- PrintWriter pw= new PrintWriter(sw);
- StringReader sr= new StringReader(stack);
- BufferedReader br= new BufferedReader(sr);
-
- String line;
- try {
- while ((line= br.readLine()) != null) {
- if (!filterLine(line))
- pw.println(line);
- }
- } catch (Exception IOException) {
- return stack; // return the stack unfiltered
- }
- return sw.toString();
- }
-
- static boolean filterLine(String line) {
- String[] patterns= new String[] {
- "junit.framework.TestCase",
- "junit.framework.TestResult",
- "junit.framework.TestSuite",
- "junit.framework.Assert.", // don't filter AssertionFailure
- "junit.swingui.TestRunner",
- "junit.awtui.TestRunner",
- "junit.textui.TestRunner",
- "java.lang.reflect.Method.invoke("
- };
- for (int i= 0; i < patterns.length; i++) {
- if (line.indexOf(patterns[i]) > 0)
- return true;
- }
- return false;
- }
-
- {
- fPreferences= new Properties();
- //JDK 1.2 feature
- //fPreferences.setProperty("loading", "true");
- fPreferences.put("loading", "true");
- fPreferences.put("filterstack", "true");
- readPreferences();
- fgMaxMessageLength= getPreference("maxmessage", fgMaxMessageLength);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ClassPathTestCollector.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ClassPathTestCollector.java
deleted file mode 100644
index f2614a8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ClassPathTestCollector.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package junit.runner;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * An implementation of a TestCollector that consults the
- * class path. It considers all classes on the class path
- * excluding classes in JARs. It leaves it up to subclasses
- * to decide whether a class is a runnable Test.
- *
- * @see TestCollector
- */
-public abstract class ClassPathTestCollector implements TestCollector {
-
- static final int SUFFIX_LENGTH= ".class".length();
-
- public ClassPathTestCollector() {
- }
-
- public Enumeration collectTests() {
- String classPath= System.getProperty("java.class.path");
- String separator= System.getProperty("path.separator");
- Hashtable result= new Hashtable(100);
- collectFilesInRoots(splitClassPath(classPath, separator), result);
- return result.elements();
- }
-
- void collectFilesInRoots(Vector roots, Hashtable result) {
- Enumeration e= roots.elements();
- while (e.hasMoreElements())
- gatherFiles(new File((String)e.nextElement()), "", result);
- }
-
- void gatherFiles(File classRoot, String classFileName, Hashtable result) {
- File thisRoot= new File(classRoot, classFileName);
- if (thisRoot.isFile()) {
- if (isTestClass(classFileName)) {
- String className= classNameFromFile(classFileName);
- result.put(className, className);
- }
- return;
- }
- String[] contents= thisRoot.list();
- if (contents != null) {
- for (int i= 0; i < contents.length; i++)
- gatherFiles(classRoot, classFileName+File.separatorChar+contents[i], result);
- }
- }
-
- Vector splitClassPath(String classPath, String separator) {
- Vector result= new Vector();
- StringTokenizer tokenizer= new StringTokenizer(classPath, separator);
- while (tokenizer.hasMoreTokens())
- result.addElement(tokenizer.nextToken());
- return result;
- }
-
- protected boolean isTestClass(String classFileName) {
- return
- classFileName.endsWith(".class") &&
- classFileName.indexOf('$') < 0 &&
- classFileName.indexOf("Test") > 0;
- }
-
- protected String classNameFromFile(String classFileName) {
- // convert /a/b.class to a.b
- String s= classFileName.substring(0, classFileName.length()-SUFFIX_LENGTH);
- String s2= s.replace(File.separatorChar, '.');
- if (s2.startsWith("."))
- return s2.substring(1);
- return s2;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/FailureDetailView.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/FailureDetailView.java
deleted file mode 100644
index f4562af..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/FailureDetailView.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package junit.runner;
-
-import java.awt.Component;
-
-import junit.framework.*;
-
-/**
- * A view to show a details about a failure
- */
-public interface FailureDetailView {
- /**
- * Returns the component used to present the TraceView
- */
- public Component getComponent();
- /**
- * Shows details of a TestFailure
- */
- public void showFailure(TestFailure failure);
- /**
- * Clears the view
- */
- public void clear();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/LoadingTestCollector.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/LoadingTestCollector.java
deleted file mode 100644
index b9b7ae4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/LoadingTestCollector.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package junit.runner;
-
-import java.lang.reflect.*;
-import junit.runner.*;
-import junit.framework.*;
-
-/**
- * An implementation of a TestCollector that loads
- * all classes on the class path and tests whether
- * it is assignable from Test or provides a static suite method.
- * @see TestCollector
- */
-public class LoadingTestCollector extends ClassPathTestCollector {
-
- TestCaseClassLoader fLoader;
-
- public LoadingTestCollector() {
- fLoader= new TestCaseClassLoader();
- }
-
- protected boolean isTestClass(String classFileName) {
- try {
- if (classFileName.endsWith(".class")) {
- Class testClass= classFromFile(classFileName);
- return (testClass != null) && isTestClass(testClass);
- }
- }
- catch (ClassNotFoundException expected) {
- }
- catch (NoClassDefFoundError notFatal) {
- }
- return false;
- }
-
- Class classFromFile(String classFileName) throws ClassNotFoundException {
- String className= classNameFromFile(classFileName);
- if (!fLoader.isExcluded(className))
- return fLoader.loadClass(className, false);
- return null;
- }
-
- boolean isTestClass(Class testClass) {
- if (hasSuiteMethod(testClass))
- return true;
- if (Test.class.isAssignableFrom(testClass) &&
- Modifier.isPublic(testClass.getModifiers()) &&
- hasPublicConstructor(testClass))
- return true;
- return false;
- }
-
- boolean hasSuiteMethod(Class testClass) {
- try {
- Method suiteMethod= testClass.getMethod(BaseTestRunner.SUITE_METHODNAME, new Class[0]);
- } catch(Exception e) {
- return false;
- }
- return true;
- }
-
- boolean hasPublicConstructor(Class testClass) {
- Class[] args= { String.class };
- Constructor c= null;
- try {
- c= testClass.getConstructor(args);
- } catch(Exception e) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ReloadingTestSuiteLoader.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ReloadingTestSuiteLoader.java
deleted file mode 100644
index 6c33bfa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/ReloadingTestSuiteLoader.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package junit.runner;
-
-/**
- * A TestSuite loader that can reload classes.
- */
-public class ReloadingTestSuiteLoader implements TestSuiteLoader {
- public Class load(String suiteClassName) throws ClassNotFoundException {
- TestCaseClassLoader loader= new TestCaseClassLoader();
- return loader.loadClass(suiteClassName, true);
- }
- public Class reload(Class aClass) throws ClassNotFoundException {
- TestCaseClassLoader loader= new TestCaseClassLoader();
- return loader.loadClass(aClass.getName(), true);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/SimpleTestCollector.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/SimpleTestCollector.java
deleted file mode 100644
index 9d1956a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/SimpleTestCollector.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package junit.runner;
-
-/**
- * An implementation of a TestCollector that considers
- * a class to be a test class when it contains the
- * pattern "Test" in its name
- * @see TestCollector
- */
-public class SimpleTestCollector extends ClassPathTestCollector {
-
- public SimpleTestCollector() {
- }
-
- protected boolean isTestClass(String classFileName) {
- return
- classFileName.endsWith(".class") &&
- classFileName.indexOf('$') < 0 &&
- classFileName.indexOf("Test") > 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Sorter.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Sorter.java
deleted file mode 100644
index 3829699..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Sorter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package junit.runner;
-
-import java.util.*;
-
-import junit.framework.*;
-import junit.runner.*;
-
-/**
- * A custom quick sort with support to customize the swap behaviour.
- * NOTICE: We can't use the the sorting support from the JDK 1.2 collection
- * classes because of the JDK 1.1.7 compatibility.
- */
-public class Sorter {
- public static interface Swapper {
- public void swap(Vector values, int left, int right);
- }
-
- public static void sortStrings(Vector values , int left, int right, Swapper swapper) {
- int oleft= left;
- int oright= right;
- String mid= (String)values.elementAt((left + right) / 2);
- do {
- while (((String)(values.elementAt(left))).compareTo(mid) < 0)
- left++;
- while (mid.compareTo((String)(values.elementAt(right))) < 0)
- right--;
- if (left <= right) {
- swapper.swap(values, left, right);
- left++;
- right--;
- }
- } while (left <= right);
-
- if (oleft < right)
- sortStrings(values, oleft, right, swapper);
- if (left < oright)
- sortStrings(values, left, oright, swapper);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/StandardTestSuiteLoader.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/StandardTestSuiteLoader.java
deleted file mode 100644
index 54f29c1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/StandardTestSuiteLoader.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package junit.runner;
-
-/**
- * The standard test suite loader. It can only load the same class once.
- */
-public class StandardTestSuiteLoader implements TestSuiteLoader {
- /**
- * Uses the system class loader to load the test class
- */
- public Class load(String suiteClassName) throws ClassNotFoundException {
- return Class.forName(suiteClassName);
- }
- /**
- * Uses the system class loader to load the test class
- */
- public Class reload(Class aClass) throws ClassNotFoundException {
- return aClass;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCaseClassLoader.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCaseClassLoader.java
deleted file mode 100644
index 531d695..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCaseClassLoader.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package junit.runner;
-
-import java.util.*;
-import java.io.*;
-import java.net.URL;
-import java.util.zip.*;
-
-/**
- * A custom class loader which enables the reloading
- * of classes for each test run. The class loader
- * can be configured with a list of package paths that
- * should be excluded from loading. The loading
- * of these packages is delegated to the system class
- * loader. They will be shared across test runs.
- * <p>
- * The list of excluded package paths is specified in
- * a properties file "excluded.properties" that is located in
- * the same place as the TestCaseClassLoader class.
- * <p>
- * <b>Known limitation:</b> the TestCaseClassLoader cannot load classes
- * from jar files.
- */
-
-
-public class TestCaseClassLoader extends ClassLoader {
- /** scanned class path */
- private Vector fPathItems;
- /** default excluded paths */
- private String[] defaultExclusions= {
- "junit.framework.",
- "junit.extensions.",
- "junit.runner."
- };
- /** name of excluded properties file */
- static final String EXCLUDED_FILE= "excluded.properties";
- /** excluded paths */
- private Vector fExcluded;
-
- /**
- * Constructs a TestCaseLoader. It scans the class path
- * and the excluded package paths
- */
- public TestCaseClassLoader() {
- this(System.getProperty("java.class.path"));
- }
-
- /**
- * Constructs a TestCaseLoader. It scans the class path
- * and the excluded package paths
- */
- public TestCaseClassLoader(String classPath) {
- scanPath(classPath);
- readExcludedPackages();
- }
-
- private void scanPath(String classPath) {
- String separator= System.getProperty("path.separator");
- fPathItems= new Vector(10);
- StringTokenizer st= new StringTokenizer(classPath, separator);
- while (st.hasMoreTokens()) {
- fPathItems.addElement(st.nextToken());
- }
- }
-
- public URL getResource(String name) {
- return ClassLoader.getSystemResource(name);
- }
-
- public InputStream getResourceAsStream(String name) {
- return ClassLoader.getSystemResourceAsStream(name);
- }
-
- public boolean isExcluded(String name) {
- for (int i= 0; i < fExcluded.size(); i++) {
- if (name.startsWith((String) fExcluded.elementAt(i))) {
- return true;
- }
- }
- return false;
- }
-
- public synchronized Class loadClass(String name, boolean resolve)
- throws ClassNotFoundException {
-
- Class c= findLoadedClass(name);
- if (c != null)
- return c;
- //
- // Delegate the loading of excluded classes to the
- // standard class loader.
- //
- if (isExcluded(name)) {
- try {
- c= findSystemClass(name);
- return c;
- } catch (ClassNotFoundException e) {
- // keep searching
- }
- }
- if (c == null) {
- byte[] data= lookupClassData(name);
- if (data == null)
- throw new ClassNotFoundException();
- c= defineClass(name, data, 0, data.length);
- }
- if (resolve)
- resolveClass(c);
- return c;
- }
-
- private byte[] lookupClassData(String className) throws ClassNotFoundException {
- byte[] data= null;
- for (int i= 0; i < fPathItems.size(); i++) {
- String path= (String) fPathItems.elementAt(i);
- String fileName= className.replace('.', '/')+".class";
- if (isJar(path)) {
- data= loadJarData(path, fileName);
- } else {
- data= loadFileData(path, fileName);
- }
- if (data != null)
- return data;
- }
- throw new ClassNotFoundException(className);
- }
-
- boolean isJar(String pathEntry) {
- return pathEntry.endsWith(".jar") || pathEntry.endsWith(".zip");
- }
-
- private byte[] loadFileData(String path, String fileName) {
- File file= new File(path, fileName);
- if (file.exists()) {
- return getClassData(file);
- }
- return null;
- }
-
- private byte[] getClassData(File f) {
- try {
- FileInputStream stream= new FileInputStream(f);
- ByteArrayOutputStream out= new ByteArrayOutputStream(1000);
- byte[] b= new byte[1000];
- int n;
- while ((n= stream.read(b)) != -1)
- out.write(b, 0, n);
- stream.close();
- out.close();
- return out.toByteArray();
-
- } catch (IOException e) {
- }
- return null;
- }
-
- private byte[] loadJarData(String path, String fileName) {
- ZipFile zipFile= null;
- InputStream stream= null;
- File archive= new File(path);
- if (!archive.exists())
- return null;
- try {
- zipFile= new ZipFile(archive);
- } catch(IOException io) {
- return null;
- }
- ZipEntry entry= zipFile.getEntry(fileName);
- if (entry == null)
- return null;
- int size= (int) entry.getSize();
- try {
- stream= zipFile.getInputStream(entry);
- byte[] data= new byte[size];
- int pos= 0;
- while (pos < size) {
- int n= stream.read(data, pos, data.length - pos);
- pos += n;
- }
- zipFile.close();
- return data;
- } catch (IOException e) {
- } finally {
- try {
- if (stream != null)
- stream.close();
- } catch (IOException e) {
- }
- }
- return null;
- }
-
- private void readExcludedPackages() {
- fExcluded= new Vector(10);
- for (int i= 0; i < defaultExclusions.length; i++)
- fExcluded.addElement(defaultExclusions[i]);
-
- InputStream is= getClass().getResourceAsStream(EXCLUDED_FILE);
- if (is == null)
- return;
- Properties p= new Properties();
- try {
- p.load(is);
- }
- catch (IOException e) {
- return;
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- for (Enumeration e= p.propertyNames(); e.hasMoreElements(); ) {
- String key= (String)e.nextElement();
- if (key.startsWith("excluded.")) {
- String path= p.getProperty(key);
- path= path.trim();
- if (path.endsWith("*"))
- path= path.substring(0, path.length()-1);
- if (path.length() > 0)
- fExcluded.addElement(path);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCollector.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCollector.java
deleted file mode 100644
index 180d460..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestCollector.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package junit.runner;
-
-import java.util.*;
-
-import junit.framework.*;
-
-/**
- * Collects Test class names to be presented
- * by the TestSelector.
- * @see TestSelector
- */
-public interface TestCollector {
- /**
- * Returns an enumeration of Strings with qualified class names
- */
- public Enumeration collectTests();
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestSuiteLoader.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestSuiteLoader.java
deleted file mode 100644
index 2db589e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/TestSuiteLoader.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package junit.runner;
-
-/**
- * An interface to define how a test suite should be loaded.
- */
-public interface TestSuiteLoader {
- abstract public Class load(String suiteClassName) throws ClassNotFoundException;
- abstract public Class reload(Class aClass) throws ClassNotFoundException;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Version.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Version.java
deleted file mode 100644
index 0002080..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/runner/Version.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package junit.runner;
-
-/**
- * This class defines the current version of JUnit
- */
-public class Version {
- private Version() {
- // don't instantiate
- }
-
- public static String id() {
- return "3.7";
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/AboutDialog.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/AboutDialog.java
deleted file mode 100644
index 4d6b02c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/AboutDialog.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package junit.swingui;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import junit.runner.*;
-
-/**
- * The AboutDialog.
- */
-class AboutDialog extends JDialog {
- public AboutDialog(JFrame parent) {
- super(parent, true);
-
- setResizable(false);
- getContentPane().setLayout(new GridBagLayout());
- setSize(330, 138);
- setTitle("About");
- setLocationRelativeTo(parent);
-
- JButton button= new JButton("Close");
- button.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- dispose();
- }
- }
- );
-
- JLabel label1= new JLabel("JUnit");
- label1.setFont(new Font("dialog", Font.PLAIN, 36));
-
- JLabel label2= new JLabel("JUnit "+Version.id()+" by Kent Beck and Erich Gamma");
- label2.setFont(new Font("dialog", Font.PLAIN, 14));
-
- JLabel logo= createLogo();
-
- GridBagConstraints constraintsLabel1= new GridBagConstraints();
- constraintsLabel1.gridx = 3; constraintsLabel1.gridy = 0;
- constraintsLabel1.gridwidth = 1; constraintsLabel1.gridheight = 1;
- constraintsLabel1.anchor = GridBagConstraints.CENTER;
- getContentPane().add(label1, constraintsLabel1);
-
- GridBagConstraints constraintsLabel2= new GridBagConstraints();
- constraintsLabel2.gridx = 2; constraintsLabel2.gridy = 1;
- constraintsLabel2.gridwidth = 2; constraintsLabel2.gridheight = 1;
- constraintsLabel2.anchor = GridBagConstraints.CENTER;
- getContentPane().add(label2, constraintsLabel2);
-
- GridBagConstraints constraintsButton1= new GridBagConstraints();
- constraintsButton1.gridx = 2; constraintsButton1.gridy = 2;
- constraintsButton1.gridwidth = 2; constraintsButton1.gridheight = 1;
- constraintsButton1.anchor = GridBagConstraints.CENTER;
- constraintsButton1.insets= new Insets(8, 0, 8, 0);
- getContentPane().add(button, constraintsButton1);
-
- GridBagConstraints constraintsLogo1= new GridBagConstraints();
- constraintsLogo1.gridx = 2; constraintsLogo1.gridy = 0;
- constraintsLogo1.gridwidth = 1; constraintsLogo1.gridheight = 1;
- constraintsLogo1.anchor = GridBagConstraints.CENTER;
- getContentPane().add(logo, constraintsLogo1);
-
- addWindowListener(
- new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- dispose();
- }
- }
- );
- }
- protected JLabel createLogo() {
- Icon icon= TestRunner.getIconResource(BaseTestRunner.class, "logo.gif");
- return new JLabel(icon);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/CounterPanel.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/CounterPanel.java
deleted file mode 100644
index 2088eb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/CounterPanel.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package junit.swingui;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
-import java.awt.*;
-
-/**
- * A panel with test run counters
- */
-public class CounterPanel extends Panel {
- private JTextField fNumberOfErrors;
- private JTextField fNumberOfFailures;
- private JTextField fNumberOfRuns;
- private int fTotal;
-
- public CounterPanel() {
- super(new GridLayout(2, 3));
- add(new JLabel("Runs:"));
- add(new JLabel("Errors:"));
- add(new JLabel("Failures: "));
- fNumberOfErrors= createOutputField();
- fNumberOfFailures= createOutputField();
- fNumberOfRuns= createOutputField();
- add(fNumberOfRuns);
- add(fNumberOfErrors);
- add(fNumberOfFailures);
- }
-
- private JTextField createOutputField() {
- JTextField field= new JTextField("0", 4);
- field.setHorizontalAlignment(JTextField.LEFT);
- field.setFont(StatusLine.BOLD_FONT);
- field.setEditable(false);
- field.setBorder(BorderFactory.createEmptyBorder());
- return field;
- }
-
- public void reset() {
- setLabelValue(fNumberOfErrors, 0);
- setLabelValue(fNumberOfFailures, 0);
- setLabelValue(fNumberOfRuns, 0);
- fTotal= 0;
- }
-
- public void setTotal(int value) {
- fTotal= value;
- }
-
- public void setRunValue(int value) {
- fNumberOfRuns.setText(Integer.toString(value) + "/" + fTotal);
- }
-
- public void setErrorValue(int value) {
- setLabelValue(fNumberOfErrors, value);
- }
-
- public void setFailureValue(int value) {
- setLabelValue(fNumberOfFailures, value);
- }
-
- private String asString(int value) {
- return Integer.toString(value);
- }
-
- private void setLabelValue(JTextField label, int value) {
- label.setText(Integer.toString(value));
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/DefaultFailureDetailView.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/DefaultFailureDetailView.java
deleted file mode 100644
index 9081706..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/DefaultFailureDetailView.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package junit.swingui;
-
-import java.awt.Component;
-import javax.swing.JTextArea;
-import java.io.*;
-
-import junit.runner.*;
-import junit.framework.*;
-
-/**
- * A view that shows a stack trace of a failure
- */
-class DefaultFailureDetailView implements FailureDetailView {
- JTextArea fTextArea;
-
- /**
- * Returns the component used to present the trace
- */
- public Component getComponent() {
- if (fTextArea == null) {
- fTextArea= new JTextArea();
- fTextArea.setRows(5);
- fTextArea.setTabSize(0);
- fTextArea.setEditable(false);
- }
- return fTextArea;
- }
-
- /**
- * Shows a TestFailure
- */
- public void showFailure(TestFailure failure) {
- fTextArea.setText(BaseTestRunner.getFilteredTrace(failure.thrownException()));
- fTextArea.select(0, 0);
- }
-
- public void clear() {
- fTextArea.setText("");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/FailureRunView.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/FailureRunView.java
deleted file mode 100644
index ad954c6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/FailureRunView.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package junit.swingui;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import java.awt.Component;
-
-import junit.framework.*;
-import junit.runner.BaseTestRunner;
-
-/**
- * A view presenting the test failures as a list.
- */
-class FailureRunView implements TestRunView {
- JList fFailureList;
- TestRunContext fRunContext;
-
- /**
- * Renders TestFailures in a JList
- */
- static class FailureListCellRenderer extends DefaultListCellRenderer {
- private Icon fFailureIcon;
- private Icon fErrorIcon;
-
- FailureListCellRenderer() {
- super();
- loadIcons();
- }
-
- void loadIcons() {
- fFailureIcon= TestRunner.getIconResource(getClass(), "icons/failure.gif");
- fErrorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
- }
-
- public Component getListCellRendererComponent(
- JList list, Object value, int modelIndex,
- boolean isSelected, boolean cellHasFocus) {
-
- TestFailure failure= (TestFailure)value;
- String text= failure.failedTest().toString();
- String msg= failure.thrownException().getMessage();
- if (msg != null)
- text+= ":" + BaseTestRunner.truncate(msg);
-
- if (failure.thrownException() instanceof AssertionFailedError) {
- if (fFailureIcon != null)
- setIcon(fFailureIcon);
- } else {
- if (fErrorIcon != null)
- setIcon(fErrorIcon);
- }
- Component c= super.getListCellRendererComponent(list, text, modelIndex, isSelected, cellHasFocus);
- setText(text);
- setToolTipText(text);
- return c;
- }
- }
-
- public FailureRunView(TestRunContext context) {
- fRunContext= context;
- fFailureList= new JList(fRunContext.getFailures());
- fFailureList.setPrototypeCellValue(
- new TestFailure(new TestCase("dummy") {
- protected void runTest() {}
- },
- new AssertionFailedError("message"))
- );
- fFailureList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- fFailureList.setCellRenderer(new FailureListCellRenderer());
- fFailureList.setToolTipText("Failure - grey X; Error - red X");
- fFailureList.setVisibleRowCount(5);
-
- fFailureList.addListSelectionListener(
- new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- testSelected();
- }
- }
- );
- }
-
- public Test getSelectedTest() {
- int index= fFailureList.getSelectedIndex();
- if (index == -1)
- return null;
-
- ListModel model= fFailureList.getModel();
- TestFailure failure= (TestFailure)model.getElementAt(index);
- return failure.failedTest();
- }
-
- public void activate() {
- testSelected();
- }
-
- public void addTab(JTabbedPane pane) {
- JScrollPane sl= new JScrollPane(fFailureList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
- Icon errorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
- pane.addTab("Failures", errorIcon, sl, "The list of failed tests");
- }
-
- public void revealFailure(Test failure) {
- fFailureList.setSelectedIndex(0);
- }
-
- public void aboutToStart(Test suite, TestResult result) {
- }
-
- public void runFinished(Test suite, TestResult result) {
- }
-
- protected void testSelected() {
- fRunContext.handleTestSelected(getSelectedTest());
- }
-}
-
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/ProgressBar.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/ProgressBar.java
deleted file mode 100644
index d96f43d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/ProgressBar.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package junit.swingui;
-
-import javax.swing.*;
-import javax.swing.border.*;
-import java.awt.*;
-
-/**
- * A simple progress bar showing the green/red status
- */
-class ProgressBar extends JPanel {
- boolean fError= false;
- int fTotal= 0;
- int fProgress= 0;
- int fProgressX= 0;
-
- public ProgressBar() {
- super();
- setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
- }
-
- private Color getStatusColor() {
- if (fError)
- return Color.red;
- return Color.green;
- }
-
- public void paintBackground(Graphics g) {
- g.setColor(getBackground());
- g.fillRect(0,0,getWidth(),getHeight());
- }
-
- public void paintComponent(Graphics g) {
- paintBackground(g);
- paintStatus(g);
- }
-
- public void paintStatus(Graphics g) {
- g.setColor(getStatusColor());
- Rectangle r= new Rectangle(0, 0, fProgressX, getBounds().height);
- g.fillRect(1, 1, r.width-1, r.height-2);
- }
-
- private void paintStep(int startX, int endX) {
- repaint(startX, 1, endX-startX, getBounds().height-2);
- }
-
- public void reset() {
- fProgressX= 1;
- fProgress= 0;
- fError= false;
- repaint();
- }
-
- public int scale(int value) {
- if (fTotal > 0)
- return Math.max(1, value*(getBounds().width-1)/fTotal);
- return value;
- }
-
- public void setBounds(int x, int y, int w, int h) {
- super.setBounds(x, y, w, h);
- fProgressX= scale(fProgress);
- }
-
- public void start(int total) {
- fTotal= total;
- reset();
- }
-
- public void step(boolean successful) {
- fProgress++;
- int x= fProgressX;
-
- fProgressX= scale(fProgress);
-
- if (!fError && !successful) {
- fError= true;
- x= 1;
- }
- paintStep(x, fProgressX);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/StatusLine.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/StatusLine.java
deleted file mode 100644
index fdb201c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/StatusLine.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package junit.swingui;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
-
-/**
- * A status line component.
- */
-public class StatusLine extends JTextField {
- public static final Font PLAIN_FONT= new Font("dialog", Font.PLAIN, 12);
- public static final Font BOLD_FONT= new Font("dialog", Font.BOLD, 12);
-
- public StatusLine(int preferredWidth) {
- super();
- setFont(BOLD_FONT);
- setEditable(false);
- setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
- Dimension d= getPreferredSize();
- d.width= preferredWidth;
- setPreferredSize(d);
- }
-
- public void showInfo(String message) {
- setFont(PLAIN_FONT);
- setForeground(Color.black);
- setText(message);
- }
-
- public void showError(String status) {
- setFont(BOLD_FONT);
- setForeground(Color.red);
- setText(status);
- setToolTipText(status);
- }
-
- public void clear() {
- setText("");
- setToolTipText(null);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestHierarchyRunView.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestHierarchyRunView.java
deleted file mode 100644
index 547bf99..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestHierarchyRunView.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package junit.swingui;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.tree.TreePath;
-import java.util.Vector;
-
-import junit.framework.*;
-
-/**
- * A hierarchical view of a test run.
- * The contents of a test suite is shown
- * as a tree.
- */
-class TestHierarchyRunView implements TestRunView {
- TestSuitePanel fTreeBrowser;
- TestRunContext fTestContext;
-
- public TestHierarchyRunView(TestRunContext context) {
- fTestContext= context;
- fTreeBrowser= new TestSuitePanel();
- fTreeBrowser.getTree().addTreeSelectionListener(
- new TreeSelectionListener() {
- public void valueChanged(TreeSelectionEvent e) {
- testSelected();
- }
- }
- );
- }
-
- public void addTab(JTabbedPane pane) {
- Icon treeIcon= TestRunner.getIconResource(getClass(), "icons/hierarchy.gif");
- pane.addTab("Test Hierarchy", treeIcon, fTreeBrowser, "The test hierarchy");
- }
-
- public Test getSelectedTest() {
- return fTreeBrowser.getSelectedTest();
- }
-
- public void activate() {
- testSelected();
- }
-
- public void revealFailure(Test failure) {
- JTree tree= fTreeBrowser.getTree();
- TestTreeModel model= (TestTreeModel)tree.getModel();
- Vector vpath= new Vector();
- int index= model.findTest(failure, (Test)model.getRoot(), vpath);
- if (index >= 0) {
- Object[] path= new Object[vpath.size()+1];
- vpath.copyInto(path);
- Object last= path[vpath.size()-1];
- path[vpath.size()]= model.getChild(last, index);
- TreePath selectionPath= new TreePath(path);
- tree.setSelectionPath(selectionPath);
- tree.makeVisible(selectionPath);
- }
- }
-
- public void aboutToStart(Test suite, TestResult result) {
- fTreeBrowser.showTestTree(suite);
- result.addListener(fTreeBrowser);
- }
-
- public void runFinished(Test suite, TestResult result) {
- result.removeListener(fTreeBrowser);
- }
-
- protected void testSelected() {
- fTestContext.handleTestSelected(getSelectedTest());
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunContext.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunContext.java
deleted file mode 100644
index 038e3c4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunContext.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package junit.swingui;
-
-import javax.swing.ListModel;
-
-import junit.framework.Test;
-
-/**
- * The interface for accessing the Test run context. Test run views
- * should use this interface rather than accessing the TestRunner
- * directly.
- */
-public interface TestRunContext {
- /**
- * Handles the selection of a Test.
- */
- public void handleTestSelected(Test test);
- /**
- * Returns the failure model
- */
- public ListModel getFailures();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunView.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunView.java
deleted file mode 100644
index dfe7048..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunView.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package junit.swingui;
-
-import javax.swing.*;
-
-import junit.framework.*;
-
-/**
- * A TestRunView is shown as a page in a tabbed folder.
- * It contributes the page contents and can return
- * the currently selected tests. A TestRunView is
- * notified about the start and finish of a run.
- */
-interface TestRunView {
- /**
- * Returns the currently selected Test in the View
- */
- public Test getSelectedTest();
- /**
- * Activates the TestRunView
- */
- public void activate();
- /**
- * Reveals the given failure
- */
- public void revealFailure(Test failure);
- /**
- * Adds the TestRunView to the test run views tab
- */
- public void addTab(JTabbedPane pane);
- /**
- * Informs that the suite is about to start
- */
- public void aboutToStart(Test suite, TestResult result);
- /**
- * Informs that the run of the test suite has finished
- */
- public void runFinished(Test suite, TestResult result);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunner.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunner.java
deleted file mode 100644
index e79b51b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestRunner.java
+++ /dev/null
@@ -1,807 +0,0 @@
-package junit.swingui;
-
-import junit.framework.*;
-import junit.runner.*;
-
-import java.util.*;
-import java.lang.reflect.*;
-import java.text.NumberFormat;
-import java.net.URL;
-import java.io.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.text.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-
-/**
- * A Swing based user interface to run tests.
- * Enter the name of a class which either provides a static
- * suite method or is a subclass of TestCase.
- * <pre>
- * Synopsis: java junit.swingui.TestRunner [-noloading] [TestCase]
- * </pre>
- * TestRunner takes as an optional argument the name of the testcase class to be run.
- */
-public class TestRunner extends BaseTestRunner implements TestRunContext {
- protected JFrame fFrame;
- private Thread fRunner;
- private TestResult fTestResult;
-
- private JComboBox fSuiteCombo;
- private ProgressBar fProgressIndicator;
- private DefaultListModel fFailures;
- private JLabel fLogo;
- private CounterPanel fCounterPanel;
- private JButton fRun;
- private JButton fQuitButton;
- private JButton fRerunButton;
- private StatusLine fStatusLine;
- private FailureDetailView fFailureView;
- private JTabbedPane fTestViewTab;
- private JCheckBox fUseLoadingRunner;
- private Vector fTestRunViews= new Vector(); // view associated with tab in tabbed pane
- private static Font PLAIN_FONT= StatusLine.PLAIN_FONT;
- private static Font BOLD_FONT= StatusLine.BOLD_FONT;
- private static final int GAP= 4;
- private static final int HISTORY_LENGTH= 5;
-
- private static final String TESTCOLLECTOR_KEY= "TestCollectorClass";
- private static final String FAILUREDETAILVIEW_KEY= "FailureViewClass";
-
- public TestRunner() {
- }
-
- public static void main(String[] args) {
- new TestRunner().start(args);
- }
-
- public static void run(Class test) {
- String args[]= { test.getName() };
- main(args);
- }
-
- public void addError(final Test test, final Throwable t) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- fCounterPanel.setErrorValue(fTestResult.errorCount());
- appendFailure("Error", test, t);
- }
- }
- );
- }
-
- public void addFailure(final Test test, final AssertionFailedError t) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- fCounterPanel.setFailureValue(fTestResult.failureCount());
- appendFailure("Failure", test, t);
- }
- }
- );
- }
-
- public void startTest(Test test) {
- postInfo("Running: "+test);
- }
-
- public void endTest(Test test) {
- postEndTest(test);
- }
-
- private void postEndTest(final Test test) {
- synchUI();
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- if (fTestResult != null) {
- fCounterPanel.setRunValue(fTestResult.runCount());
- fProgressIndicator.step(fTestResult.wasSuccessful());
- }
- }
- }
- );
- }
-
- public void setSuite(String suiteName) {
- fSuiteCombo.getEditor().setItem(suiteName);
- }
-
- private void addToHistory(final String suite) {
- for (int i= 0; i < fSuiteCombo.getItemCount(); i++) {
- if (suite.equals(fSuiteCombo.getItemAt(i))) {
- fSuiteCombo.removeItemAt(i);
- fSuiteCombo.insertItemAt(suite, 0);
- fSuiteCombo.setSelectedIndex(0);
- return;
- }
- }
- fSuiteCombo.insertItemAt(suite, 0);
- fSuiteCombo.setSelectedIndex(0);
- pruneHistory();
- }
-
- private void pruneHistory() {
- int historyLength= getPreference("maxhistory", HISTORY_LENGTH);
- if (historyLength < 1)
- historyLength= 1;
- for (int i= fSuiteCombo.getItemCount()-1; i > historyLength-1; i--)
- fSuiteCombo.removeItemAt(i);
- }
-
- private void appendFailure(String kind, Test test, Throwable t) {
- fFailures.addElement(new TestFailure(test, t));
- if (fFailures.size() == 1)
- revealFailure(test);
- }
-
- private void revealFailure(Test test) {
- for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements(); ) {
- TestRunView v= (TestRunView) e.nextElement();
- v.revealFailure(test);
- }
- }
-
- protected void aboutToStart(final Test testSuite) {
- for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements(); ) {
- TestRunView v= (TestRunView) e.nextElement();
- v.aboutToStart(testSuite, fTestResult);
- }
- }
-
- protected void runFinished(final Test testSuite) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements(); ) {
- TestRunView v= (TestRunView) e.nextElement();
- v.runFinished(testSuite, fTestResult);
- }
- }
- }
- );
- }
-
- protected CounterPanel createCounterPanel() {
- return new CounterPanel();
- }
-
- protected JPanel createFailedPanel() {
- JPanel failedPanel= new JPanel(new GridLayout(0, 1, 0, 2));
- fRerunButton= new JButton("Run");
- fRerunButton.setEnabled(false);
- fRerunButton.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- rerun();
- }
- }
- );
- failedPanel.add(fRerunButton);
- return failedPanel;
- }
-
- protected FailureDetailView createFailureDetailView() {
- String className= BaseTestRunner.getPreference(FAILUREDETAILVIEW_KEY);
- if (className != null) {
- Class viewClass= null;
- try {
- viewClass= Class.forName(className);
- return (FailureDetailView)viewClass.newInstance();
- } catch(Exception e) {
- JOptionPane.showMessageDialog(fFrame, "Could not create Failure DetailView - using default view");
- }
- }
- return new DefaultFailureDetailView();
- }
-
- /**
- * Creates the JUnit menu. Clients override this
- * method to add additional menu items.
- */
- protected JMenu createJUnitMenu() {
- JMenu menu= new JMenu("JUnit");
- menu.setMnemonic('J');
- JMenuItem mi1= new JMenuItem("About...");
- mi1.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- about();
- }
- }
- );
- mi1.setMnemonic('A');
- menu.add(mi1);
-
- menu.addSeparator();
- JMenuItem mi2= new JMenuItem(" Exit ");
- mi2.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- terminate();
- }
- }
- );
- mi2.setMnemonic('x');
- menu.add(mi2);
-
- return menu;
- }
-
- protected JFrame createFrame(String title) {
- JFrame frame= new JFrame("JUnit");
- Image icon= loadFrameIcon();
- if (icon != null)
- frame.setIconImage(icon);
- frame.getContentPane().setLayout(new BorderLayout(0, 0));
-
- frame.addWindowListener(
- new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- terminate();
- }
- }
- );
- return frame;
- }
-
- protected JLabel createLogo() {
- JLabel label;
- Icon icon= getIconResource(BaseTestRunner.class, "logo.gif");
- if (icon != null)
- label= new JLabel(icon);
- else
- label= new JLabel("JV");
- label.setToolTipText("JUnit Version "+Version.id());
- return label;
- }
-
- protected void createMenus(JMenuBar mb) {
- mb.add(createJUnitMenu());
- }
-
- protected JCheckBox createUseLoaderCheckBox() {
- boolean useLoader= useReloadingTestSuiteLoader();
- JCheckBox box= new JCheckBox("Reload classes every run", useLoader);
- box.setToolTipText("Use a custom class loader to reload the classes for every run");
- if (inVAJava())
- box.setVisible(false);
- return box;
- }
-
- protected JButton createQuitButton() {
- // spaces required to avoid layout flicker
- // Exit is shorter than Stop that shows in the same column
- JButton quit= new JButton(" Exit ");
- quit.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- terminate();
- }
- }
- );
- return quit;
- }
-
- protected JButton createRunButton() {
- JButton run= new JButton("Run");
- run.setEnabled(true);
- run.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- runSuite();
- }
- }
- );
- return run;
- }
-
- protected Component createBrowseButton() {
- JButton browse= new JButton("...");
- browse.setToolTipText("Select a Test class");
- browse.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- browseTestClasses();
- }
- }
- );
- return browse;
- }
-
- protected StatusLine createStatusLine() {
- return new StatusLine(420);
- }
-
- protected JComboBox createSuiteCombo() {
- JComboBox combo= new JComboBox();
- combo.setEditable(true);
- combo.setLightWeightPopupEnabled(false);
-
- combo.getEditor().getEditorComponent().addKeyListener(
- new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- textChanged();
- if (e.getKeyChar() == KeyEvent.VK_ENTER)
- runSuite();
- }
- }
- );
- try {
- loadHistory(combo);
- } catch (IOException e) {
- // fails the first time
- }
- combo.addItemListener(
- new ItemListener() {
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == ItemEvent.SELECTED) {
- textChanged();
- }
- }
- }
- );
- return combo;
- }
-
- protected JTabbedPane createTestRunViews() {
- JTabbedPane pane= new JTabbedPane(JTabbedPane.BOTTOM);
-
- FailureRunView lv= new FailureRunView(this);
- fTestRunViews.addElement(lv);
- lv.addTab(pane);
-
- TestHierarchyRunView tv= new TestHierarchyRunView(this);
- fTestRunViews.addElement(tv);
- tv.addTab(pane);
-
- pane.addChangeListener(
- new ChangeListener() {
- public void stateChanged(ChangeEvent e) {
- testViewChanged();
- }
- }
- );
- return pane;
- }
-
- public void testViewChanged() {
- TestRunView view= (TestRunView)fTestRunViews.elementAt(fTestViewTab.getSelectedIndex());
- view.activate();
- }
-
- protected TestResult createTestResult() {
- return new TestResult();
- }
-
- protected JFrame createUI(String suiteName) {
- JFrame frame= createFrame("JUnit");
- JMenuBar mb= new JMenuBar();
- createMenus(mb);
- frame.setJMenuBar(mb);
-
- JLabel suiteLabel= new JLabel("Test class name:");
- fSuiteCombo= createSuiteCombo();
- fRun= createRunButton();
- frame.getRootPane().setDefaultButton(fRun);
- Component browseButton= createBrowseButton();
-
- fUseLoadingRunner= createUseLoaderCheckBox();
- fProgressIndicator= new ProgressBar();
- fCounterPanel= createCounterPanel();
-
- JLabel failureLabel= new JLabel("Errors and Failures:");
- fFailures= new DefaultListModel();
-
- fTestViewTab= createTestRunViews();
- JPanel failedPanel= createFailedPanel();
-
- fFailureView= createFailureDetailView();
- JScrollPane tracePane= new JScrollPane(fFailureView.getComponent(), JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
-
- fStatusLine= createStatusLine();
- fQuitButton= createQuitButton();
- fLogo= createLogo();
-
- JPanel panel= new JPanel(new GridBagLayout());
-
- addGrid(panel, suiteLabel, 0, 0, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fSuiteCombo, 0, 1, 1, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, browseButton, 1, 1, 1, GridBagConstraints.NONE, 0.0, GridBagConstraints.WEST);
- addGrid(panel, fRun, 2, 1, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
-
- addGrid(panel, fUseLoadingRunner, 0, 2, 3, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, new JSeparator(), 0, 3, 3, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
-
-
- addGrid(panel, fProgressIndicator, 0, 4, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fLogo, 2, 4, 1, GridBagConstraints.NONE, 0.0, GridBagConstraints.NORTH);
-
- addGrid(panel, fCounterPanel, 0, 5, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.CENTER);
-
- JSplitPane splitter= new JSplitPane(JSplitPane.VERTICAL_SPLIT, fTestViewTab, tracePane);
- addGrid(panel, splitter, 0, 6, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);
-
- addGrid(panel, failedPanel, 2, 6, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.NORTH/*CENTER*/);
-
- addGrid(panel, fStatusLine, 0, 8, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.CENTER);
- addGrid(panel, fQuitButton, 2, 8, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
-
- frame.setContentPane(panel);
- frame.pack();
- frame.setLocation(200, 200);
- return frame;
- }
-
- private void addGrid(JPanel p, Component co, int x, int y, int w, int fill, double wx, int anchor) {
- GridBagConstraints c= new GridBagConstraints();
- c.gridx= x; c.gridy= y;
- c.gridwidth= w;
- c.anchor= anchor;
- c.weightx= wx;
- c.fill= fill;
- if (fill == GridBagConstraints.BOTH || fill == GridBagConstraints.VERTICAL)
- c.weighty= 1.0;
- c.insets= new Insets(y == 0 ? GAP : 0, x == 0 ? GAP : 0, GAP, GAP);
- p.add(co, c);
- }
-
- protected String getSuiteText() {
- if (fSuiteCombo == null)
- return "";
- return (String)fSuiteCombo.getEditor().getItem();
- }
-
- public ListModel getFailures() {
- return fFailures;
- }
-
- public void insertUpdate(DocumentEvent event) {
- textChanged();
- }
-
- public void browseTestClasses() {
- TestCollector collector= createTestCollector();
- TestSelector selector= new TestSelector(fFrame, collector);
- if (selector.isEmpty()) {
- JOptionPane.showMessageDialog(fFrame, "No Test Cases found.\nCheck that the configured \'TestCollector\' is supported on this platform.");
- return;
- }
- selector.show();
- String className= selector.getSelectedItem();
- if (className != null)
- setSuite(className);
- }
-
- TestCollector createTestCollector() {
- String className= BaseTestRunner.getPreference(TESTCOLLECTOR_KEY);
- if (className != null) {
- Class collectorClass= null;
- try {
- collectorClass= Class.forName(className);
- return (TestCollector)collectorClass.newInstance();
- } catch(Exception e) {
- JOptionPane.showMessageDialog(fFrame, "Could not create TestCollector - using default collector");
- }
- }
- return new SimpleTestCollector();
- }
-
- private Image loadFrameIcon() {
- ImageIcon icon= (ImageIcon)getIconResource(BaseTestRunner.class, "smalllogo.gif");
- if (icon != null)
- return icon.getImage();
- return null;
- }
-
- private void loadHistory(JComboBox combo) throws IOException {
- BufferedReader br= new BufferedReader(new FileReader(getSettingsFile()));
- int itemCount= 0;
- try {
- String line;
- while ((line= br.readLine()) != null) {
- combo.addItem(line);
- itemCount++;
- }
- if (itemCount > 0)
- combo.setSelectedIndex(0);
-
- } finally {
- br.close();
- }
- }
-
- private File getSettingsFile() {
- String home= System.getProperty("user.home");
- return new File(home,".junitsession");
- }
-
- private void postInfo(final String message) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- showInfo(message);
- }
- }
- );
- }
-
- private void postStatus(final String status) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- showStatus(status);
- }
- }
- );
- }
-
- public void removeUpdate(DocumentEvent event) {
- textChanged();
- }
-
- private void rerun() {
- TestRunView view= (TestRunView)fTestRunViews.elementAt(fTestViewTab.getSelectedIndex());
- Test rerunTest= view.getSelectedTest();
- if (rerunTest != null)
- rerunTest(rerunTest);
- }
-
- private void rerunTest(Test test) {
- if (!(test instanceof TestCase)) {
- showInfo("Could not reload "+ test.toString());
- return;
- }
- Test reloadedTest= null;
- try {
- Class reloadedTestClass= getLoader().reload(test.getClass());
- Class[] classArgs= { String.class };
- Object[] args= new Object[]{((TestCase)test).getName()};
- Constructor constructor= reloadedTestClass.getConstructor(classArgs);
- reloadedTest=(Test)constructor.newInstance(args);
- } catch(Exception e) {
- showInfo("Could not reload "+ test.toString());
- return;
- }
- TestResult result= new TestResult();
- reloadedTest.run(result);
-
- String message= reloadedTest.toString();
- if(result.wasSuccessful())
- showInfo(message+" was successful");
- else if (result.errorCount() == 1)
- showStatus(message+" had an error");
- else
- showStatus(message+" had a failure");
- }
-
- protected void reset() {
- fCounterPanel.reset();
- fProgressIndicator.reset();
- fRerunButton.setEnabled(false);
- fFailureView.clear();
- fFailures.clear();
- }
-
- /**
- * runs a suite.
- * @deprecated use runSuite() instead
- */
- public void run() {
- runSuite();
- }
-
- protected void runFailed(String message) {
- showStatus(message);
- fRun.setText("Run");
- fRunner= null;
- }
-
- synchronized public void runSuite() {
- if (fRunner != null) {
- fTestResult.stop();
- } else {
- setLoading(shouldReload());
- reset();
- showInfo("Load Test Case...");
- final String suiteName= getSuiteText();
- final Test testSuite= getTest(suiteName);
- if (testSuite != null) {
- addToHistory(suiteName);
- doRunTest(testSuite);
- }
- }
- }
-
- private boolean shouldReload() {
- return !inVAJava() && fUseLoadingRunner.isSelected();
- }
-
-
- synchronized protected void runTest(final Test testSuite) {
- if (fRunner != null) {
- fTestResult.stop();
- } else {
- reset();
- if (testSuite != null) {
- doRunTest(testSuite);
- }
- }
- }
-
- private void doRunTest(final Test testSuite) {
- setButtonLabel(fRun, "Stop");
- fRunner= new Thread("TestRunner-Thread") {
- public void run() {
- TestRunner.this.start(testSuite);
- postInfo("Running...");
-
- long startTime= System.currentTimeMillis();
- testSuite.run(fTestResult);
-
- if (fTestResult.shouldStop()) {
- postStatus("Stopped");
- } else {
- long endTime= System.currentTimeMillis();
- long runTime= endTime-startTime;
- postInfo("Finished: " + elapsedTimeAsString(runTime) + " seconds");
- }
- runFinished(testSuite);
- setButtonLabel(fRun, "Run");
- fRunner= null;
- System.gc();
- }
- };
- // make sure that the test result is created before we start the
- // test runner thread so that listeners can register for it.
- fTestResult= createTestResult();
- fTestResult.addListener(TestRunner.this);
- aboutToStart(testSuite);
-
- fRunner.start();
- }
-
- private void saveHistory() throws IOException {
- BufferedWriter bw= new BufferedWriter(new FileWriter(getSettingsFile()));
- try {
- for (int i= 0; i < fSuiteCombo.getItemCount(); i++) {
- String testsuite= fSuiteCombo.getItemAt(i).toString();
- bw.write(testsuite, 0, testsuite.length());
- bw.newLine();
- }
- } finally {
- bw.close();
- }
- }
-
- private void setButtonLabel(final JButton button, final String label) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- button.setText(label);
- }
- }
- );
- }
-
- private void setLabelValue(final JTextField label, final int value) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- label.setText(Integer.toString(value));
- }
- }
- );
- }
-
- public void handleTestSelected(Test test) {
- fRerunButton.setEnabled(test != null && (test instanceof TestCase));
- showFailureDetail(test);
- }
-
- private void showFailureDetail(Test test) {
- if (test != null) {
- ListModel failures= getFailures();
- for (int i= 0; i < failures.getSize(); i++) {
- TestFailure failure= (TestFailure)failures.getElementAt(i);
- if (failure.failedTest() == test) {
- fFailureView.showFailure(failure);
- return;
- }
- }
- }
- fFailureView.clear();
- }
-
- private void showInfo(String message) {
- fStatusLine.showInfo(message);
- }
-
- private void showStatus(String status) {
- fStatusLine.showError(status);
- }
-
- /**
- * Starts the TestRunner
- */
- public void start(String[] args) {
- String suiteName= processArguments(args);
- fFrame= createUI(suiteName);
- fFrame.pack();
- fFrame.setVisible(true);
-
- if (suiteName != null) {
- setSuite(suiteName);
- runSuite();
- }
- }
-
- private void start(final Test test) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- int total= test.countTestCases();
- fProgressIndicator.start(total);
- fCounterPanel.setTotal(total);
- }
- }
- );
- }
-
- /**
- * Wait until all the events are processed in the event thread
- */
- private void synchUI() {
- try {
- SwingUtilities.invokeAndWait(
- new Runnable() {
- public void run() {}
- }
- );
- }
- catch (Exception e) {
- }
- }
-
- /**
- * Terminates the TestRunner
- */
- public void terminate() {
- fFrame.dispose();
- try {
- saveHistory();
- } catch (IOException e) {
- System.out.println("Couldn't save test run history");
- }
- System.exit(0);
- }
-
- public void textChanged() {
- fRun.setEnabled(getSuiteText().length() > 0);
- clearStatus();
- }
-
- protected void clearStatus() {
- fStatusLine.clear();
- }
-
- public static Icon getIconResource(Class clazz, String name) {
- URL url= clazz.getResource(name);
- if (url == null) {
- System.err.println("Warning: could not load \""+name+"\" icon");
- return null;
- }
- return new ImageIcon(url);
- }
-
- private void about() {
- AboutDialog about= new AboutDialog(fFrame);
- about.show();
- }
-
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSelector.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSelector.java
deleted file mode 100644
index 27adde4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSelector.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package junit.swingui;
-
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import junit.framework.*;
-import junit.runner.*;
-
-/**
- * A test class selector. A simple dialog to pick the name of a test suite.
- */
-class TestSelector extends JDialog {
- private JButton fCancel;
- private JButton fOk;
- private JList fList;
- private JScrollPane fScrolledList;
- private JLabel fDescription;
- private String fSelectedItem;
-
- /**
- * Renders TestFailures in a JList
- */
- static class TestCellRenderer extends DefaultListCellRenderer {
- Icon fLeafIcon;
- Icon fSuiteIcon;
-
- public TestCellRenderer() {
- fLeafIcon= UIManager.getIcon("Tree.leafIcon");
- fSuiteIcon= UIManager.getIcon("Tree.closedIcon");
- }
-
- public Component getListCellRendererComponent(
- JList list, Object value, int modelIndex,
- boolean isSelected, boolean cellHasFocus) {
- Component c= super.getListCellRendererComponent(list, value, modelIndex, isSelected, cellHasFocus);
- String displayString= displayString((String)value);
-
- if (displayString.startsWith("AllTests"))
- setIcon(fSuiteIcon);
- else
- setIcon(fLeafIcon);
-
- setText(displayString);
- return c;
- }
-
- public static String displayString(String className) {
- int typeIndex= className.lastIndexOf('.');
- if (typeIndex < 0)
- return className;
- return className.substring(typeIndex+1) + " - " + className.substring(0, typeIndex);
- }
-
- public static boolean matchesKey(String s, char ch) {
- return ch == Character.toUpperCase(s.charAt(typeIndex(s)));
- }
-
- private static int typeIndex(String s) {
- int typeIndex= s.lastIndexOf('.');
- int i= 0;
- if (typeIndex > 0)
- i= typeIndex+1;
- return i;
- }
- }
-
- protected class DoubleClickListener extends MouseAdapter {
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- okSelected();
- }
- }
- }
-
- protected class KeySelectListener extends KeyAdapter {
- public void keyTyped(KeyEvent e) {
- keySelectTestClass(e.getKeyChar());
- }
- }
-
- public TestSelector(Frame parent, TestCollector testCollector) {
- super(parent, true);
- setSize(350, 300);
- setResizable(false);
- setLocationRelativeTo(parent);
- setTitle("Test Selector");
-
- Vector list= null;
- try {
- parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- list= createTestList(testCollector);
- } finally {
- parent.setCursor(Cursor.getDefaultCursor());
- }
- fList= new JList(list);
- fList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- fList.setCellRenderer(new TestCellRenderer());
- fScrolledList= new JScrollPane(fList);
-
- fCancel= new JButton("Cancel");
- fDescription= new JLabel("Select the Test class:");
- fOk= new JButton("OK");
- fOk.setEnabled(false);
- getRootPane().setDefaultButton(fOk);
-
- defineLayout();
- addListeners();
- }
-
- private void addListeners() {
- fCancel.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- dispose();
- }
- }
- );
-
- fOk.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okSelected();
- }
- }
- );
-
- fList.addMouseListener(new DoubleClickListener());
- fList.addKeyListener(new KeySelectListener());
- fList.addListSelectionListener(
- new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- checkEnableOK(e);
- }
- }
- );
-
- addWindowListener(
- new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- dispose();
- }
- }
- );
- }
-
- private void defineLayout() {
- getContentPane().setLayout(new GridBagLayout());
- GridBagConstraints labelConstraints = new GridBagConstraints();
- labelConstraints.gridx= 0; labelConstraints.gridy= 0;
- labelConstraints.gridwidth= 1; labelConstraints.gridheight= 1;
- labelConstraints.fill= GridBagConstraints.BOTH;
- labelConstraints.anchor= GridBagConstraints.WEST;
- labelConstraints.weightx= 1.0;
- labelConstraints.weighty= 0.0;
- labelConstraints.insets= new Insets(8, 8, 0, 8);
- getContentPane().add(fDescription, labelConstraints);
-
- GridBagConstraints listConstraints = new GridBagConstraints();
- listConstraints.gridx= 0; listConstraints.gridy= 1;
- listConstraints.gridwidth= 4; listConstraints.gridheight= 1;
- listConstraints.fill= GridBagConstraints.BOTH;
- listConstraints.anchor= GridBagConstraints.CENTER;
- listConstraints.weightx= 1.0;
- listConstraints.weighty= 1.0;
- listConstraints.insets= new Insets(8, 8, 8, 8);
- getContentPane().add(fScrolledList, listConstraints);
-
- GridBagConstraints okConstraints= new GridBagConstraints();
- okConstraints.gridx= 2; okConstraints.gridy= 2;
- okConstraints.gridwidth= 1; okConstraints.gridheight= 1;
- okConstraints.anchor= java.awt.GridBagConstraints.EAST;
- okConstraints.insets= new Insets(0, 8, 8, 8);
- getContentPane().add(fOk, okConstraints);
-
-
- GridBagConstraints cancelConstraints = new GridBagConstraints();
- cancelConstraints.gridx= 3; cancelConstraints.gridy= 2;
- cancelConstraints.gridwidth= 1; cancelConstraints.gridheight= 1;
- cancelConstraints.anchor= java.awt.GridBagConstraints.EAST;
- cancelConstraints.insets= new Insets(0, 8, 8, 8);
- getContentPane().add(fCancel, cancelConstraints);
- }
-
- public void checkEnableOK(ListSelectionEvent e) {
- fOk.setEnabled(fList.getSelectedIndex() != -1);
- }
-
- public void okSelected() {
- fSelectedItem= (String)fList.getSelectedValue();
- dispose();
- }
-
- public boolean isEmpty() {
- return fList.getModel().getSize() == 0;
- }
-
- public void keySelectTestClass(char ch) {
- ListModel model= fList.getModel();
- if (!Character.isJavaIdentifierStart(ch))
- return;
- for (int i= 0; i < model.getSize(); i++) {
- String s= (String)model.getElementAt(i);
- if (TestCellRenderer.matchesKey(s, Character.toUpperCase(ch))) {
- fList.setSelectedIndex(i);
- fList.ensureIndexIsVisible(i);
- return;
- }
- }
- Toolkit.getDefaultToolkit().beep();
- }
-
- public String getSelectedItem() {
- return fSelectedItem;
- }
-
- private Vector createTestList(TestCollector collector) {
- Enumeration each= collector.collectTests();
- Vector v= new Vector(200);
- Vector displayVector= new Vector(v.size());
- while(each.hasMoreElements()) {
- String s= (String)each.nextElement();
- v.addElement(s);
- displayVector.addElement(TestCellRenderer.displayString(s));
- }
- if (v.size() > 0)
- Sorter.sortStrings(displayVector, 0, displayVector.size()-1, new ParallelSwapper(v));
- return v;
- }
-
- private class ParallelSwapper implements Sorter.Swapper {
- Vector fOther;
-
- ParallelSwapper(Vector other) {
- fOther= other;
- }
- public void swap(Vector values, int left, int right) {
- Object tmp= values.elementAt(left);
- values.setElementAt(values.elementAt(right), left);
- values.setElementAt(tmp, right);
- Object tmp2= fOther.elementAt(left);
- fOther.setElementAt(fOther.elementAt(right), left);
- fOther.setElementAt(tmp2, right);
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSuitePanel.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSuitePanel.java
deleted file mode 100644
index 0818bc3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestSuitePanel.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package junit.swingui;
-
-import java.util.Vector;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.tree.*;
-
-import junit.framework.*;
-import junit.runner.*;
-
-/**
- * A Panel showing a test suite as a tree.
- */
-class TestSuitePanel extends JPanel implements TestListener {
- private JTree fTree;
- private JScrollPane fScrollTree;
- private TestTreeModel fModel;
-
- static class TestTreeCellRenderer extends DefaultTreeCellRenderer {
- private Icon fErrorIcon;
- private Icon fOkIcon;
- private Icon fFailureIcon;
-
- TestTreeCellRenderer() {
- super();
- loadIcons();
- }
-
- void loadIcons() {
- fErrorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
- fOkIcon= TestRunner.getIconResource(getClass(), "icons/ok.gif");
- fFailureIcon= TestRunner.getIconResource(getClass(), "icons/failure.gif");
- }
-
- String stripParenthesis(Object o) {
- String text= o.toString ();
- int pos= text.indexOf('(');
- if (pos < 1)
- return text;
- return text.substring (0, pos);
- }
-
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
-
- Component c= super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
- TreeModel model= tree.getModel();
- if (model instanceof TestTreeModel) {
- TestTreeModel testModel= (TestTreeModel)model;
- Test t= (Test)value;
- String s= "";
- if (testModel.isFailure(t)) {
- if (fFailureIcon != null)
- setIcon(fFailureIcon);
- s= " - Failed";
- }
- else if (testModel.isError(t)) {
- if (fErrorIcon != null)
- setIcon(fErrorIcon);
- s= " - Error";
- }
- else if (testModel.wasRun(t)) {
- if (fOkIcon != null)
- setIcon(fOkIcon);
- s= " - Passed";
- }
- if (c instanceof JComponent)
- ((JComponent)c).setToolTipText(getText()+s);
- }
- setText(stripParenthesis(value));
- return c;
- }
- }
-
- public TestSuitePanel() {
- super(new BorderLayout());
- setPreferredSize(new Dimension(300, 100));
- fTree= new JTree();
- fTree.setModel(null);
- fTree.setRowHeight(20);
- ToolTipManager.sharedInstance().registerComponent(fTree);
- fTree.putClientProperty("JTree.lineStyle", "Angled");
- fScrollTree= new JScrollPane(fTree);
- add(fScrollTree, BorderLayout.CENTER);
- }
-
- public void addError(final Test test, final Throwable t) {
- fModel.addError(test);
- fireTestChanged(test, true);
- }
-
- public void addFailure(final Test test, final AssertionFailedError t) {
- fModel.addFailure(test);
- fireTestChanged(test, true);
- }
-
- /**
- * A test ended.
- */
- public void endTest(Test test) {
- fModel.addRunTest(test);
- fireTestChanged(test, false);
- }
-
- /**
- * A test started.
- */
- public void startTest(Test test) {
- }
-
- /**
- * Returns the selected test or null if multiple or none is selected
- */
- public Test getSelectedTest() {
- TreePath[] paths= fTree.getSelectionPaths();
- if (paths != null && paths.length == 1)
- return (Test)paths[0].getLastPathComponent();
- return null;
- }
-
- /**
- * Returns the Tree
- */
- public JTree getTree() {
- return fTree;
- }
-
- /**
- * Shows the test hierarchy starting at the given test
- */
- public void showTestTree(Test root) {
- fModel= new TestTreeModel(root);
- fTree.setModel(fModel);
- fTree.setCellRenderer(new TestTreeCellRenderer());
- }
-
- private void fireTestChanged(final Test test, final boolean expand) {
- SwingUtilities.invokeLater(
- new Runnable() {
- public void run() {
- Vector vpath= new Vector();
- int index= fModel.findTest(test, (Test)fModel.getRoot(), vpath);
- if (index >= 0) {
- Object[] path= new Object[vpath.size()];
- vpath.copyInto(path);
- TreePath treePath= new TreePath(path);
- fModel.fireNodeChanged(treePath, index);
- if (expand) {
- Object[] fullPath= new Object[vpath.size()+1];
- vpath.copyInto(fullPath);
- fullPath[vpath.size()]= fModel.getChild(treePath.getLastPathComponent(), index);;
- TreePath fullTreePath= new TreePath(fullPath);
- fTree.scrollPathToVisible(fullTreePath);
- }
- }
- }
- }
- );
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestTreeModel.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestTreeModel.java
deleted file mode 100644
index d0c8504..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/swingui/TestTreeModel.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package junit.swingui;
-
-import java.util.*;
-import javax.swing.event.*;
-import javax.swing.tree.*;
-
-import junit.extensions.*;
-import junit.framework.*;
-
-/**
- * A tree model for a Test.
- */
-class TestTreeModel implements TreeModel {
- private Test fRoot;
- private Vector fModelListeners= new Vector();
- private Hashtable fFailures= new Hashtable();
- private Hashtable fErrors= new Hashtable();
- private Hashtable fRunTests= new Hashtable();
-
- /**
- * Constructs a tree model with the given test as its root.
- */
- public TestTreeModel(Test root) {
- super();
- fRoot= root;
- }
-
- /**
- * adds a TreeModelListener
- */
- public void addTreeModelListener(TreeModelListener l) {
- if (!fModelListeners.contains(l))
- fModelListeners.addElement(l);
- }
- /**
- * Removes a TestModelListener
- */
- public void removeTreeModelListener(TreeModelListener l) {
- fModelListeners.removeElement(l);
- }
- /**
- * Finds the path to a test. Returns the index of the test in its
- * parent test suite.
- */
- public int findTest(Test target, Test node, Vector path) {
- if (target.equals(node))
- return 0;
-
- TestSuite suite= isTestSuite(node);
- for (int i= 0; i < getChildCount(node); i++) {
- Test t= suite.testAt(i);
- int index= findTest(target, t, path);
- if (index >= 0) {
- path.insertElementAt(node, 0);
- if (path.size() == 1)
- return i;
- return index;
- }
- }
- return -1;
- }
- /**
- * Fires a node changed event
- */
- public void fireNodeChanged(TreePath path, int index) {
- int[] indices= {index};
- Object[] changedChildren= {getChild(path.getLastPathComponent(), index)};
- TreeModelEvent event= new TreeModelEvent(this, path, indices, changedChildren);
-
- Enumeration e= fModelListeners.elements();
- while (e.hasMoreElements()) {
- TreeModelListener l= (TreeModelListener) e.nextElement();
- l.treeNodesChanged(event);
- }
- }
- /**
- * Gets the test at the given index
- */
- public Object getChild(Object parent, int index) {
- TestSuite suite= isTestSuite(parent);
- if (suite != null)
- return suite.testAt(index);
- return null;
- }
- /**
- * Gets the number of tests.
- */
- public int getChildCount(Object parent) {
- TestSuite suite= isTestSuite(parent);
- if (suite != null)
- return suite.testCount();
- return 0;
- }
- /**
- * Gets the index of a test in a test suite
- */
- public int getIndexOfChild(Object parent, Object child) {
- TestSuite suite= isTestSuite(parent);
- if (suite != null) {
- int i= 0;
- for (Enumeration e= suite.tests(); e.hasMoreElements(); i++) {
- if (child.equals((Test)e.nextElement()))
- return i;
- }
- }
- return -1;
- }
- /**
- * Returns the root of the tree
- */
- public Object getRoot() {
- return fRoot;
- }
- /**
- * Tests if the test is a leaf.
- */
- public boolean isLeaf(Object node) {
- return isTestSuite(node) == null;
- }
- /**
- * Tests if the node is a TestSuite.
- */
- TestSuite isTestSuite(Object node) {
- if (node instanceof TestSuite)
- return (TestSuite)node;
- if (node instanceof TestDecorator) {
- Test baseTest= ((TestDecorator)node).getTest();
- return isTestSuite(baseTest);
- }
- return null;
- }
-
- /**
- * Called when the value of the model object was changed in the view
- */
- public void valueForPathChanged(TreePath path, Object newValue) {
- // we don't support direct editing of the model
- System.out.println("TreeModel.valueForPathChanged: not implemented");
- }
- /**
- * Remembers a test failure
- */
- void addFailure(Test t) {
- fFailures.put(t, t);
- }
- /**
- * Remembers a test error
- */
- void addError(Test t) {
- fErrors.put(t, t);
- }
- /**
- * Remembers that a test was run
- */
- void addRunTest(Test t) {
- fRunTests.put(t, t);
- }
- /**
- * Returns whether a test was run
- */
- boolean wasRun(Test t) {
- return fRunTests.get(t) != null;
- }
- /**
- * Tests whether a test was an error
- */
- boolean isError(Test t) {
- return (fErrors != null) && fErrors.get(t) != null;
- }
- /**
- * Tests whether a test was a failure
- */
- boolean isFailure(Test t) {
- return (fFailures != null) && fFailures.get(t) != null;
- }
- /**
- * Resets the test results
- */
- void resetResults() {
- fFailures= new Hashtable();
- fRunTests= new Hashtable();
- fErrors= new Hashtable();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/textui/TestRunner.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/textui/TestRunner.java
deleted file mode 100644
index 7ee9597..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/textui/TestRunner.java
+++ /dev/null
@@ -1,249 +0,0 @@
-package junit.textui;
-
-
-import java.lang.reflect.*;
-import java.text.NumberFormat;
-import java.util.*;
-import java.io.PrintStream;
-
-import junit.framework.*;
-import junit.runner.*;
-
-/**
- * A command line based tool to run tests.
- * <pre>
- * java junit.textui.TestRunner [-wait] TestCaseClass
- * </pre>
- * TestRunner expects the name of a TestCase class as argument.
- * If this class defines a static <code>suite</code> method it
- * will be invoked and the returned test is run. Otherwise all
- * the methods starting with "test" having no arguments are run.
- * <p>
- * When the wait command line argument is given TestRunner
- * waits until the users types RETURN.
- * <p>
- * TestRunner prints a trace as the tests are executed followed by a
- * summary at the end.
- */
-public class TestRunner extends BaseTestRunner {
- PrintStream fWriter= System.out;
- int fColumn= 0;
-
- /**
- * Constructs a TestRunner.
- */
- public TestRunner() {
- }
- /**
- * Constructs a TestRunner using the given stream for all the output
- */
- public TestRunner(PrintStream writer) {
- this();
- if (writer == null)
- throw new IllegalArgumentException("Writer can't be null");
- fWriter= writer;
- }
-
- /**
- * Always use the StandardTestSuiteLoader. Overridden from
- * BaseTestRunner.
- */
- public TestSuiteLoader getLoader() {
- return new StandardTestSuiteLoader();
- }
-
- public synchronized void addError(Test test, Throwable t) {
- writer().print("E");
- }
-
- public synchronized void addFailure(Test test, AssertionFailedError t) {
- writer().print("F");
- }
-
- /**
- * Creates the TestResult to be used for the test run.
- */
- protected TestResult createTestResult() {
- return new TestResult();
- }
-
- public TestResult doRun(Test suite, boolean wait) {
- TestResult result= createTestResult();
- result.addListener(this);
- long startTime= System.currentTimeMillis();
- suite.run(result);
- long endTime= System.currentTimeMillis();
- long runTime= endTime-startTime;
- writer().println();
- writer().println("Time: "+elapsedTimeAsString(runTime));
- print(result);
-
- writer().println();
-
- pause(wait);
- return result;
- }
-
- protected void pause(boolean wait) {
- if (wait) {
- writer().println("<RETURN> to continue");
- try {
- System.in.read();
- }
- catch(Exception e) {
- }
- }
- }
-
- public synchronized void startTest(Test test) {
- writer().print(".");
- if (fColumn++ >= 40) {
- writer().println();
- fColumn= 0;
- }
- }
-
- public void endTest(Test test) {
- }
-
- public static void main(String args[]) {
- TestRunner aTestRunner= new TestRunner();
- try {
- TestResult r= aTestRunner.start(args);
- if (!r.wasSuccessful())
- System.exit(-1);
- System.exit(0);
- } catch(Exception e) {
- System.err.println(e.getMessage());
- System.exit(-2);
- }
- }
- /**
- * Prints failures to the standard output
- */
- public synchronized void print(TestResult result) {
- printErrors(result);
- printFailures(result);
- printHeader(result);
- }
- /**
- * Prints the errors to the standard output
- */
- public void printErrors(TestResult result) {
- if (result.errorCount() != 0) {
- if (result.errorCount() == 1)
- writer().println("There was "+result.errorCount()+" error:");
- else
- writer().println("There were "+result.errorCount()+" errors:");
-
- int i= 1;
- for (Enumeration e= result.errors(); e.hasMoreElements(); i++) {
- TestFailure failure= (TestFailure)e.nextElement();
- writer().println(i+") "+failure.failedTest());
- writer().print(getFilteredTrace(failure.thrownException()));
- }
- }
- }
- /**
- * Prints failures to the standard output
- */
- public void printFailures(TestResult result) {
- if (result.failureCount() != 0) {
- if (result.failureCount() == 1)
- writer().println("There was " + result.failureCount() + " failure:");
- else
- writer().println("There were " + result.failureCount() + " failures:");
- int i = 1;
- for (Enumeration e= result.failures(); e.hasMoreElements(); i++) {
- TestFailure failure= (TestFailure) e.nextElement();
- writer().print(i + ") " + failure.failedTest());
- Throwable t= failure.thrownException();
- writer().print(getFilteredTrace(failure.thrownException()));
- }
- }
- }
- /**
- * Prints the header of the report
- */
- public void printHeader(TestResult result) {
- if (result.wasSuccessful()) {
- writer().println();
- writer().print("OK");
- writer().println (" (" + result.runCount() + " tests)");
-
- } else {
- writer().println();
- writer().println("FAILURES!!!");
- writer().println("Tests run: "+result.runCount()+
- ", Failures: "+result.failureCount()+
- ", Errors: "+result.errorCount());
- }
- }
- /**
- * Runs a suite extracted from a TestCase subclass.
- */
- static public void run(Class testClass) {
- run(new TestSuite(testClass));
- }
- /**
- * Runs a single test and collects its results.
- * This method can be used to start a test run
- * from your program.
- * <pre>
- * public static void main (String[] args) {
- * test.textui.TestRunner.run(suite());
- * }
- * </pre>
- */
- static public void run(Test suite) {
- TestRunner aTestRunner= new TestRunner();
- aTestRunner.doRun(suite, false);
- }
- /**
- * Runs a single test and waits until the user
- * types RETURN.
- */
- static public void runAndWait(Test suite) {
- TestRunner aTestRunner= new TestRunner();
- aTestRunner.doRun(suite, true);
- }
- /**
- * Starts a test run. Analyzes the command line arguments
- * and runs the given test suite.
- */
- protected TestResult start(String args[]) throws Exception {
- String testCase= "";
- boolean wait= false;
-
- for (int i= 0; i < args.length; i++) {
- if (args[i].equals("-wait"))
- wait= true;
- else if (args[i].equals("-c"))
- testCase= extractClassName(args[++i]);
- else if (args[i].equals("-v"))
- System.err.println("JUnit "+Version.id()+" by Kent Beck and Erich Gamma");
- else
- testCase= args[i];
- }
-
- if (testCase.equals(""))
- throw new Exception("Usage: TestRunner [-wait] testCaseName, where name is the name of the TestCase class");
-
- try {
- Test suite= getTest(testCase);
- return doRun(suite, wait);
- }
- catch(Exception e) {
- throw new Exception("Could not create and run test suite: "+e);
- }
- }
-
- protected void runFailed(String message) {
- System.err.println(message);
- System.exit(-1);
- }
-
- protected PrintStream writer() {
- return fWriter;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/ui/TestRunner.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/ui/TestRunner.java
deleted file mode 100644
index 5ca5c91..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/junit/ui/TestRunner.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package junit.ui;
-
-import junit.framework.*;
-import junit.runner.*;
-
-/**
- * @deprecated use junit.awtui.TestRunner.
- */
- public class TestRunner extends junit.awtui.TestRunner {
- public static void main(String[] args) {
- new TestRunner().start(args);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/p1/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/p1/A.java
deleted file mode 100644
index a484e0f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/p1/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package p1;
-
-public class A {
-
- public static void foo() {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/p2/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/p2/A.java
deleted file mode 100644
index e107ae3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/p2/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package p2;
-
-public class A {
- public static void foo() {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/p3/B.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/p3/B.java
deleted file mode 100644
index 661768f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/p3/B.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package p3;
-
-import p1.*;
-
-public class B {
-
- public static void bar() {
- p2.A.foo();
- }
- public static void main(String[] args) {
- A.foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0001/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0001/Test.java
deleted file mode 100644
index a087fdf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0001/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0001;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("Hello" + " world");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0002/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0002/Test.java
deleted file mode 100644
index b87dd49..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0002/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0002;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new Object());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0003/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0003/Test.java
deleted file mode 100644
index 354d803..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0003/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0003;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new java.lang.Object());
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0004/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0004/Test.java
deleted file mode 100644
index d4df7d5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0004/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0004;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new java.lang.Exception("ERROR"));
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0005/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0005/Test.java
deleted file mode 100644
index b6b4fe4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0005/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0005;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new java.lang.Object() {});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0006/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0006/Test.java
deleted file mode 100644
index ee5adfe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0006/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0006;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new java.lang.Runnable() { public void run() {}});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0007/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0007/Test.java
deleted file mode 100644
index 1acdc39..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0007/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0007;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(new Test().new D());
- }
- class D {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0008/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0008/Test.java
deleted file mode 100644
index 4a8a6d2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0008/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0008;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(new int[] {1, 2, 3, 4});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0009/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0009/Test.java
deleted file mode 100644
index 9ea2a18..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0009/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0009;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(new int[][] {{1}, {2}});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0010/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0010/Test.java
deleted file mode 100644
index 719353d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0010/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0010;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(new int[3]);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0011/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0011/Test.java
deleted file mode 100644
index d9a64c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0011/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0011;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(new int[3][]);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0012/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0012/Test.java
deleted file mode 100644
index 99a66be..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0012/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0012;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(new int[][] {{}, {}});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0013/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0013/Test.java
deleted file mode 100644
index 0c41843..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0013/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0013;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0014/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0014/Test.java
deleted file mode 100644
index 5524559..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0014/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0014;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0015/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0015/Test.java
deleted file mode 100644
index 478cf01..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0015/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0015;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i = 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0016/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0016/Test.java
deleted file mode 100644
index 6d529ba..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0016/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0016;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i += 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0017/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0017/Test.java
deleted file mode 100644
index 60329f3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0017/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0017;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i -= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0018/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0018/Test.java
deleted file mode 100644
index 616c277..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0018/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0018;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i *= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0019/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0019/Test.java
deleted file mode 100644
index 3c44a04..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0019/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0019;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i /= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0020/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0020/Test.java
deleted file mode 100644
index c434b3c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0020/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0020;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i &= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0021/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0021/Test.java
deleted file mode 100644
index 76d0b3c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0021/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0021;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i |= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0022/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0022/Test.java
deleted file mode 100644
index 1907336..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0022/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0022;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i ^= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0023/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0023/Test.java
deleted file mode 100644
index 09062ee..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0023/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0023;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i %= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0024/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0024/Test.java
deleted file mode 100644
index 2e7b2a9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0024/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0024;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i <<= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0025/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0025/Test.java
deleted file mode 100644
index 91a7acc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0025/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0025;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i >>= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0026/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0026/Test.java
deleted file mode 100644
index f3db0cf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0026/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0026;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i >>>= 2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0027/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0027/Test.java
deleted file mode 100644
index 3853293..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0027/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0027;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- --i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0028/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0028/Test.java
deleted file mode 100644
index 2b821a5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0028/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0028;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- ++i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0029/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0029/Test.java
deleted file mode 100644
index 56d9f81..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0029/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0029;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i--;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0030/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0030/Test.java
deleted file mode 100644
index 185124b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0030/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0030;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 0;
- i++;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0031/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0031/Test.java
deleted file mode 100644
index 18ad631..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0031/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0031;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- Object o = "Hello";
- String s = (String) o;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0032/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0032/Test.java
deleted file mode 100644
index 82a2df7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0032/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0032;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- double d = 1.0;
- int i = (int) d;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0033/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0033/Test.java
deleted file mode 100644
index 9efe21b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0033/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0033;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- double d = 1.0;
- float f = (float) d;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0034/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0034/Test.java
deleted file mode 100644
index 18fbb8d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0034/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0034;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- double d = 1.0;
- byte b = (byte) d;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0035/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0035/Test.java
deleted file mode 100644
index 3d66c10..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0035/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0035;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- double d = 1.0;
- short s = (short) d;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0036/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0036/Test.java
deleted file mode 100644
index 5fcf783..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0036/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0036;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- double d = 1.0;
- long l = (long) d;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0037/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0037/Test.java
deleted file mode 100644
index a436457..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0037/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0037;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 1;
- char c = (char) i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0038/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0038/Test.java
deleted file mode 100644
index ca3d681..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0038/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0038;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- Class c = int.class;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0039/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0039/Test.java
deleted file mode 100644
index 55d920a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0039/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0039;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- Class c = void.class;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0040/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0040/Test.java
deleted file mode 100644
index d9c8173..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0040/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0040;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- Class c = double.class;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0041/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0041/Test.java
deleted file mode 100644
index ff449c6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0041/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0041;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- Class c = long.class;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0042/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0042/Test.java
deleted file mode 100644
index 60f2854..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0042/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0042;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(false);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0043/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0043/Test.java
deleted file mode 100644
index 8c5c76b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0043/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0043;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(true);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0044/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0044/Test.java
deleted file mode 100644
index d8f93de..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0044/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0044;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(null);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0045/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0045/Test.java
deleted file mode 100644
index 6c5fbdd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0045/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0045;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println('c');
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0046/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0046/Test.java
deleted file mode 100644
index ce66833..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0046/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0046;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(1.00001);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0047/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0047/Test.java
deleted file mode 100644
index 3ae22da..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0047/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0047;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(1.00001f);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0048/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0048/Test.java
deleted file mode 100644
index 6a57b10..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0048/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0048;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- System.out.println(30000);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0049/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0049/Test.java
deleted file mode 100644
index 3a8cb25..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0049/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0049;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(-2147483648);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0050/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0050/Test.java
deleted file mode 100644
index 7981a22..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0050/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0050;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(2147483648L);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0051/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0051/Test.java
deleted file mode 100644
index 2e6ceab..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0051/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0051;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(-2147483648L);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0052/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0052/Test.java
deleted file mode 100644
index 68c13d0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0052/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0052;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(-9223372036854775808L);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0053/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0053/Test.java
deleted file mode 100644
index bbf359b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0053/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0053;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("Hello" + " World");
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0054/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0054/Test.java
deleted file mode 100644
index 627ec4d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0054/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0054;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- boolean b = true;
- boolean b2 = true;
- boolean b3 = b && b2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0055/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0055/Test.java
deleted file mode 100644
index 5f6e324..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0055/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0055;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- boolean b = true;
- boolean b2 = true;
- boolean b3 = b || b2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0056/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0056/Test.java
deleted file mode 100644
index 67d9fd5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0056/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0056;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- boolean b = true;
- boolean b2 = true;
- boolean b3 = b == b2;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0057/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0057/Test.java
deleted file mode 100644
index 4ca3969..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0057/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0057;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i + j;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0058/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0058/Test.java
deleted file mode 100644
index b6f8e07..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0058/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0058;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i - j;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0059/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0059/Test.java
deleted file mode 100644
index 492718d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0059/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0059;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i * j;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0060/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0060/Test.java
deleted file mode 100644
index 6c34d4b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0060/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0060;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i / j;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0061/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0061/Test.java
deleted file mode 100644
index e473e46..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0061/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0061;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i % j;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0062/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0062/Test.java
deleted file mode 100644
index b1f1d29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0062/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0062;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i ^ j;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0063/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0063/Test.java
deleted file mode 100644
index 7bd52bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0063/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0063;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i & j;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0064/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0064/Test.java
deleted file mode 100644
index f37e4aa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0064/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0064;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- int i = 2;
- int j = 3;
- int n = i | j;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0065/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0065/Test.java
deleted file mode 100644
index bcb8119..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0065/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0065;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- boolean b = true;
- boolean b1 = true;
- boolean b2 = b < b1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0066/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0066/Test.java
deleted file mode 100644
index 78220f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0066/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0066;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- boolean b = true;
- boolean b1 = true;
- boolean b2 = b <= b1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0067/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0067/Test.java
deleted file mode 100644
index b6c8711..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0067/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0067;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- boolean b = true;
- boolean b1 = true;
- boolean b2 = b > b1;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0068/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0068/Test.java
deleted file mode 100644
index 04e2793..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0068/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0068;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- boolean b = true;
- boolean b1 = true;
- boolean b2 = b >= b1;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0069/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0069/Test.java
deleted file mode 100644
index e99484d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0069/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0069;
-import java.util.*;
-public class Test {
-
- public static void main(String[] args) {
- boolean b = true;
- boolean b1 = true;
- boolean b2 = b != b1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0070/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0070/Test.java
deleted file mode 100644
index 5f94bce..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0070/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0070;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- Object o = new Object();
- boolean b = o instanceof Integer;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0071/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0071/Test.java
deleted file mode 100644
index 9ebf251..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0071/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0071;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- Object o = new Object();
- boolean b = o instanceof java.lang.Integer;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0072/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0072/Test.java
deleted file mode 100644
index 564d415..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0072/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0072;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- boolean b = true;
- boolean b1 = !b;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0073/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0073/Test.java
deleted file mode 100644
index ae29385..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0073/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0073;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = 2;
- int n = ~i;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0074/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0074/Test.java
deleted file mode 100644
index 9bd1ad6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0074/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0074;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = +2;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0075/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0075/Test.java
deleted file mode 100644
index 4300b82..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0075/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0075;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = -2;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0076/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0076/Test.java
deleted file mode 100644
index 34b3ec9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0076/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0076;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- boolean b = args != null ? true : false;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0077/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0077/Test.java
deleted file mode 100644
index ea621bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0077/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0077;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- int i = true ? args.length: 0;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0078/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0078/Test.java
deleted file mode 100644
index e97db33..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0078/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0078;
-import java.util.*;
-public class Test {
- public void foo() {
- super.bar();
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0079/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0079/Test.java
deleted file mode 100644
index a9b72ee..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0079/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0079;
-import java.util.*;
-public class Test {
- public void foo() {
- super.bar(4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0080/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0080/Test.java
deleted file mode 100644
index 5dda70a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0080/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0080;
-import java.util.*;
-public class Test {
- public void foo() {
- bar(4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0081/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0081/Test.java
deleted file mode 100644
index 308b27a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0081/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0081;
-import java.util.*;
-public class Test {
- public void foo() {
- this.bar(4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0082/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0082/Test.java
deleted file mode 100644
index 6a21ccd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0082/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0082;
-import java.util.*;
-public class Test {
- public void foo() {
- for (;;);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0083/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0083/Test.java
deleted file mode 100644
index 5cedbc2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0083/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0083;
-import java.util.*;
-public class Test {
- public void foo() {
- for (int i = 0; i < 10; i++) {}
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0084/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0084/Test.java
deleted file mode 100644
index dfa3842..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0084/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0084;
-import java.util.*;
-public class Test {
- public void foo() {
- for (int i = 0; i < 10; i++);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0085/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0085/Test.java
deleted file mode 100644
index 3b82d16..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0085/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0085;
-import java.util.*;
-public class Test {
- public void foo() {
- for (int i = 0;; i++);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0086/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0086/Test.java
deleted file mode 100644
index af60814..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0086/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0086;
-import java.util.*;
-public class Test {
- public void foo() {
- for (; i < 10; i++);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0087/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0087/Test.java
deleted file mode 100644
index 3d6fe98..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0087/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0087;
-import java.util.*;
-public class Test {
- public void foo() {
- for (;;i++);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0088/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0088/Test.java
deleted file mode 100644
index 9f056b6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0088/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0088;
-import java.util.*;
-public class Test {
- public void foo() {
- int i;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0089/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0089/Test.java
deleted file mode 100644
index 45cff9b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0089/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0089;
-import java.util.*;
-public class Test {
- public void foo() {
- java.lang.String s;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0090/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0090/Test.java
deleted file mode 100644
index 1d54855..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0090/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0090;
-import java.util.*;
-public class Test {
- public void foo() {
- int[] tab = {1, 2};
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0091/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0091/Test.java
deleted file mode 100644
index e88d975..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0091/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0091;
-import java.util.*;
-public class Test {
- public void foo(String s) {
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0092/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0092/Test.java
deleted file mode 100644
index 68b8917..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0092/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0092;
-
-public class Test {
- public void foo(final String s) {
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0093/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0093/Test.java
deleted file mode 100644
index 9cdca44..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0093/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0093;
-import java.util.*;
-public class Test {
- public void foo(String s) {
- for (int i = 0; i < 10; i++) {
- break;
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0094/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0094/Test.java
deleted file mode 100644
index 1bf5ca5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0094/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0094;
-import java.util.*;
-public class Test {
- public void foo(String s) {
- for (int i = 0; i < 10; i++) {
- continue;
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0095/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0095/Test.java
deleted file mode 100644
index 9dd82d4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0095/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0095;
-import java.util.*;
-public class Test {
- public void foo(String s) {
- label: for (int i = 0; i < 10; i++) {
- continue label;
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0096/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0096/Test.java
deleted file mode 100644
index f1b7f2f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0096/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0096;
-import java.util.*;
-public class Test {
-
- public void foo(String s) {
- label: for (int i = 0; i < 10; i++) {
- break label;
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0097/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0097/Test.java
deleted file mode 100644
index 87064bb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0097/Test.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package test0097;
-import java.util.*;
-public class Test {
- public void foo(int i ) {
- switch(i) {
- case 1:
- break;
- case 2:
- System.out.println(2);
- break;
- default:
- System.out.println("default");
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0098/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0098/Test.java
deleted file mode 100644
index 0adc36d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0098/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0098;
-import java.util.*;
-public class Test {
- public void foo(int i ) {
- ;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0099/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0099/Test.java
deleted file mode 100644
index 9d7b6c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0099/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0099;
-import java.util.*;
-public class Test {
- public void foo(int i ) {
- do {;
- } while(true);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0100/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0100/Test.java
deleted file mode 100644
index ad427d7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0100/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0100;
-import java.util.*;
-public class Test {
- public void foo(int i ) {
- while(true);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0101/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0101/Test.java
deleted file mode 100644
index 16173a8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0101/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0101;
-import java.util.*;
-public class Test {
- public void foo(int i ) {
- while(true) {}
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0102/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0102/Test.java
deleted file mode 100644
index be26b9d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0102/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0102;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("Hello" + " World" + "!");
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0103/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0103/Test.java
deleted file mode 100644
index 6b4d931..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0103/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0103;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("Hello" + " World" + "!" + "!");
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0104/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0104/Test.java
deleted file mode 100644
index fa807d1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0104/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0104;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("Hello" + " World" + "!" + 4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0105/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0105/Test.java
deleted file mode 100644
index c6b4ebd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0105/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0105;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(4 + 5 + 6 + 4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0106/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0106/Test.java
deleted file mode 100644
index 24dff63..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0106/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0106;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(4 - 5 + 6 + 4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0107/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0107/Test.java
deleted file mode 100644
index 9584136..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0107/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0107;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(4 - 5 - 6 - 4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0108/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0108/Test.java
deleted file mode 100644
index 96745f7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0108/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0108;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("4" + 5 + 6 + 4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0109/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0109/Test.java
deleted file mode 100644
index 4756ee7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0109/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0109;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println("4" - 5 + 6 + 4);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0110/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0110/Test.java
deleted file mode 100644
index c269111..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0110/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0110;
-import java.util.*;
-public class Test {
- public int foo(int i ) {
- return 2;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0111/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0111/Test.java
deleted file mode 100644
index 6925e43..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0111/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0111;
-import java.util.*;
-public class Test {
- public int foo(int i ) {
- return 2\u003B
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0112/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0112/Test.java
deleted file mode 100644
index 448fe59..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0112/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0112;
-import java.util.*;
-public class Test {
- public int foo(int i ) {
- synchronized(this) {
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0113/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0113/Test.java
deleted file mode 100644
index fb64e29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0113/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0113;
-import java.util.*;
-public class Test {
- public int foo(int i ) {
- try {
- } catch(Exception e) {
- } finally {
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0114/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0114/Test.java
deleted file mode 100644
index ffd6874..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0114/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0114;
-import java.util.*;
-public class Test {
- public int foo(int i ) {
- try {
- } catch(Exception e) {
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0115/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0115/Test.java
deleted file mode 100644
index cad1f88..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0115/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0115;
-import java.util.*;
-public class Test {
- public int foo(int i ) {
- try {
- return 2;
- } catch(Exception e) {
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0116/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0116/Test.java
deleted file mode 100644
index cd6aaaa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0116/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0116;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- throw e \u003B
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0117/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0117/Test.java
deleted file mode 100644
index 75ebfb6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0117/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0117;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- throw e /* comment in the middle of a throw */ \u003B
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0118/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0118/Test.java
deleted file mode 100644
index ab04328..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0118/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0118;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- throw e /* comment in the middle of a throw */ \u003B/** */
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0119/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0119/Test.java
deleted file mode 100644
index 0d50971..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0119/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0119;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- if (true)\u003B
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0120/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0120/Test.java
deleted file mode 100644
index 6676d64..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0120/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0120;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- if (true)\u003B
- else ;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0121/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0121/Test.java
deleted file mode 100644
index c0c00be..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0121/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0121;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- if (true) {}
- else ;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0122/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0122/Test.java
deleted file mode 100644
index 3024d7a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0122/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0122;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- if (true) return 2\u003B
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0123/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0123/Test.java
deleted file mode 100644
index 2b2d130..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0123/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0123;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- if (true) return 2;
- else return 3;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0124/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0124/Test.java
deleted file mode 100644
index b2666a9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0124/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0124;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- int x= 10, z[] = null, i, j[][];
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0125/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0125/Test.java
deleted file mode 100644
index f440fc1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0125/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0125;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- int[] x= 10, z[] = null, i, j[][];
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0126/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0126/Test.java
deleted file mode 100644
index 0a9c520..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0126/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0126;
-import java.util.*;
-public class Test {
- public void foo(int i) {
- for (String[] tab[] = null;; ++i) {}
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0127/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0127/Test.java
deleted file mode 100644
index af5a7e9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0127/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0127;
-import java.util.*;
-public class Test {
- public void foo(int i) {
- for (String tab[] = null;; ++i) {}
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0128/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0128/Test.java
deleted file mode 100644
index 5b6cf3a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0128/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0128;
-import java.util.*;
-public class Test {
- public void foo(int i) {
- for (String tab[] = null;; i++/**/) {}
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0129/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0129/Test.java
deleted file mode 100644
index 7b43ff5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0129/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0129;
-import java.util.*;
-public class Test {
- int i;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0130/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0130/Test.java
deleted file mode 100644
index 884c867..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0130/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0130;
-import java.util.*;
-public class Test {
- public int x= 10, y[] = null, i, j[][];
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0131/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0131/Test.java
deleted file mode 100644
index be3a7ef..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0131/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0131;
-import java.util.*;
-public class Test {
- void foo(final int i) {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0132/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0132/Test.java
deleted file mode 100644
index 5a070d1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0132/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0132;
-import java.util.*;
-public class Test {
- /** JavaDoc Comment*/
- void foo(final int i) {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0133/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0133/Test.java
deleted file mode 100644
index 834da2e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0133/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0133;
-import java.util.*;
-public class Test {
- /* Multiple line Comment
- */
- void foo(final int i) {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0134/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0134/Test.java
deleted file mode 100644
index 96cfe99..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0134/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0134;
-import java.util.*;
-public class Test {
- // Line comment
- void foo(final int i) {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0135/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0135/Test.java
deleted file mode 100644
index d4104c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0135/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0135;
-import java.util.*;
-public class Test {
- /** JavaDoc Comment*/
- int i;
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0136/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0136/Test.java
deleted file mode 100644
index a1215f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0136/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0136;
-import java.util.*;
-public class Test {
- /* Multiple lines comment
- */
- int i;
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0137/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0137/Test.java
deleted file mode 100644
index 48d5328..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0137/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0137;
-import java.util.*;
-public class Test {
- // Line comment
- int i;
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0138/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0138/Test.java
deleted file mode 100644
index 2e86377..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0138/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0138;
-import java.util.*;
- // Line comment
-public class Test {
- int i;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0139/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0139/Test.java
deleted file mode 100644
index 0e15fc0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0139/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0139;
-import java.util.*;
-/* Line comment
- */
-public class Test {
- int i;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0140/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0140/Test.java
deleted file mode 100644
index 520d696..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0140/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0140;
-import java.util.*;
-/** JavaDoc Comment*/
-public class Test {
- int i;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0141/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0141/Test.java
deleted file mode 100644
index ef71959..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0141/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0141;
-import java.util.*;
-public class Test {
- /** JavaDoc Comment*/
- class B {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0142/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0142/Test.java
deleted file mode 100644
index 026de1b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0142/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0142;
-import java.util.*;
-public class Test {
- /* Multiple lines comment
- */
- class B {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0143/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0143/Test.java
deleted file mode 100644
index b553dd2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0143/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0143;
-import java.util.*;
-public class Test {
- // Line comment
- public static class B {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0144/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0144/Test.java
deleted file mode 100644
index 7d41b35..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0144/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0144;
-import java.util.*;
-public class Test {
- public static class B {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0145/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0145/Test.java
deleted file mode 100644
index c9ad484..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0145/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0145;
-import java.util.*;
-public class Test {
- {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0146/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0146/Test.java
deleted file mode 100644
index 3f6d1ef..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0146/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0146;
-import java.util.*;
-public class Test {
- static {}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0147/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0147/Test.java
deleted file mode 100644
index 461a47a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0147/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0147;
-import java.util.*;
-public class Test {
-
- /** JavaDoc Comment*/
- static {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0148/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0148/Test.java
deleted file mode 100644
index 5d1011b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0148/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0148;
-import java.util.*;
-public class Test {
-
- /** JavaDoc Comment*/
- {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0149/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0149/Test.java
deleted file mode 100644
index 4ce9863..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0149/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0149;
-import java.util.*;
-public class Test {
-
- /* JavaDoc Comment
- */
- {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0150/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0150/Test.java
deleted file mode 100644
index 0fce3ca..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0150/Test.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0150
-import java.util.*;
-public class Test {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0151/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0151/Test.java
deleted file mode 100644
index a72f397..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0151/Test.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0151;
-import java.util.*;
-public class Test {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0152/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0152/Test.java
deleted file mode 100644
index 7cb20d3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0152/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0152;
-import java.util.*;
-public class Test {
- publicccc voidd foo(() {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0153/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0153/Test.java
deleted file mode 100644
index 9485877..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0153/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0153;
-import java.util.*;
-public class Test {
- public void foo() {
- int i
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0154/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0154/Test.java
deleted file mode 100644
index 95a52c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0154/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0154;
-import java.util.*;
-class Test {
- int[] tab;
- String[] t;
- Test[] t2;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0155/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0155/Test.java
deleted file mode 100644
index 119bf75..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0155/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0155;
-import java.util.*;
-public class Test {
- public void m(int i, final boolean b){}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0156/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0156/Test.java
deleted file mode 100644
index c05399a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0156/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0156;
-import java.util.*;
-public class Test {
- int foo(int i) {
- i++;
- return i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0159/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0159/Test.java
deleted file mode 100644
index b5ba6c5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0159/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0159;
-import java.util.*;
-public class Test {
- Test(int i){
- }
- void n(){
- final int y= 0;
- new Test(y){
- void f(){
- int y= 9;
- }
- };
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0160/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0160/Test.java
deleted file mode 100644
index 1137d11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0160/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0160;
-import java.util.*;
-public class Test {
-
- Test[] t, g[] = null;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0161/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0161/Test.java
deleted file mode 100644
index a874eb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0161/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0161;
-import java.util.*;
-
-public class Test implements Cloneable {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0162/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0162/Test.java
deleted file mode 100644
index 291a4c8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0162/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0162;
-import java.util.*;
-public interface Test {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0163/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0163/Test.java
deleted file mode 100644
index e4ab40a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0163/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0163;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new java.lang.Object() {});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0164/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0164/Test.java
deleted file mode 100644
index ebd01ad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0164/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0164;
-import java.util.*;
-public class Test {
- private class B {}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0165/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0165/Test.java
deleted file mode 100644
index aad7e80..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0165/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0165;
-import java.util.*;
-public class Test {
- void foo() {
- class C {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0166/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0166/Test.java
deleted file mode 100644
index 960aa83..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0166/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0166;
-import java.util.*;
-public class Test {
- public int foo(Exception e) {
- int x= 10, z[] = null, i, j[][];
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0167/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0167/Test.java
deleted file mode 100644
index 9bf278d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0167/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0167;
-import java.util.*;
-public class Test {
- void f() {
- int f = new Test[1+2].length;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0168/test1/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0168/test1/Test.java
deleted file mode 100644
index 9af8e82..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0168/test1/Test.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0168.test1;
-import java.util.*;
-public class Test {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0169/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0169/Test.java
deleted file mode 100644
index 8299945..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0169/Test.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0169;
-import java.util.*;
-public class Test {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0171/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0171/Test.java
deleted file mode 100644
index c11c898..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0171/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0171;
-import java.util.*;
-
-class A {
-}
-
-public class Test {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0172/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0172/Test.java
deleted file mode 100644
index a55c8f2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0172/Test.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package test0172;
-import java.util.*;
-import java.io.IOException;
-
-public class Test {
-
- void foo(int[] i) throws IOException {
- }
-
- public static void main(String[] args) {
- }
-
- private String bar(String s) throws NullPointerException {
- return s;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0173/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0173/Test.java
deleted file mode 100644
index afdbc79..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0173/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0173;
-import java.util.*;
-public class Test {
- int foo() {
- int i = 0;
- i++;
- return i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0174/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0174/Test.java
deleted file mode 100644
index 00da130..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0174/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0174;
-import java.util.*;
-public class Test {
- int i;
- int foo() {
- i++;
- return i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0175/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0175/Test.java
deleted file mode 100644
index d401ea1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0175/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0175;
-import java.util.*;
-public class Test {
- int i = 0;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0176/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0176/Test.java
deleted file mode 100644
index 5ee3d63..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0176/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0176;
-import java.util.*;
-public class Test {
- int i = 0;
- int foo() {
- return this.i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0177/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0177/Test.java
deleted file mode 100644
index dfadfd3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0177/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0177;
-import java.util.*;
-public class Test {
- void bar() {
- double i = 1.0;
- System.out.println(i);
- }
-
- int foo() {
- int i = 0;
- i++;
- return i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0178/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0178/Test.java
deleted file mode 100644
index d229d81..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0178/Test.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0178;
-import java.util.*;
-
-class Top {
- int j;
-}
-
-public class Test extends Top {
- int foo() {
- return super.j;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0179/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0179/Test.java
deleted file mode 100644
index 1271fe5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0179/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0179;
-import java.util.*;
-public class Test {
- public void foo() {
- Test t = new Test();
- System.out.println(t);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0180/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0180/Test.java
deleted file mode 100644
index c8608ad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0180/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0180;
-import java.util.*;
-public class Test {
- public void foo() {
- Test[] t = new Test[0];
- System.out.println(t);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0181/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0181/Test.java
deleted file mode 100644
index e426d83..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0181/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0181;
-import java.util.*;
-public class Test {
- public void foo() {
- Test[] t = {};
- System.out.println(t);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0182/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0182/Test.java
deleted file mode 100644
index fce1212..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0182/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0182;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 10;
- if (/*]*/i < 10/*[*/)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0183/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0183/Test.java
deleted file mode 100644
index eca6d67..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0183/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0183;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 10;
- if (/*]*/i < 10 && i < 20/*[*/)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0184/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0184/Test.java
deleted file mode 100644
index 502089e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0184/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0184;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 10;
- if (/*]*/i < 10 || i < 20/*[*/)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0185/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0185/Test.java
deleted file mode 100644
index ca876b7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0185/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0185;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 10;
- if (/*]*/i == 10/*[*/)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0186/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0186/Test.java
deleted file mode 100644
index 587f6a4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0186/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0186;
-import java.util.*;
-public class Test {
- public void foo() {
- Object o= null;
- if (/*]*/o == o/*[*/)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0187/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0187/Test.java
deleted file mode 100644
index 224c61a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0187/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0187;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 0;
- while (/*]*/i <= 10/*[*/)
- foo();
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0188/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0188/Test.java
deleted file mode 100644
index e4075fd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0188/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0188;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 0;
- foo();
- do {
- foo();
- } while (/*]*/i <= 10/*[*/);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0189/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0189/Test.java
deleted file mode 100644
index e1de33c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0189/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0189;
-import java.util.*;
-public class Test {
- public void foo() {
- for (int i= 0;/*[*/ i < 10/*]*/; i++)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0190/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0190/Test.java
deleted file mode 100644
index 4df1c09..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0190/Test.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package test0190;
-import java.util.*;
-public class Test {
- public static class Scanner {
- public int x;
- public int y;
- }
- public static class Selection {
- public int start;
- public int end;
- }
-
- public void foo(Selection selection) {
- Scanner scanner= new Scanner();
-
- if (/*]*/scanner.x < selection.start && selection.start < scanner.y/*[*/) {
- g();
- }
- }
-
- public void g() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0191/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0191/Test.java
deleted file mode 100644
index 613039f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0191/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0191;
-import java.util.*;
-public class Test {
- public void foo() {
- boolean b;
- b= 1 < 10 && /*]*/2 < 20/*[*/;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0192/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0192/Test.java
deleted file mode 100644
index 35a84cf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0192/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0192;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= /*]*/0/*[*/;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0193/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0193/Test.java
deleted file mode 100644
index 97b1c68..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0193/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0193;
-import java.util.*;
-public class Test {
- class Inner {
- }
- public void foo() {
- Inner inner= /*]*/new Inner();/*[*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0194/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0194/Test.java
deleted file mode 100644
index bd5b327..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0194/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0194;
-import java.util.*;
-public class Test {
- class Inner {
- }
- public void foo() {
- Inner[] inner= /*]*/new Inner[10];/*[*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0195/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0195/Test.java
deleted file mode 100644
index 813e3e3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0195/Test.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package test0195;
-import java.util.*;
-import java.io.File;
-
-class A {
- public File getFile() {
- return null;
- }
- public void useFile(File file) {
- }
-}
-
-public class Test {
- public void foo() {
- A a= null;
- a.useFile(/*]*/a.getFile()/*[*/);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0196/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0196/Test.java
deleted file mode 100644
index 7c78625..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0196/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0196;
-import java.util.*;
-public class Test {
- class Inner {
- }
- public void foo() {
- Inner inner= null;
- boolean b;
- b= /*]*/inner instanceof Inner/*[*/;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0197/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0197/Test.java
deleted file mode 100644
index 35a3f64..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0197/Test.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package test0197;
-import java.util.*;
-import java.io.File;
-class A {
- public File getFile() {
- return null;
- }
- public void useFile(File file) {
- }
-}
-
-public class Test {
- public void foo() {
- A a= null;
- /*]*/a.getFile()/*[*/.getName();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0198/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0198/Test.java
deleted file mode 100644
index 28c874f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0198/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0198;
-import java.util.*;
-public class Test {
- public int foo() {
- return 10 + /*]*/20 * 30/*[*/ + 10;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0199/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0199/Test.java
deleted file mode 100644
index a3cff3a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0199/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0199;
-import java.util.*;
-public class Test {
- public void foo() {
- int i= 20 + /*]*/10 * 30/*[*/ + 10;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0200/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0200/Test.java
deleted file mode 100644
index 19ca6b8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0200/Test.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package test0200;
-import java.util.*;
-import java.io.File;
-
-class A {
- public File getFile() {
- return null;
- }
- public void useFile(File file) {
- }
-}
-
-public class Test {
- public void foo() {
- int f= new A[/*]*/1 + 2/*[*/].length;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0201/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0201/Test.java
deleted file mode 100644
index a4fe798..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0201/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0201;
-import java.util.*;
-public class Test {
- public void foo() {
- /*]*/foo();/*[*/
-
- for (int i= 0; i < 10; i++)
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0202/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0202/Test.java
deleted file mode 100644
index 97eaa91..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0202/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0202;
-import java.util.*;
-public class Test {
- int f= (2);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0203/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0203/Test.java
deleted file mode 100644
index 256ca9a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0203/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0203;
-import java.util.*;
-public class Test {
- int f= (2);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0204/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0204/Test.java
deleted file mode 100644
index facf21d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0204/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0204;
-import java.util.*;
-public class Test {
- int f= ((2));
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0205/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0205/Test.java
deleted file mode 100644
index e3c9511..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0205/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0205;
-import java.util.*;
-public class Test {
- void f(){
- /*[*/class AA extends Test {}/*]*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0206/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0206/Test.java
deleted file mode 100644
index 065de3c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0206/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0206;
-import java.util.*;
-public class Test {
- public Test field;
- public int i;
-
- public int foo() {
- return field.field.field.field.i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0207/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0207/Test.java
deleted file mode 100644
index d2055dd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0207/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0207;
-import java.util.*;
-public class Test {
- /** JavaDoc Comment*/
- void foo(final int i) {}/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0208/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0208/Test.java
deleted file mode 100644
index c6e142a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0208/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0208;
-import java.util.*;
-public class Test {
- /* Multiple line Comment
- */
- void foo(final int i) {}/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0209/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0209/Test.java
deleted file mode 100644
index d2d1dd4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0209/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0209;
-import java.util.*;
-public class Test {
- // Line comment
- void foo(final int i) {}/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0210/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0210/Test.java
deleted file mode 100644
index a75c76f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0210/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0210;
-import java.util.*;
-public class Test {
- /** JavaDoc Comment*/
- int i;/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0211/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0211/Test.java
deleted file mode 100644
index 0a883a5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0211/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0211;
-import java.util.*;
-public class Test {
- /* Multiple lines comment
- */
- int i;/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0212/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0212/Test.java
deleted file mode 100644
index 421ca11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0212/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0212;
-import java.util.*;
-public class Test {
- // Line comment
- int i;/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0213/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0213/Test.java
deleted file mode 100644
index 4c68332..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0213/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0213;
-import java.util.*;
- // Line comment
-public class Test {
- int i;
-}/**/
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0214/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0214/Test.java
deleted file mode 100644
index 2f34954..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0214/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0214;
-import java.util.*;
-/* Line comment
- */
-public class Test {
- int i;
-}/**/
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0215/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0215/Test.java
deleted file mode 100644
index a3c75da..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0215/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0215;
-import java.util.*;
-/** JavaDoc Comment*/
-public class Test {
- int i;
-}/**/
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0216/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0216/Test.java
deleted file mode 100644
index 0d95f78..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0216/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0216;
-import java.util.*;
-public class Test {
- /** JavaDoc Comment*/
- class B {}/**/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0217/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0217/Test.java
deleted file mode 100644
index 248e034..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0217/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0217;
-import java.util.*;
-public class Test {
- /* Multiple lines comment
- */
- class B {}/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0218/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0218/Test.java
deleted file mode 100644
index 612f423..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0218/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0218;
-import java.util.*;
-public class Test {
- // Line comment
- public static class B {}/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0219/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0219/Test.java
deleted file mode 100644
index 596ea6c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0219/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0219;
-import java.util.*;
-public class Test {
- public static class B {}/**/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0220/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0220/Test.java
deleted file mode 100644
index badc9f9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0220/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0220;
-import java.util.*;
-public class Test {
- {}/**/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0221/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0221/Test.java
deleted file mode 100644
index a12ea17..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0221/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0221;
-import java.util.*;
-public class Test {
- static {}/**/
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0222/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0222/Test.java
deleted file mode 100644
index b799432..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0222/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0222;
-import java.util.*;
-public class Test {
-
- /** JavaDoc Comment*/
- static {}/**/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0223/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0223/Test.java
deleted file mode 100644
index df800f6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0223/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0223;
-import java.util.*;
-public class Test {
-
- /** JavaDoc Comment*/
- {}/**/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0224/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0224/Test.java
deleted file mode 100644
index 62261b1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0224/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0224;
-import java.util.*;
-public class Test {
-
- /* JavaDoc Comment
- */
- {}/**/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0225/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0225/Test.java
deleted file mode 100644
index 337910e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0225/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0225;
-import java.util.*;
-public class Test {
- public void foo(String s) {
- label: for (int i = 0; i < 10; i++) {
- continue label;
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0226/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0226/Test.java
deleted file mode 100644
index 84301f7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0226/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0226;
-import java.util.*;
-public class Test {
-
- public void foo(String s) {
- label: for (int i = 0; i < 10; i++) {
- break label;
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0227/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0227/Test.java
deleted file mode 100644
index 13c07af..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0227/Test.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package test0227;
-import java.util.*;
-class A {
- long j;
-}
-class B {
- A fA;
-}
-class C {
- B fB;
-}
-public class Test {
- public C field;
- public int i;
-
- public int foo() {
- return field.fB.fA.j;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0228/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0228/Test.java
deleted file mode 100644
index 21df485..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0228/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0228;
-import java.util.*;
-public class Test {
- public static int foo() {
- return 4;
- }
-
- public int bar() {
- return test0228.Test.foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0229/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0229/Test.java
deleted file mode 100644
index 89db110..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0229/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0229;
-public class Test {
- public void foo() {
- System.err.println();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0230/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0230/Test.java
deleted file mode 100644
index 237afaa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0230/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0230;
-import java.io.PrintStream;
-public class Test {
- PrintStream err = System.err;
- public void foo() {
- err.println();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0231/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0231/Test.java
deleted file mode 100644
index 776f39c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0231/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0231;
-import java.util.*;
-public class Test {
- public void foo() {
- System.err.println();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0232/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0232/Test.java
deleted file mode 100644
index e8b86c1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0232/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0232;
-import java.util.*;
-public class Test {
- void foo(String[] array) {
- int i = array.length;
- System.out.println(i);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0233/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0233/Test.java
deleted file mode 100644
index da9293e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0233/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0233;
-
-public class Test {
- Toto t;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0234/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0234/Test.java
deleted file mode 100644
index 9b64e89..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0234/Test.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0234;
-public class Test {
- List field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0235/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0235/Test.java
deleted file mode 100644
index 1248c24..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0235/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0235;
-
-import java.awt.List;
-
-public class Test {
- List field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0236/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0236/Test.java
deleted file mode 100644
index da3f69f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0236/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0236;
-import java.util.*;
-public class Test {
- int i= 0, k = 1;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0238/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0238/Test.java
deleted file mode 100644
index 92303fe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0238/Test.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package test0238;
-import java.util.*;
-
-public class Test {
- public int foo() {
- class X {
- int foo() {
- return Test.this.bar();
- }
- }
- return new X().foo();
- }
-
- public int bar() {
- return 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0239/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0239/Test.java
deleted file mode 100644
index ce548ff..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0239/Test.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package test0239;
-
-import java.util.*;
-class T {
- int bar() {
- return 0;
- }
-}
-
-public class Test extends T {
- public int foo() {
- class X {
- int foo() {
- return Test.super.bar();
- }
- }
- return new X().foo();
- }
-
- public int bar() {
- return 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0240/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0240/Test.java
deleted file mode 100644
index 08f32b3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0240/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0240;
-import java.util.*;
-public class Test {
- public int foo() {
- class X {
- int foo() {
- return Test.this.f;
- }
- }
- return new X().foo();
- }
-
- public int f = 0;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0241/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0241/Test.java
deleted file mode 100644
index e229c61..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0241/Test.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package test0241;
-import java.util.*;
-public class Test {
-
- public int i;
-
- public void foo() {}
-
- class B {
- }
-
- class D {
- }
-
- public void bar() {
- }
-
- int j;
-
- public static int foo3() {
- return 3;
- }
- public static int k = foo3();
-
- Object l, n, m;
-
- public void foo2() {
- }
-
- class D {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0242/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0242/Test.java
deleted file mode 100644
index 193f200..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0242/Test.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package test0242;
-import java.util.*;
-class T {
- public int f = 0;
-}
-
-public class Test extends T {
- public int foo() {
- class X {
- int foo() {
- return Test.super.f;
- }
- }
- return new X().foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0243/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0243/Test.java
deleted file mode 100644
index 00bfd26..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0243/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0243;
-import java.util.*;
-public class Test {
- void m(){
- try{
- } catch (Exception e){m();}
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0244/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0244/Test.java
deleted file mode 100644
index 9e54f24..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0244/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0244;
-import java.util.*;
-public class Test {
- void m(){
- try{
- } catch (RuntimeException e){m();}
- catch(Exception e) {}
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0245/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0245/Test.java
deleted file mode 100644
index 2dd2dbf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0245/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0245;
-import java.util.*;
-public class Test {
- public int a() {
- int i= 0;
- return i;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0246/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0246/Test.java
deleted file mode 100644
index 3fb5726..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0246/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0246;
-
-import java.util.*;
-import java.io.IOException;
-
-public class Test {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0247/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0247/Test.java
deleted file mode 100644
index 0ce7333..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0247/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0247;
-import java.util.*;
-public class Test {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0248/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0248/Test.java
deleted file mode 100644
index 0996352..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0248/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0248;
-import java.util.*;
-public class Test {
- native void m(int i);
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0249/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0249/Test.java
deleted file mode 100644
index 877022e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0249/Test.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0249;
-import java.util.*;
-public class Test {
- int k;
- static class j{
- static int k;
- }
- void m(){
- int y= 0;
- j.k= 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0250/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0250/Test.java
deleted file mode 100644
index 6f6ad11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0250/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0250;
-import java.util.*;
-interface Test {
- void m(int i, int j);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0251/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0251/Test.java
deleted file mode 100644
index 323fc5b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0251/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0251;
-import java.util.*;
-public class Test {
- void foo() {
- java.lang.System.out.println();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0252/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0252/Test.java
deleted file mode 100644
index 7aedb36..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0252/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0252;
-import java.util.*;
-public class Test {
- Object foo() {
- final int j = 4;
-
- return new Object() {
- int bar() {
- return j;
- }
- };
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0253/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0253/Test.java
deleted file mode 100644
index de8b589..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0253/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0253;
-import java.util.*;
-public class Test {
- public StringBuffer foo() {
- return new StringBuffer("");
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0254/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0254/Test.java
deleted file mode 100644
index 2b49bb2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0254/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0254;
-import java.util.*;
-public class Test {
-
- class C {
- }
-
- Object foo() {
- return new Test().new C();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0255/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0255/Test.java
deleted file mode 100644
index e1e61f2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0255/Test.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0255;
-import java.util.*;
-public class Test {
- public void bar() {
- foo((String[]) null);
- }
-
- void foo(String[] arg) {
- }
-
- void foo(Object arg) {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0256/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0256/Test.java
deleted file mode 100644
index 59a8caa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0256/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0256;
-import java.util.*;
-public class Test {
- public void bar() {
- foo((Object) null);
- }
-
- void foo(String[] arg) {
- }
-
- void foo(Object arg) {
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0257/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0257/Test.java
deleted file mode 100644
index 32c102c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0257/Test.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0257;
-import java.util.*;
-public class Test {
- public void bar() {
- foo((int) 0);
- }
-
- void foo(int arg) {
- }
-
- void foo(long arg) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0258/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0258/Test.java
deleted file mode 100644
index 41cecc1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0258/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0256;
-import java.util.*;
-public class Test {
- public void bar() {
- foo((java.lang.Object) null);
- }
-
- void foo(String[] arg) {
- }
-
- void foo(Object arg) {
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0259/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0259/Test.java
deleted file mode 100644
index 786971f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0259/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-//cannot rename to i, i
-package test0259;
-public class Test {
- int m(){
- int i, /*[*/int j/*]*/;
- return 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0260/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0260/Test.java
deleted file mode 100644
index f031d4c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0260/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0260;
-import java.util.*;
-public interface Test {
- void m(int i, int j);
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0261/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0261/Test.java
deleted file mode 100644
index 4a6b989..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0261/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0261;
-import java.util.*;
-public class Test {
- public int foo(int variable) {
- return varble; // <-- Unable to resolve binding here
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0262/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0262/Test.java
deleted file mode 100644
index 02349d2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0262/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0262;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new java.lang.Exception("ERROR"));
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0263/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0263/Test.java
deleted file mode 100644
index b75929b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0263/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0263;
-import java.util.*;
-public class Test {
- void m(int i){
- m(i);
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0264/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0264/Test.java
deleted file mode 100644
index a0f8c0d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0264/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0264;
-import java.util.*;
-public class Test {
- void m(final int i){
- Test a= new Test(){
- void m(int k){
- k= i;
- }
- };
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0265/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0265/Test.java
deleted file mode 100644
index f3e7463..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0265/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0265;
-import java.util.*;
-public class Test {
- public int foo() {
- return 10 + /*]*/20 * 30/*[*/ + 10;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0266/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0266/Test.java
deleted file mode 100644
index 85fdd52..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0266/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0266;
-import java.util.*;
-public class Test {
- public static class Inner{}
- public static void m(){
- Inner\u005b] i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0267/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0267/Test.java
deleted file mode 100644
index a2fd880..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0267/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0267;
-import java.util.*;
-public class Test {
- public static class Inner{}
- public static void m(){
- Inner[] i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0268/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0268/Test.java
deleted file mode 100644
index d7753c5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0268/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0268;
-import java.util.*;
-public class Test {
- public static class Inner{}
- public static void m(){
- test0268.Test.Inner[] i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0269/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0269/Test.java
deleted file mode 100644
index b1cae34..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0269/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0269;
-import java.util.*;
-public class Test {
- public static class Inner{}
- public static void m(){
- test0269.Test.Inner[/**/] i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0270/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0270/Test.java
deleted file mode 100644
index 2959bc9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0270/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0270;
-import java.util.*;
-public class Test {
- public static class Inner{}
- public static void m(){
- test0270.Test.Inner i[];
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0271/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0271/Test.java
deleted file mode 100644
index 5ea10fb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0271/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0271;
-import java.util.*;
-public class Test {
- public static class Inner{}
- public static void m(){
- test0271.Test.Inner[] i[];
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0272/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0272/Test.java
deleted file mode 100644
index bfb126a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0272/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0272;
-
-public class Test {
- public void foo() {
- for (int i= 0; i < 10; i++) foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0273/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0273/Test.java
deleted file mode 100644
index 5212a42..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0273/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0273;
-
-public class Test {
- public void foo() {
- for (int i= 0; i < 10; i++) { foo(); }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0274/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0274/Test.java
deleted file mode 100644
index f0bd3ca..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0274/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0274;
-
-public class Test {
- public void foo(int j) {
- int i = 0;
- while (i < 10) { foo(i++); }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0275/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0275/Test.java
deleted file mode 100644
index baab661..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0275/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0275;
-public class Test {
- public void foo(int j) {
- int i = 0;
- while (i < 10) foo(i++);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0276/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0276/Test.java
deleted file mode 100644
index 92b037b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0276/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0276;
-
-public class Test {
- public void foo() {
- foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0277/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0277/Test.java
deleted file mode 100644
index c96ffa6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0277/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0277;
-
-public class Test {
- public void foo() {
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0278/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0278/Test.java
deleted file mode 100644
index d886793..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0278/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0278;
-
-public class Test {
- Class c = java.lang.String.class;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0279/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0279/Test.java
deleted file mode 100644
index c31a26d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0279/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0279;
-
-public class Test {
- void foo() {
- Class c = java.lang.String.class;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0280/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0280/Test.java
deleted file mode 100644
index 37817a0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0280/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0280;
-import java.util.*;
-public class Test {
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0281/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0281/Test.java
deleted file mode 100644
index 41cf840..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0281/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0281;
-
-public class Test {
- Object o= /*]*/new Object()/*[*/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0282/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0282/Test.java
deleted file mode 100644
index 6093411..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0282/Test.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0282;
-public class Test {
- boolean b = /*]*/true/*[*/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0283/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0283/Test.java
deleted file mode 100644
index c0f0b29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0283/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0283;
-
-public class Test {
- char c = /*]*/'c'/*[*/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0284/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0284/Test.java
deleted file mode 100644
index b6add78..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0284/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0284;
-
-public class Test {
- Object o = /*]*/null/*[*/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0285/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0285/Test.java
deleted file mode 100644
index 3129968..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0285/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0285;
-
-public class Test {
- Object o = /*]*/Object.class/*[*/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0286/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0286/Test.java
deleted file mode 100644
index d9b3531..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0286/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0286;
-
-public class Test {
- int i = /**/(2)/**/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0287/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0287/Test.java
deleted file mode 100644
index 3eb5a11..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0287/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0287;
-
-public class Test {
- String[] tab = /**/new String[3]/**/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0288/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0288/Test.java
deleted file mode 100644
index c13bf70..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0288/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0288;
-
-public class Test {
- String[] tab = /**/{ }/**/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0289/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0289/Test.java
deleted file mode 100644
index 69fd582..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0289/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0289;
-import java.util.*;
-public class Test {
- String[] tab1 = new String[] { null} ;
- String s = /**/tab1[0]/**/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0290/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0290/Test.java
deleted file mode 100644
index 7ca9337..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0290/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0290;
-
-public class Test {
- Object o = /*]*/new java.lang.Object()/*[*/;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0291/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0291/Test.java
deleted file mode 100644
index b31ab01..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0291/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0291;
-
-public class Test {
- bar() {}
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0292/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0292/Test.java
deleted file mode 100644
index 54a4631..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0292/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0292;
-
-public class Test {
- int bar() throws Throwable {
- return Test.x;
- }
- static int x;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0293/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0293/Test.java
deleted file mode 100644
index d2dff62..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0293/Test.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0293;
-
-public class Test {
- public void foo() {
- Runnable run= new Runnable() {
- public void run() {
- /*]*/foo();/*[*/
- }
- };
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0294/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0294/Test.java
deleted file mode 100644
index f42f634..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0294/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0294;
-
-public class Test {
- public void fails() {
- foo()
- }
- public void foo() {
- foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0295/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0295/Test.java
deleted file mode 100644
index 9f013db..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0295/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0295;
-
-public class Test {
- public List g() {
- return null;
- }
- public void foo() {
- g();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0296/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0296/Test.java
deleted file mode 100644
index a95fc8f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0296/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0296;
-
-public class Test {
- public void fails() {
- foo()
- }
- public void foo() {
- foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0297/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0297/Test.java
deleted file mode 100644
index 3e27816..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0297/Test.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package test0297;
-
-import java.util.List;
-
-public class Test {
- public List fList;
-
- public void foo() {
- int i= 10;
- switch (i) {
- case 1:
- List l= null;
- break;
- default:
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0298/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0298/Test.java
deleted file mode 100644
index 14e6d13..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0298/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0298;
-import java.util.*;
-public class Test {
- boolean m(){
- return /*[*/a().length != 3/*]*/;
- }
- int[] a(){
- return null;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0299/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0299/Test.java
deleted file mode 100644
index 9b02a0c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0299/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0299;
-
-public class Test {
- int i = (/**/2/**/);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0300/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0300/Test.java
deleted file mode 100644
index 53bba47..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0300/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0300;
-
-public class Test {
- boolean b = /**/true/**/;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0301/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0301/Test.java
deleted file mode 100644
index dbadd4b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0301/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0301;
-
-public class Test {
- Object o = /**/null/**/;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0302/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0302/Test.java
deleted file mode 100644
index 63195d5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0302/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0302;
-import java.util.*;
-public class Test {
- public void foo() {
- /*]*/do
- foo();
- while(1 < 10);/*[*/
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0303/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0303/Test.java
deleted file mode 100644
index 4b656d6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0303/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0303;
-import java.util.*;
-public class Test {
- void foo() {
- char x;
- x = (char)3;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0304/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0304/Test.java
deleted file mode 100644
index 10665f3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0304/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0304;
-
-interface Test {
- public void foo(int arg);
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0307/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0307/Test.java
deleted file mode 100644
index 9e8e7d9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0307/Test.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package test0307;
-
-import java.net.MalformedURLException;
-
-public class Test {
- static class A {
- public A(int i) throws MalformedURLException {
- }
- }
-
- static class B extends A {
- public B() throws MalformedURLException {
- super(10);
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0308/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0308/Test.java
deleted file mode 100644
index 6c40cfa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0308/Test.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package test0308;
-
-import java.net.MalformedURLException;
-
-public class Test {
- static class A {
- public A(int i) throws MalformedURLException {
- }
- }
-
- static class B extends A {
- public B() {
- super(10);
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0309/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0309/Test.java
deleted file mode 100644
index 2a7ba82..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0309/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0309;
-
-public class Test {
- void f(int y){
- int i= (y==7) ? 1 : 2 ;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0310/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0310/Test.java
deleted file mode 100644
index 6c9894e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0310/Test.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0310;
-
-class Test {
- private static final String G = I.GR;
-
- public static void c(){
- Object cp = null;
- }
-}
-
-interface I {
- String GR= "l";
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0311/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0311/Test.java
deleted file mode 100644
index e039de2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0311/Test.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0311;
-
-public class Test {
- void m(){
- final int j= 0;
- Test a= new Test(){
- void m(int j){
- int u= j;
- }
- };
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0312/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0312/Test.java
deleted file mode 100644
index e070720..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0312/Test.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0312;
-
-public class Test {
- void m(){
- final int j= 0;
- A a= new A(){
- void m(int j){
- int u= j;
- }
- };
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0313/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0313/Test.java
deleted file mode 100644
index f40e98b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0313/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0313;
-
-public class Test {
- void m(int i, int j){
- int u= i+j;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0314/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0314/Test.java
deleted file mode 100644
index b83330f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0314/Test.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package test0314;
-public class Test {
-public static void main(String args[]) { int x= 3;}}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0315/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0315/Test.java
deleted file mode 100644
index 0f2d077..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0315/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0315;
-public class Test {
- boolean foo() {
- return "abc" instanceof java.io.Serializable;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0317/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0317/Test.java
deleted file mode 100644
index 1efa1dd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0317/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0317;
-
-import java.util.Vector;
-
-public class Test {
- public boolean foo(Object x) {
- return x instanceof Vector;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0318/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0318/Test.java
deleted file mode 100644
index 74cb5f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0318/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0318;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- private int x;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0319/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0319/Test.java
deleted file mode 100644
index 92d549e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0319/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0319;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- java.lang.Object[] obj= new Object[10];
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0320/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0320/Test.java
deleted file mode 100644
index 1792e33..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0320/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0320;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- int[] tab = new int[10];
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0321/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0321/Test.java
deleted file mode 100644
index d5a8830..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0321/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0321;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- java.lang.Object[][] obj= new Object[10][0];
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0322/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0322/Test.java
deleted file mode 100644
index 3c8dc79..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0322/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0322;
-
-public class Test {
- Object fField= null;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0323/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0323/Test.java
deleted file mode 100644
index d4e2c5b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0323/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0323;
-
-public class Test {
- void foo() {
- String x;
- x = (java.lang.Object) "s";
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0324/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0324/Test.java
deleted file mode 100644
index 6f73e57..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0324/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0324;
-
-public class Test {
- void foo() {
- Object x;
- x = (java.lang.Object[]) null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0325/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0325/Test.java
deleted file mode 100644
index 30fb377..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0325/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0325;
-
-public class Test {
- void foo() {
- Object x;
- x = (int[]) null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0326/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0326/A.java
deleted file mode 100644
index 4df7ab0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0326/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0326;
-
-public class A {
- A f;
- public A a() {
- a().f= a();
- return null;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0327/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0327/Test.java
deleted file mode 100644
index 24fe09a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0327/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0327;
-
-import java.util.Vector;
-
-public class Test {
- public static void goo(Object o) {
- Vector s= (String) ooo;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0328/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0328/Test.java
deleted file mode 100644
index 3d9b203..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0328/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0328;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- java.lang.Object[] obj= new Object[] {null, new Object()};
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0329/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0329/Test.java
deleted file mode 100644
index b558a28..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0329/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0329;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- java.lang.Object[] obj= new Object[] {};
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0330/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0330/Test.java
deleted file mode 100644
index f084196..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0330/Test.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0330;
-
-public class Test {
- public foo() {
- return 0;
- }
-}
-
-class A {
- void bar() {
- new Test().foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0331/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0331/Test.java
deleted file mode 100644
index 3114c30..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0331/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0331;
-
-public class Test {
- public static void main(String[] args) {
- int i = args.length;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0332/LocalSelectionTransfer.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0332/LocalSelectionTransfer.java
deleted file mode 100644
index 2847c24..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0332/LocalSelectionTransfer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package test0332;
-
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jdt.internal.ui.JavaUIMessages;
-
-public class LocalSelectionTransfer extends ByteArrayTransfer {
-
- // First attempt to create a UUID for the type name to make sure that
- // different Eclipse applications use different "types" of
- // <code>LocalSelectionTransfer</code>
- private static final String TYPE_NAME= "local-selection-transfer-format" + (new Long(System.currentTimeMillis())).toString(); //$NON-NLS-1$;
- private static final int TYPEID= registerType(TYPE_NAME);
-
- private static final LocalSelectionTransfer INSTANCE= new LocalSelectionTransfer();
-
- private ISelection fSelection;
- private int fTime;
-
- private LocalSelectionTransfer() {
- }
-
- /**
- * Returns the singleton.
- */
- public static LocalSelectionTransfer getInstance() {
- return INSTANCE;
- }
-
- /**
- * Sets the transfer data for local use.
- */
- public void setSelection(ISelection s) {
- fSelection= s;
- }
-
- /**
- * Returns the local transfer data.
- */
- public ISelection getSelection() {
- return fSelection;
- }
-
- public void javaToNative(Object object, TransferData transferData) {
- byte[] check= TYPE_NAME.getBytes();
- super.javaToNative(check, transferData);
- }
-
- public Object nativeToJava(TransferData transferData) {
- Object result= super.nativeToJava(transferData);
- if (isInvalidNativeType(result)) {
- JavaPlugin.logErrorMessage(JavaUIMessages.getString("LocalSelectionTransfer.errorMessage")); //$NON-NLS-1$
- }
- return fSelection;
- }
-
- private boolean isInvalidNativeType(Object result) {
- return !(result instanceof byte[]) || !TYPE_NAME.equals(new String((byte[])result));
- }
-
- /**
- * The type id used to identify this transfer.
- */
- protected int[] getTypeIds() {
- return new int[] {TYPEID};
- }
-
- protected String[] getTypeNames(){
- return new String[] {TYPE_NAME};
- }
-
- public int getTime() {
- return fTime;
- }
-
- public void setTime(int time) {
- fTime= time;
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0333/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0333/Test.java
deleted file mode 100644
index a2a9032..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0333/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0333;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- java.lang.Object[][] obj= new Object[10][];
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0334/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0334/Test.java
deleted file mode 100644
index 92e6861..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0334/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0334;
-
-public class Test {
- static void ___run(java.lang.String[] args) throws Throwable {
- java.lang.Object[][][] obj= new Object[10][][];
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0335/ExceptionTestCaseTest.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0335/ExceptionTestCaseTest.java
deleted file mode 100644
index 825858e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0335/ExceptionTestCaseTest.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0335;
-
-public class ExceptionTestCaseTest extends junit.framework.TestCase {
-
- public ExceptionTestCaseTest(String s) {
- super(s);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0336/SorterTest.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0336/SorterTest.java
deleted file mode 100644
index 498bdc9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0336/SorterTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0336;
-
-import junit.runner.Sorter;
-import java.util.Vector;
-
-public class SorterTest {
- static class Swapper implements Sorter.Swapper {
- public void swap(Vector values, int left, int right) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0337/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0337/Test.java
deleted file mode 100644
index 827f7ac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0337/Test.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0337;
-
-public class Test {
- String message= Test.m("s", new String[]{"g"});
-
- static String m(String g, String[] s){
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0338/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0338/Test.java
deleted file mode 100644
index 53227c5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0338/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0338;
-
-import java.io.IOException;
-
-public class Test {
- public void foo() throws IOException {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0339/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0339/Test.java
deleted file mode 100644
index efe8c40..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0339/Test.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0339;
-
-public class Test {
- public static interface X {
- int doQuery(boolean x);
- }
-
- public void setX(boolean x) {
- {
- z
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0341/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0341/A.java
deleted file mode 100644
index f5b9806..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0341/A.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package test0341;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.util.Vector;
-
-public class A {
-
- private Vector field;
-
- public void l()
- throws
- IOException,
- MalformedURLException,
- InterruptedIOException,
- UnsupportedEncodingException {
- if (field != null) {
- throw new IOException();
- } else if (field == null) {
- throw new MalformedURLException();
- } else if (field == null) {
- throw new InterruptedIOException();
- } else {
- throw new UnsupportedEncodingException();
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0342/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0342/Test.java
deleted file mode 100644
index 6d9a354..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0342/Test.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package test0342;
-
-public class Test {
-
- public int junk1(int i) {
- return 0;
- }
-
- public long junk2() {
- return 0;
- }
-
- public Object junk3() {
- return null;
- }
-
- Test(int i) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0343/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0343/Test.java
deleted file mode 100644
index 82db57d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0343/Test.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0343;
-
-public class Test {
-
- public volatile boolean flag;
-
- public void foo() {
- int i= 5;
- /*]*/if (flag)
- i= 10;/*[*/
- i--;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0344/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0344/Test.java
deleted file mode 100644
index b099362..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0344/Test.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0344;
-
-public class Test {
-
- public void bugTest() {
- System.out.println("bla");
- System.out.println("blubb");
- }
-
- private void containsAssert() {
- assert true;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0345/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0345/A.java
deleted file mode 100644
index 8c869d7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0345/A.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0345;
-
-public class A {
- Bar.B[] field= new Bar.B[]{
- new Bar.B()
- };
- void f(){
- int temp;
- }
-}
-
-class Bar{
- static class B{}
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0346/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0346/Test2.java
deleted file mode 100644
index 33c8e40..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0346/Test2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0346;
-
-import java.util.Vector;
-
-public class Test2 {
- public static void main(String[] arguments) {
- Vector editors[]= null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0347/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0347/Test2.java
deleted file mode 100644
index 7a77389..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0347/Test2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0347;
-
-import java.util.Vector;
-
-public class Test2 {
- public static void main(String[] arguments) {
- Vector[] editors[]= null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0348/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0348/Test2.java
deleted file mode 100644
index 0afb916..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0348/Test2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0348;
-
-import java.util.Vector;
-
-public class Test2 {
- public static void main(String[] arguments) {
- Vector[][] editors[]= null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0349/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0349/Test2.java
deleted file mode 100644
index 0a5a715..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0349/Test2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0349;
-
-import java.util.Vector;
-
-public class Test2 {
- Vector[][] editors[]= null;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0350/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0350/Test2.java
deleted file mode 100644
index a38d20f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0350/Test2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0350;
-
-import java.util.Vector;
-
-public class Test2 {
- Vector editors[]= null;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0351/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0351/Test2.java
deleted file mode 100644
index bdcdd53..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0351/Test2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0351;
-
-public class Test2 {
- void m1(int a, int[] b){}
- void m(int a, int b[]){}
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0352/Test2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0352/Test2.java
deleted file mode 100644
index bd69890..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0352/Test2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0352;
-
-public class Test2 {
- void m1(final int a, final int[] b){}
- void m(final int a, final int b[]){}
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0353/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0353/Test.java
deleted file mode 100644
index 98be0c1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0353/Test.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0353;
-
-import java.io.InputStream;
-
-public class Test {
- void foo() {
- InputStream i = null;
- while (true);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0354/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0354/Test.java
deleted file mode 100644
index 4c13d28..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0354/Test.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0354;
-
-public class Test {
-
- protected void primExecute() {
- this.toString();
- }
-
- if (image != null) {
- Object loc = null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0355/Foo.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0355/Foo.java
deleted file mode 100644
index d3be497..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0355/Foo.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0355;
-
-public class Foo {
- public Object bar() {
- if ( ((Object)null).toString() == null ) {
- return (Object)null;
- }
- return null;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/A.java
deleted file mode 100644
index 07e05a2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0356;
-
-public class A {
-
-}
-
-class ActionFactory {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/X.java
deleted file mode 100644
index 50363bd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0356/X.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0356;
-
-public class X {
- public void foo() {
- ActionFactory af=new MyActionFactory();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0357/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0357/A.java
deleted file mode 100644
index 57410b5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0357/A.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package test0357;
-class A{
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0358/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0358/A.java
deleted file mode 100644
index 76e0803..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0358/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0358;
-
-class A {
- public void mdd(int y){
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0359/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0359/A.java
deleted file mode 100644
index f1800c1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0359/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0359;
-
-class A {
- public void mdd(int y) throws Exception{
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0360/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0360/X.java
deleted file mode 100644
index 8202064..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0360/X.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0360;
-
-public class X {
- public void foo() {
- for (int i=0, j=0, k=0; i<10 ; i++,j++,k++) {
- System.out.println("L");
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0361/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0361/X.java
deleted file mode 100644
index 171ae69..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0361/X.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0361;
-
-public class X {
- public void foo() {
- for (int i=0; i<10 ; i++) {
- System.out.println("L");
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0362/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0362/Test.java
deleted file mode 100644
index eb1a242..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0362/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0362;
-/* Regression test for bug 21916 */
-public class Test {
- public void foo(int i) {
- for (int i=0, j=0, k=0; i<10 ; i++, j++, k++) {}
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0363/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0363/A.java
deleted file mode 100644
index 8d13a1d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0363/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0363;
-/* Regression test for bug 22939 */
-public class A {
- void f(){
- String xxxx= "xx";
- String y= ( xxxx );
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0364/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0364/A.java
deleted file mode 100644
index 4577f24..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0364/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0364;
-/* Regression test for bug 11529 */
-public class A {
- void theMethod() {
- int local;
-/* for (int i = 0; i < 5; ++i) {
- }*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0365/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0365/A.java
deleted file mode 100644
index f5da97d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0365/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0365
-;
-/* Regression test for bug 11529 */
-public class A {
- void theMethod() {
- for (int i = 0; i < 5; ++i) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0366/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0366/A.java
deleted file mode 100644
index b4bf025..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0366/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0366;
-
-/* Regression test for bug 23048 */
-
-public class A {
- void theMethod() {
- for (int i = 0; i < 5; ++i);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0367/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0367/A.java
deleted file mode 100644
index 34be725..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0367/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0367;
-
-/* Regression test for bug 23048 */
-
-public class A {
- void theMethod(int i) {
- while(i == 2);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0368/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0368/A.java
deleted file mode 100644
index 1cfc21d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0368/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0368;
-
-/* Regression test for bug 23048 */
-
-public class A {
- void foo() {
- test:;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0369/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0369/A.java
deleted file mode 100644
index 0e6a417..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0369/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0369;
-
-/* Regression test for bug 23048 */
-
-public class A {
- void foo() {
- test:\u003B
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0370/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0370/Test.java
deleted file mode 100644
index c75b1fb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0370/Test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0370;
-
-public class Test {
- public void foo() {
- do ; while(true);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0371/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0371/A.java
deleted file mode 100644
index 7b31660..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0371/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0371;
-
-/* Regression test for bug 23048 */
-
-public class A {
- void foo(int i) {
- if (i == 6);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0372/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0372/A.java
deleted file mode 100644
index 19736a9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0372/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0372;
-
-/* Regression test for bug 23048 */
-
-public class A {
- void foo(int i) {
- if (i == 6) {} else ;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0373/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0373/A.java
deleted file mode 100644
index cc9aaf9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0373/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0373;
-
-/* Regression test for bug 23118 */
-
-public class A {
- void foo() {
- for (int i = 0; i < 10; i++) {
- break;
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0374/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0374/A.java
deleted file mode 100644
index 072393c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0374/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0374;
-
-/* Regression test for bug 23118 */
-
-public class A {
- void foo() {
- for (int i = 0; i < 10; i++) {
- continue;
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0375/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0375/A.java
deleted file mode 100644
index 521300d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0375/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0375;
-
-import test0375.A.*;
-
-/* Regression test for bug 23052 */
-
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0376/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0376/A.java
deleted file mode 100644
index 1a8aeb5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0376/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0376;
-
-class A {
- void f() {
- A a = ( A ) this;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0377/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0377/A.java
deleted file mode 100644
index f33de36..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0377/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0377;
-
-class A {
- void f() {
- final int i;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0378/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0378/A.java
deleted file mode 100644
index 172d316..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0378/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0378;
-
-public class A {
- public static class B {
- public void foo() {
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0379/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0379/Test.java
deleted file mode 100644
index 61c397d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0379/Test.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0005;
-import java.util.*;
-public class Test {
- public static void main(String[] args) {
- System.out.println(new Object() {});
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0380/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0380/A.java
deleted file mode 100644
index 23a832b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0380/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0380;
-
-public class A {
- public String toString() {
- return super.toString();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0381/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0381/A.java
deleted file mode 100644
index 32cad02..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0381/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0381;
-
-public class A {
- /** Method theMethod.*/
- void theMethod() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0382/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0382/A.java
deleted file mode 100644
index b62f395..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0382/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0382;
-
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0383/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0383/A.java
deleted file mode 100644
index 3e2b834..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0383/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0383;
-
-public class A {
- public static class B {
- public void foo() {
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0384/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0384/A.java
deleted file mode 100644
index 8cfde5e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0384/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0384;
-
-public class A {
- public static class B {
- public class D {
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0385/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0385/A.java
deleted file mode 100644
index e76572a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0385/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0385;
-
-public class A {
-
- int getClass() {
- return 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0386/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0386/A.java
deleted file mode 100644
index e16ef2f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0386/A.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0386;
-
-public class A {
-
- void foo(int i) {
- switch(i) {
- case 1:
- System.out.println();
- break;
- default :
- return;
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0387/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0387/A.java
deleted file mode 100644
index 88c205c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0387/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0387;
-
-class A {
- void f() {
- A a = (\u0020A\u0020) this;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0388/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0388/A.java
deleted file mode 100644
index 0572d3c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0388/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0388;
-
-class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0389/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0389/A.java
deleted file mode 100644
index 5ed8eb9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0389/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0389;
-
-class A {
- class B {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0390/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0390/A.java
deleted file mode 100644
index 0773346..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0390/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0390;
-
-class A {
- int foo() {
- return 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0391/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0391/A.java
deleted file mode 100644
index 1a8f5d8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0391/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0391;
-
-class A {
- int[] foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0392/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0392/A.java
deleted file mode 100644
index 7590cb1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0392/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0392;
-
-class A {
- String[] foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0393/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0393/A.java
deleted file mode 100644
index 833f0ee..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0393/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0393;
-
-class A {
- String foo()[] {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0394/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0394/A.java
deleted file mode 100644
index 5209c7c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0394/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0394;
-
-class A {
- String foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0395/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0395/A.java
deleted file mode 100644
index 7ac5525..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0395/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0395;
-
-class A {
- String[] foo()[] {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0396/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0396/A.java
deleted file mode 100644
index f414ff5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0396/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0396;
-
-public class A {
- public void foo(final String s[]) {
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0397/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0397/A.java
deleted file mode 100644
index ad05b6b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0397/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0397;
-
-public class A {
- public void foo(final String[] \u0073\u005B][]) {
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0398/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0398/A.java
deleted file mode 100644
index 07c565a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0398/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0397;
-
-public class A {
- public void foo() {
- int i= (1 + 2) * 3;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0399/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0399/A.java
deleted file mode 100644
index 5210904..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0399/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0399;
-
-public class A {
- public A() {
- int i;
- int k;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0400/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0400/A.java
deleted file mode 100644
index d1a5a6c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0400/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0400;
-
-public class A {
- public A() {
- super();
- int i;
- int k;
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0401/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0401/A.java
deleted file mode 100644
index 36a193a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0401/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0401;
-
-public class A {
- correctThis() {
- return 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0402/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0402/A.java
deleted file mode 100644
index 09395cc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0402/A.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0402;
-
-class A{
- class Inner{
- Inner(){
- }
- }
-}
-
-class I2 extends A.Inner{
- I2(){
- new A().super();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0403/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0403/A.java
deleted file mode 100644
index 5a9f6eb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0403/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0403;
-
-class Test {
- public void foo(){};
-}
-
-public class A {
- void test1() throws CloneNotSupportedException {
- Test test = new Test();
- test.clone();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0404/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0404/A.java
deleted file mode 100644
index 3dfd14d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0404/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0404;
-
-class A{
- void f() {
- A a= new A();
- a.clone();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0405/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0405/A.java
deleted file mode 100644
index 9c334de..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0405/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0405;
-
-class A {
- public void foo() {
- }
-}
-
-class Test {
- void test() throws CloneNotSupportedException {
- A a = new A();
- a.clone();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0406/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0406/A.java
deleted file mode 100644
index daac5e6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0406/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0406;
-
-import test0406_a.A;
-
-class Test {
- void test() {
- A a = new A();
- a.foo("");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0406_a/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0406_a/A.java
deleted file mode 100644
index 63b2df5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0406_a/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0406_a;
-
-public class A {
- protected A foo(String s) {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0407/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0407/A.java
deleted file mode 100644
index c677b13..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0407/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0407;
-
-public class A {
- void foo() {
- }
- void bar() {
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0408/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0408/A.java
deleted file mode 100644
index c4fc2c8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0408/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0408;
-
-public class A {
- java.lang.Object foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0409/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0409/A.java
deleted file mode 100644
index 057bd8e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0409/A.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package test0409;
-
-import java.lang.*;
-import java.lang.Object;
-
-class Super extends java.lang.Object {
- int k;
-
- int foo2() {
- return 0;
- }
-}
-/**
- *
- */
-public class A extends Super implements Cloneable {
-
- public static final int i = 0;
-
- {
- int j;
- }
-
- int[] foo(float f) throws Exception {
- assert f > 0 : "it works";
- {
- }
- test: for (int i = 0; i < 10; i++) {
- if (f > 0) {
- break test;
- } else {
- continue test;
- }
- }
- Object o = new Object();
- do {
- o = null;
- } while (o != null);
- ;
- if (o == null) {
- throw new Exception();
- }
- int j = 9;
- switch(j) {
- case 4 :
- break;
- default :
- return null;
- }
- synchronized(o) {
- }
- try {
- System.out.println();
- } catch(Exception e) {
- System.out.println();
- } finally {
- j = (int) 'c';
- }
- while (j > 0) {
- --j;
- }
- int[] tab = { 1, 2, 3, 4};
- j = tab[3];
- boolean b = (true && false);
-
- j = o instanceof Object ? 4 : 5 + 9;
-
- j = k;
-
- j = foo2();
-
- o = this.bar();
-
- o = A.class;
-
- return new int[] {};
- }
-
- Object bar() {
- class C {
- }
- return new C() {};
- }
-
- A() {
- this(0);
- }
-
- A(int i) {
- super();
- }
-
- class B {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0410/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0410/A.java
deleted file mode 100644
index 959fece..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0410/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0410;
-
-public class A {
- int foo() {
- return 1 + 2 + 3 + 4 + 3;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0411/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0411/A.java
deleted file mode 100644
index cebea1d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0411/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0411;
-
-public class A {
-
- int bar(int a, int b) {
- return a*b + 2 + foo();
- }
-
- int foo() {
- return 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0412/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0412/A.java
deleted file mode 100644
index 7f3d9a9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0412/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0412;
-
-interface A {
- void m();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0413/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0413/A.java
deleted file mode 100644
index 147c17c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0413/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0413;
-
-class E extends Exception {
-}
-
-interface A {
- void m() throws IOException, E;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/A.java
deleted file mode 100644
index 955b4de..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0414;
-
-public class A {
- B foo() {
- return null;
- }
-
- A bar() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/B.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/B.java
deleted file mode 100644
index 98bdac5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0414/B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0414;
-
-class B {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0415/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0415/A.java
deleted file mode 100644
index be042d8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0415/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0415;
-
-public class A {
- public void foo(int i) {
- switch(i) {
- case 2:
- System.out.println();
- break;
- default:
- System.out.println();
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0416/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0416/A.java
deleted file mode 100644
index 41a5d84..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0416/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0416;
-
-interface I {
- int CONST= 1;
-}
-
-public class A {
- void foo() {
- int x= I.CONST;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0417/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0417/A.java
deleted file mode 100644
index 9132f7b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0417/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0417;
-
-public class A {
- void foo() {
- A.NewClass c;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0418/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0418/A.java
deleted file mode 100644
index 4ee0dbd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0418/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0418;
-
-public class A {
- private void foo() {
- }
-
- private static void goo() {
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0419/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0419/A.java
deleted file mode 100644
index 814090a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0419/A.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0419;
-
-class C {
- private int fCoo;
-}
-
-public class A {
- public static void goo(C c) {
- fCoo= 1;
-/* super.fCoo= 1;
- C.fCoo= 1;
- c.fCoo= 1;*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0420/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0420/A.java
deleted file mode 100644
index 965dc93..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0420/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0420;
-
-public class A{
- void f(){
- int i= 1 + (2 + 3) + 4;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0421/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0421/A.java
deleted file mode 100644
index 4fc7789..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0421/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0421;
-
-public class A{
- void f(){
- int i= (1 + 2) + 3;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0422/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0422/A.java
deleted file mode 100644
index ba544ff..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0422/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0422;
-
-public class A{
- void f(){
- int i= ( 1 + 2 ) + 3;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0423/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0423/A.java
deleted file mode 100644
index b3087f8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0423/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0423;
-
-public class A{
- void f(){
- int i= 1 + ( 2 + 3 ) + 4;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0424/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0424/A.java
deleted file mode 100644
index 1d800ea1b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0424/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0424;
-
-public class A{
- void f(){
- int i= 1 + 4 + ( 2 + 3 );
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0425/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0425/A.java
deleted file mode 100644
index f1c0b69..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0425/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0425;
-
-public class A{
- void f(){
- int i= 1 + 4 * ( 2 + 3 );
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0426/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0426/A.java
deleted file mode 100644
index b691449..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0426/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0426;
-
-class C {
- private class CInner {
- }
-}
-
-public class A extends C {
- public static void goo() {
- CInner c;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0427/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0427/A.java
deleted file mode 100644
index fced81f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0427/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0427;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public static void goo(C c) {
- super.fCoo= 1;
-/* C.fCoo= 1;
- c.fCoo= 1;*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0428/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0428/A.java
deleted file mode 100644
index a8325f8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0428/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0428;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public static void goo(C c) {
- C.fCoo= 1;
-// c.fCoo= 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0429/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0429/A.java
deleted file mode 100644
index 7f3a603..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0429/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0429;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public static void goo(C c) {
- c.fCoo= 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0430/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0430/A.java
deleted file mode 100644
index 1545223..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0430/A.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0430;
-
-public class A {
- private A() {
- this(coo2());
- }
-
- private A(int i) {
- }
-
- private int coo2() {
- return 7;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0431/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0431/A.java
deleted file mode 100644
index fb86b8d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0431/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0431;
-
-public class A {
- private A() {
- this(fCoo);
- }
-
- private A(int i) {
- }
-
- private int fCoo= 8;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0432/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0432/A.java
deleted file mode 100644
index 0716e2a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0432/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0432;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public void goo(C c) {
- fCoo= 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0433/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0433/A.java
deleted file mode 100644
index ba532c3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0433/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0433;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public void goo(C c) {
- super.fCoo= 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0434/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0434/A.java
deleted file mode 100644
index dba8ca3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0434/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0434;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public void goo(C c) {
- C.fCoo= 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0435/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0435/A.java
deleted file mode 100644
index 332ab2e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0435/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0435;
-
-class C {
- private int fCoo;
-}
-
-public class A extends C {
- public void goo(C c) {
- c.fCoo= 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0436/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0436/A.java
deleted file mode 100644
index 545bbb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0436/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0436;
-
-class A {
- private class CInner {
- }
-}
-
-public class D extends A {
- public void goo() {
- A.CInner a;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0437/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0437/A.java
deleted file mode 100644
index ed6b3a2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0437/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0437;
-
-class A {
- private class CInner {
- }
-}
-
-public class D extends A {
- public void goo() {
- CInner a;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0438/D.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0438/D.java
deleted file mode 100644
index 74aecbd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0438/D.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0438;
-
-import test0438_a.W;
-
-class D {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0438_a/W.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0438_a/W.java
deleted file mode 100644
index 8866bee..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0438_a/W.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0438_a;
-
-class W {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/C.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/C.java
deleted file mode 100644
index 544cf58..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/C.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0439;
-
-public class C {
- private class CInner {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/E.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/E.java
deleted file mode 100644
index cf793ab..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0439/E.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0439;
-
-public class E extends C {
- public void foo() {
- CInner c= null;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0440/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0440/A.java
deleted file mode 100644
index 3653f6d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0440/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0440;
-
-public class A {
- void test() {
- String i= 2 * 3 + "" + (true);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0441/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0441/A.java
deleted file mode 100644
index 5b629aa..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0441/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0441;
-
-public class A {
- void test() {
- int i= (2 + 2) * 3 * 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0442/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0442/A.java
deleted file mode 100644
index 9c094f6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0442/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0442;
-
-public class A {
- void test() {
- int i= 2 + (2 * 3) + 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0443/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0443/A.java
deleted file mode 100644
index 740c635..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0443/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0443;
-
-public class A {
- public abstract void foo() {
- return;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0444/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0444/A.java
deleted file mode 100644
index 150b3bd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0444/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0444;
-
-public class A {
- public void foo() {
- return;
- }
-
- public void foo() {
- return;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0445/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0445/A.java
deleted file mode 100644
index b5d82fe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0445/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0445;
-
-import java.io.IOException;
-
-public class A {
- public void goo() throws IOException {
- }
- public void foo() {
- goo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0446/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0446/A.java
deleted file mode 100644
index 75f0f8c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0446/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0446;
-
-public class A {
- void foob() {
- int b = b;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0447/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0447/A.java
deleted file mode 100644
index 8e13c41..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0447/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0447;
-
-public class A {
- public static void collectCorrections() {
- processors= null;
- }
- try {
- int id= 2;
- } catch (CoreException e) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0448/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0448/A.java
deleted file mode 100644
index cae57dc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0448/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0448;
-
-public class A {
- A() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0449/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0449/A.java
deleted file mode 100644
index 0d14043..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0449/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0449;
-
-public class A {
- A() {
- super();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0450/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0450/A.java
deleted file mode 100644
index bd63e5a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0450/A.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package test0450;
-
-public final class A {
-
- void outerMethod() {
-
- new Object() {
-
- class Subroutine {
- class B {
- }
- }
-
- private void innerMethod() {
- class B {
- }
- Subroutine sub = null;
- }
-
- };
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0451/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0451/A.java
deleted file mode 100644
index 72e8a5b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0451/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0451;
-
-public class A {
- private int A()[]{
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0453/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0453/A.java
deleted file mode 100644
index 7ebbe63..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0453/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0453;
-
-public class A {
- public String foo() {
- return super.toString();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0454/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0454/A.java
deleted file mode 100644
index c4e0717..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0454/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0454;
-
-public class A {
-
- public A() {
- int a= 2;
- int b= (int) (3.14f * a);
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0455/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0455/A.java
deleted file mode 100644
index 389cdbf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0455/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0455;
-
-public class A {
-
- public void foo() {
- for (int i = 0; i < 10; i++) // for 1
- for (int j = 0; j < 10; j++) // for 2
- if (true) { }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0456/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0456/A.java
deleted file mode 100644
index 0f61b0e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0456/A.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package test0456;
-
-public class A {
- public void main() {
- for (int x= 10; x < 20; x++)
- main();
- /*]*/foo(10);/*[*/
- }
-
- public void foo(int x) {
- x= 20;
- bar(x);
- }
-
- public void bar(int z) {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0457/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0457/A.java
deleted file mode 100644
index 28dbc48..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0457/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0457;
-
-public class A {
- public void foo() {
- for (int i= 10; i < 10; i++)/*[*/
- for (int z= 10; z < 10; z++)
- foo();
- /*]*/foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0458/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0458/A.java
deleted file mode 100644
index 54997b3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0458/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0458;
-
-public class A {
- public void foo() {
- for (int i= 10; i < 10; i++)/*[*/
- for (int z= 10; z < 10; z++)
- ;
- /*]*/foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0459/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0459/A.java
deleted file mode 100644
index d4cc5fb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0459/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0459;
-
-public class A {
- public void foo() {
- for (int i= 10; i < 10; i++)/*[*/
- for (int z= 10; z < 10; z++)
- { }
- /*]*/foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0460/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0460/A.java
deleted file mode 100644
index dfb46f1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0460/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0460;
-
-public class A {
- public void foo() {
- final int bar;
-
- bar = 1;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0461/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0461/A.java
deleted file mode 100644
index eb495ef..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0461/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0461;
-
-public class A {
- public void foo() {
- z= foo().y.toList();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0463/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0463/A.java
deleted file mode 100644
index 5ce1c2a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0463/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0463;
-
-public class A {
- public String foo() {
- return "\012\015\u0061";
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0464/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0464/A.java
deleted file mode 100644
index 4377f5c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0464/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0464;
-
-public class A {
-
- public static int foo() {
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0465/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0465/A.java
deleted file mode 100644
index 9144ece..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0465/A.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0465;
-
-public class A {
-
- int i;
-
- public int foo() {
- return this.i;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0466/Assert.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0466/Assert.java
deleted file mode 100644
index fa1e249..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0466/Assert.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package test0466;
-
-public class Assert {
- public static final void notNull(Object ref, String message)
- {
- assert ref != null : message;
- }
-
- void method(String param1, String param2, String param3)
- {
- Assert.notNull(param1, "param1 != null");
- Assert.notNull(param2, "param2 != null");
- Assert.notNull(param3, "param3 != null");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0467/Assert.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0467/Assert.java
deleted file mode 100644
index c131ab6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0467/Assert.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package test0467;
-
-public class Assert {
- public static final void notNull(Object ref, String message)
- {
- assert ref != null : message\u003B
- assert ref != null\u003B
- }
-
- void method(String param1, String param2, String param3)
- {
- Assert.notNull(param1, "param1 != null");
- Assert.notNull(param2, "param2 != null");
- Assert.notNull(param3, "param3 != null");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0468/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0468/A.java
deleted file mode 100644
index 2a7bed8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0468/A.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0468;
-
-public class A {
-
- int i;
-
- public int foo() {
- return this.i;
- }
-
- public void bar() {
- foo();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0470/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/test0470/A.java
deleted file mode 100644
index 15ca873..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/test0470/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0470;
-
-public class A {
-
- public void foo() {
- for (int i= 0, j= goo(3); i < 0; i++) {
- }
- }
-
- int goo(int i) {
- return 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.classpath b/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.classpath
deleted file mode 100644
index 49cabdd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.project b/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/src/A.java b/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/src/A.java
deleted file mode 100644
index a2c0385..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/CreateMembers/src/A.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public class A
-{}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.classpath b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.classpath
deleted file mode 100644
index 8557ccf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="lib" path="lib"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.project b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.project
deleted file mode 100644
index 2ed6436..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>JavaProjectLibTest</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/lib/p/Y.class b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/lib/p/Y.class
deleted file mode 100644
index 220e66f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectLibTests/lib/p/Y.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.classpath b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.classpath
deleted file mode 100644
index 49cabdd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.project b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/src/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/src/A.java
deleted file mode 100644
index b987fb2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectSrcTests/src/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A {
-
- public void foo(){
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.classpath b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.classpath
deleted file mode 100644
index 068e118..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="lib.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.project b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/B.java
deleted file mode 100644
index ebbe4dc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/B.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public class B {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/bin/dummy b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/bin/dummy
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/bin/dummy
+++ /dev/null
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/lib.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/lib.jar
deleted file mode 100644
index e2aadfd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/lib.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/A.java
deleted file mode 100644
index b987fb2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A {
-
- public void foo(){
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/readme.txt b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/readme.txt
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/q/readme.txt
+++ /dev/null
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme.txt b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme.txt
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme.txt
+++ /dev/null
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme2.txt b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme2.txt
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/readme2.txt
+++ /dev/null
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/y/Main.java b/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/y/Main.java
deleted file mode 100644
index 7159036..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaProjectTests/x/y/Main.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package x.y;
-
-import java.io.Serializable;
-/**
- * A class that uses the minimal library.
- */
-public class Main {
- public static void main(String[] args) {
- new Main().toString();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.classpath b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.classpath
deleted file mode 100644
index 3a2ac82..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="otherSrc()"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="MyJar.jar"/>
- <classpathentry kind="lib" path="test20631.jar" sourcepath="/JavaSearch/test20631.zip" rootpath=""/>
- <classpathentry kind="lib" path="test24741.jar" sourcepath="/JavaSearch/test24741.jar" rootpath=""/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.project b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/AbortCompilation.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/AbortCompilation.jar
deleted file mode 100644
index 2d827f8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/AbortCompilation.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/MyJar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/MyJar.jar
deleted file mode 100644
index 9b07c50..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/MyJar.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/NotInClasspath/p/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/NotInClasspath/p/Y.java
deleted file mode 100644
index 0823bc4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/NotInClasspath/p/Y.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package p;
-public class Y extends X {
- public Y() {
- }
- public Y(int i) {
- super(i);
- }
- public Y(boolean b) {
- super(1);
- }
- public static void bar() {
- }
-}
diff --git "a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc\050\051/X31997.java" "b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc\050\051/X31997.java"
deleted file mode 100644
index 43a68e8..0000000
--- "a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc\050\051/X31997.java"
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Test case for bug 31997 Refactoring d.n. work for projects with brackets in name. */
-public class X31997 {
-}
diff --git "a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc\050\051/Y31997.java" "b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc\050\051/Y31997.java"
deleted file mode 100644
index 027ef58..0000000
--- "a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/otherSrc\050\051/Y31997.java"
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Test case for bug 31997 Refactoring d.n. work for projects with brackets in name. */
-public class Y31997 extends X31997 {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/A.java
deleted file mode 100644
index 42c079c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Test case for 1GKZ8VZ: ITPJCORE:WINNT - Search - did not find references to member constructor */
-public class A {
- public class Inner {
- public Inner(int i) {
- }
- }
- Inner[] field = new Inner[] {new Inner(1), new Inner(2)};
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/B.java
deleted file mode 100644
index eeb6cda..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Test case for PR 1GKEG73: ITPJCORE:WIN2000 - search (136): missing field declaration */
-public class B {
- private Object[] open;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/CA.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/CA.java
deleted file mode 100644
index 2f88187..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/CA.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Test case for 1GIIBC3: ITPJCORE:WINNT - search for method references - missing matches */
-public class CA {
- class CB {
- void f() {
- m();
- }
- class CC {
- void f() {
- m();
- }
- }
- }
- void m() {
- System.out.println("a");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/D.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/D.java
deleted file mode 100644
index 5ee43fe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/D.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Regression test for 1GL12XE: ITPJCORE:WIN2000 - search: missing field references in inner class */
-public class D {
- int h;
- void g() {
- new Object() {
- public void run() {
- int y = 0;
- h = y;
- }
- };
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/E.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/E.java
deleted file mode 100644
index 27506f2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/E.java
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Test case for 1GHDA2V: ITPJCORE:WINNT - ClassCastException when doing a search */
-public class E {
- public Object foo() {
- int[] result = new int[0];
- return result.clone();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/InterfaceImplementors.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/InterfaceImplementors.java
deleted file mode 100644
index 70be9c3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/InterfaceImplementors.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class InterfaceImplementors extends I implements p.I {
-}
-
-class I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/Azz.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/Azz.java
deleted file mode 100644
index 2c79e85..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/Azz.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package MemberTypeReference;
-public class Azz extends B {
- class AzzMember extends BMember {
- class BMember{
- }
- }
- static int fHello;
- void poo() {
- B.BMember someVar;
- super.poo();
- fHello= 9;
- }
-}
-
-class BMember extends B {}
-
-class X {
- Azz.AzzMember.BMember val;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/B.java
deleted file mode 100644
index cda9a67..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/B.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package MemberTypeReference;
-public class B {
- protected class BMember{}
-
- void foo() {
- Azz.fHello= 1;
- Object someVar = null;
- Object o = (Azz.AzzMember.BMember) someVar;
- }
- void poo() {}
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/NoReference/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/NoReference/A.java
deleted file mode 100644
index b110454..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/NoReference/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package NoReference;
-public class A {
- // This class should not be referenced
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/O.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/O.java
deleted file mode 100644
index a6a8e02..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/O.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Regression test for 1GL11J6: ITPJCORE:WIN2000 - search: missing field references (nested types) */
-public class O {
- int y;
- class I {
- void y() {
- y = 0;
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/ObjectMemberTypeReference/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/ObjectMemberTypeReference/A.java
deleted file mode 100644
index a0d232b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/ObjectMemberTypeReference/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package ObjectMemberTypeReference;
-public class A {
- class Object {
- }
- public void foo() {
- new Object();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PR_1GGNOTF.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PR_1GGNOTF.java
deleted file mode 100644
index 95bd4bd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PR_1GGNOTF.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Test case for PR 1GGNOTF: ITPJCORE:WINNT - Search doesn't find method referenced in anonymous inner class */
-public class PR_1GGNOTF {
- void method() {
- }
- void method2() {
- Runnable r = new Runnable() {
- public void run() {
- method();
- }
- };
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/A.java
deleted file mode 100644
index 88d389e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-import p3.p2.p.*;
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/B.java
deleted file mode 100644
index d8a7d28..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-import p3.p2.p.X;
-public class B extends X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/C.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/C.java
deleted file mode 100644
index bcb90e7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/C.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package PackageReference;
-public class C extends p3.p2.p.X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/D.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/D.java
deleted file mode 100644
index 2b35d56..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/D.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-public class D {
- p3.p2.p.X x;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/E.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/E.java
deleted file mode 100644
index e3decc0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/E.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-public class E {
- Object x = new p3.p2.p.X();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/F.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/F.java
deleted file mode 100644
index f776133..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/F.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class F {
- p3.p2.p.X foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/G.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/G.java
deleted file mode 100644
index e255a62..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/G.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package PackageReference;
-public class G {
- void foo(p3.p2.p.X x) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/H.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/H.java
deleted file mode 100644
index bfc0a74..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/H.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class H {
- void foo() {
- p3.p2.p.X x;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/I.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/I.java
deleted file mode 100644
index 3515f2c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/I.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class I {
- void foo() {
- Object x = new p3.p2.p.X();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/J.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/J.java
deleted file mode 100644
index 6c9d539..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/J.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class J {
- void foo() {
- int i = p3.p2.p.X.count;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/K.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/K.java
deleted file mode 100644
index 0e0c147..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/K.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-import p3.p2.*;
-public class K {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceA.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceA.java
deleted file mode 100644
index e6ef802..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceA.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-import p3.*;
-public class NoReferenceA {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceB.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceB.java
deleted file mode 100644
index 479cb5e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceB.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-import p3.X;
-public class NoReferenceB extends X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceC.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceC.java
deleted file mode 100644
index 6a82bdd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceC.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package PackageReference;
-public class NoReferenceC extends p3.X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceD.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceD.java
deleted file mode 100644
index 30d5801..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceD.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-public class NoReferenceD {
- p3.X x;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceE.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceE.java
deleted file mode 100644
index 3f252ca..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceE.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PackageReference;
-public class NoReferenceE {
- Object x = new p3.X();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceF.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceF.java
deleted file mode 100644
index b7007f4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceF.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class NoReferenceF {
- p3.X foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceG.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceG.java
deleted file mode 100644
index 70a99ef..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceG.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package PackageReference;
-public class NoReferenceG {
- void foo(p3.X x) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceH.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceH.java
deleted file mode 100644
index 6ca1c57..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceH.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class NoReferenceH {
- void foo() {
- p3.X x;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceI.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceI.java
deleted file mode 100644
index 3b6d5dd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceI.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class NoReferenceI {
- void foo() {
- Object x = new p3.X();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceJ.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceJ.java
deleted file mode 100644
index c28e9cf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceJ.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package PackageReference;
-public class NoReferenceJ {
- void foo() {
- int i = p3.X.count;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/Test.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/Test.java
deleted file mode 100644
index 05f1459..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-public class Test {
-
-static {
- Test var = new Test();
-}
-
-{
- Test t = null;
-}
-
-public static void main(String[] args) {
- p.Y y = new p.Y();
- y.foo(1, "a", y);
- p.Y.bar();
-
- p.Z z = new p.Z();
- z.foo(1, "a", z);
-
- p.A a = new p.A(y);
- a.foo(1, "a", a.x);
-}
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceAsSingleNameReference.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceAsSingleNameReference.java
deleted file mode 100644
index f41a15a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceAsSingleNameReference.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class TypeReferenceAsSingleNameReference {
-
-void hasReference() {
- TypeReferenceAsSingleNameReference x = null;
- TypeReferenceAsSingleNameReference = new Object();
-}
-
-void hasNoReference() {
- Object TypeReferenceAsSingleNameReference = null;
-}
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInArray/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInArray/A.java
deleted file mode 100644
index 198612a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInArray/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package TypeReferenceInArray;
-public class A {
- A[] a;
- TypeReferenceInArray.A[] b;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInImport/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInImport/X.java
deleted file mode 100644
index a6602a6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInImport/X.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package TypeReferenceInImport;
-import p.Y;
-import p2.Z;
-public class X {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/A.java
deleted file mode 100644
index f190793..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/A.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package VariousTypeReferences;
-public class A {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/B.java
deleted file mode 100644
index 0fb10b9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/B.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package VariousTypeReferences;
-public class B {
- void foo(A a) {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/C.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/C.java
deleted file mode 100644
index cc9c5fb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/C.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package VariousTypeReferences;
-public class C {
- A foo() {
- return null;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/D.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/D.java
deleted file mode 100644
index c40bc3f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/D.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package VariousTypeReferences;
-public class D {
- A foo;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/W.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/W.java
deleted file mode 100644
index efb90d3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/W.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Regression test for 1GL9UMH: ITPJCORE:WIN2000 - search: missing type occurrences */
-public class W {
- static int length = 17;
- int m() {
- int[] R = new int[1];
- return W.length; /*1*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/X.java
deleted file mode 100644
index fe4e580..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/X.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Test case for PR 1GK7K17: ITPJCORE:WIN2000 - search: missing type reference */
-public class X{
- static void s(){};
-}
-class AA{
- AA(){
- X.s(); //<<
- };
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a/A.java
deleted file mode 100644
index 126f06d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package a;
-/* Test case for 1GL0MN9: ITPJCORE:WIN2000 - search: not consistent results for nested types */
-public class A {
- class X {
- }
-
-};
-class S extends A {
-}
-class B {
- A.X ax; /*1*/
- S.X sx; /*2*/
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a2/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a2/X.java
deleted file mode 100644
index b52adb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a2/X.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package a2;
-/* Test case for bug 5923 Search for "length" field refs finds [].length */
-public class X {
- int length = 1;
- public void foo() {
- int[] array = new int[length];
- for (int i = 0, length = array.length; i < length; i++) {
- }
- }
-}
-
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/References.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/References.java
deleted file mode 100644
index be9c4ba..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/References.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package a3;
-import a3.b.B;
-public class References {
- public void foo() {
- X x1 = new Z(); // single type references
- a3.b.A a = null; // qualified type reference
- a3.b.A.B.C inner = null; // qualified type references with inner type
- Object o = a3.Y.field; // binary reference + qualified name reference
- X x2 = (B)x1; // single name reference
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/X.java
deleted file mode 100644
index bfb9b88..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package a3;
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Y.java
deleted file mode 100644
index 4d03dac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Y.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package a3;
-public class Y extends X {
- public static Object field = null;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Z.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Z.java
deleted file mode 100644
index 2e75950..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/Z.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package a3;
-public class Z extends Y {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/A.java
deleted file mode 100644
index cf16215..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package a3.b;
-public class A {
- public class B {
- public class C {
- }
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/B.java
deleted file mode 100644
index 4c4422e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a3/b/B.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package a3.b;
-public class B extends a3.X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a4/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a4/X.java
deleted file mode 100644
index b71e890..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a4/X.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package a4;
-/* Test case for bug 6158 Search - Prefix and postfix expression not found as write reference */
-public class X {
- int field;
- void foo() {
- field++;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a5/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a5/B.java
deleted file mode 100644
index d28748b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a5/B.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package a5;
-/* Test case for bug 6538 searchDeclarationsOf* incorrect */
-
-class A{
- int i(){
- return 0;
- }
-}
-
-class B {
- int f;
- void i(){
- y();
- Object l= new byte[f];
- }
- private void y(){
- }
-
-}
-
-class C extends A{
- public int i(){
- return 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a6/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a6/A.java
deleted file mode 100644
index 35291c0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a6/A.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package a6;
-
-class A {
-}
-
-class B extends A {
- private int f;
- private class P{}
- private void a(){}
- void m() {
- f++;
- P p= new P();
- a();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a7/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a7/X.java
deleted file mode 100644
index 5a8dbb4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a7/X.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package a7;
-/* Test case for bug 6779 searchDeclarationsOfReferencedTyped - missing exception types */
-public class X {
- public void foo() throws MyException {
- }
-}
-class MyException extends Exception {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a8/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a8/A.java
deleted file mode 100644
index 4eb5f03..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a8/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package a8;
-/* Test case for bug 7344 Search - write acces give wrong result */
-public class A {
- public A a;
- public int i;
- public void foo(){
- a.i = 25;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a9/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a9/A.java
deleted file mode 100644
index 4be44ae..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/a9/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package a9;
-class B{
- private void m(){
- }
-}
-class A extends B{
- void m(){
- }
-}
-class C extends A{
- void m(){
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/A.java
deleted file mode 100644
index ad331c6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package b1;
-/* Test case for bug 7987 Field reference search should do lookup in 1.4 mode */
-public class A {
- int x;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/B.java
deleted file mode 100644
index 5db6138..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b1/B.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package b1;
-/* Test case for bug 7987 Field reference search should do lookup in 1.4 mode */
-public class B extends A {
- void foo() {
- this.x++;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/X.java
deleted file mode 100644
index 430b923..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/X.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package b2;
-/* Test case for bug 8928 Unable to find references or declarations of methods that use static inner classes in the signature */
-public class X {
- public static class Inner {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Y.java
deleted file mode 100644
index bb6dade..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Y.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package b2;
-/* Test case for bug 8928 Unable to find references or declarations of methods that use static inner classes in the signature */
-public class Y {
- public void foo(X.Inner inner) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Z.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Z.java
deleted file mode 100644
index 4587f12..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b2/Z.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package b2;
-/* Test case for bug 8928 Unable to find references or declarations of methods that use static inner classes in the signature */
-public class Z {
- void bar() {
- X.Inner inner = new X.Inner();
- new Y().foo(inner);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b3/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b3/X.java
deleted file mode 100644
index b432f6c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b3/X.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package b3;
-/* Test case for bug 9041 search: cannot create a sub-cu scope */
-public class X {
- Object field = new X();
- Object foo() {
- return new X();
- }
- class Y {
- Object field2 = new X();
- Object foo2() {
- return new X();
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b4/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b4/A.java
deleted file mode 100644
index f43c463..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b4/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package b4;
-/* Test case for bug 9992 Member class declaration not found */
-public class A {
- public class B {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b5/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b5/A.java
deleted file mode 100644
index 32a5a62..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b5/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package b5;
-/* Test case for bug 9642 Search - missing inaccurate type matches */
-import x.y.Zork;
-public class A {
- {
- Zork[] zork = new Zork[0];
- int i = Zork.foo;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b6/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b6/A.java
deleted file mode 100644
index c319b04..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b6/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package b6;
-/* Test case for bug 10386 NPE in MatchLocator.lookupType */
-public class A {
- int[] field;
- int foo() {
- return this.field.length;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b7/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b7/X.java
deleted file mode 100644
index ac81a01..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b7/X.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package b7;
-/* Test case for bug 16751 Renaming a class doesn't update all references */
-class SuperClass {
- public static final String CONSTANT = "value";
-}
-
-class SubClass extends SuperClass {
-}
-
-class Test {
- public static void main(String[] arguments) {
- System.out.println(SubClass.CONSTANT);
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b8/Test.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b8/Test.java
deleted file mode 100644
index 5e3352a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b8/Test.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package b8;
-/* Test case for bug 17906 Rename package fails when inner classes are imported */
-public class Test {
- public static class InnerTest {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b9/Foo.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b9/Foo.java
deleted file mode 100644
index 8f564a7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/b9/Foo.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package b9;
-/* Test case for bug 17906 Rename package fails when inner classes are imported */
-import b8.Test.InnerTest;
-public class Foo {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/A.java
deleted file mode 100644
index 119a72c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package c1;
-/* Test case for bug 12649 Missing import after move */
-class A{
- int i= I.II;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/B.java
deleted file mode 100644
index 03de05e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/B.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package c1;
-/* Test case for bug 12649 Missing import after move */
-class B{
- int i= I.i;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/I.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/I.java
deleted file mode 100644
index 3959603..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c1/I.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package c1;
-/* Test case for bug 12649 Missing import after move */
-interface I{
- int i= 0;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/A.java
deleted file mode 100644
index e841cf8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package c2;
-/* Test case for bug 18418 search: searchDeclarationsOfReferencedTypes reports import declarations */
-import c3.C;
-public class A{
- C c;
- c3.C c3c;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/B.java
deleted file mode 100644
index 09e4440..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c2/B.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package c2;
-/* Test case for bug 18418 search: searchDeclarationsOfReferencedTypes reports import declarations */
-import c3.C;
-public class B{
- C c;
- c3.C m(C C, A A){
- return C;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c3/C.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c3/C.java
deleted file mode 100644
index 231a5f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c3/C.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package c3;
-/* Test case for bug 18418 search: searchDeclarationsOfReferencedTypes reports import declarations */
-import c2.A;
-import c2.*;
-import c2.B;
-public class C{
- A a;
- c2.A c2a;
- B b;
- c2.B c2B;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c4/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c4/X.java
deleted file mode 100644
index 4db5cdd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c4/X.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package c4;
-/* Test case for bug 20693 Finding references to variables does not find all occurances */
-public class X {
- int x;
- int foo() {
- return (this.x);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c5/Test.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c5/Test.java
deleted file mode 100644
index 285ecb7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c5/Test.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package c5;
-/* Test case for bug 21763 Problem in Java search [search] */
-public class Test {
- public String class_path;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c6/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c6/X.java
deleted file mode 100644
index b39a9a8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c6/X.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package c6;
-/* Test case for bug 24346 Method declaration not found in field initializer*/
-public class X {
- public void bar() {
- }
- public Object x = new Object() {
- public void foo24346() {
- }
- };
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/X.java
deleted file mode 100644
index af46bfc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/X.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package c7;
-/* Test case for bug 23112 search: need a way to search for references to the implicit non-arg constructor */
-public class X {
- public X() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/Y.java
deleted file mode 100644
index 40383b7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c7/Y.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package c7;
-/* Test case for bug 23112 search: need a way to search for references to the implicit non-arg constructor */
-public class Y extends X {
- public Y() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/X.java
deleted file mode 100644
index bd88ca3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package c8;
-/* Test case for bug 23112 search: need a way to search for references to the implicit non-arg constructor */
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/Y.java
deleted file mode 100644
index d4fa3fb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c8/Y.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package c8;
-/* Test case for bug 23112 search: need a way to search for references to the implicit non-arg constructor */
-public class Y extends X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c9/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c9/X.java
deleted file mode 100644
index dc5df48..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/c9/X.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package c9;
-/* Test case for bug 25859 Error doing Java Search */
-public class X {
-}
-class AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyz {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d1/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d1/X.java
deleted file mode 100644
index 293bd0d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d1/X.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package d1;
-/* Test case for bug 24934 Move top level doesn't optimize the imports[refactoring] */
-import d2.Y;
-import d2.Z;
-public class X {
- public class Inner {
- Y y;
- }
- Z z;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Y.java
deleted file mode 100644
index 51c28bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Y.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d2;
-/* Test case for bug 24934 Move top level doesn't optimize the imports[refactoring] */
-public class Y {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Z.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Z.java
deleted file mode 100644
index e5b048d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d2/Z.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d2;
-/* Test case for bug 24934 Move top level doesn't optimize the imports[refactoring] */
-public class Z {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d3/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d3/A.java
deleted file mode 100644
index cb6af31..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d3/A.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package d3;
-public class A {
-}
-class B {
- void foo() {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/X.java
deleted file mode 100644
index 3e0ae52..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/X.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package d4;
-public class X {
- Object foo() {
- return new d4.Y.bar();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/Y.java
deleted file mode 100644
index 72c54a0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d4/Y.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package d4;
-public class Y {
- public static Object bar() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/X.java
deleted file mode 100644
index a5af583..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d5;
-class X { // non-public class
- static String S;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/Y.java
deleted file mode 100644
index 6a79c66..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d5/Y.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package d5;
-public class Y {
- String T = d5.X.S;
- Class c = d5.X.class;
- Object o = (d5.X) null;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/X.java
deleted file mode 100644
index ba252bdf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/X.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package d6;
-public class X {
- private static String CONSTANT;
- private int foo;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/Y.java
deleted file mode 100644
index 6f0c837..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d6/Y.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package d6;
-public class Y {
- String T = X.CONSTANT;
- int i = new X().foo;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d7/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d7/A.java
deleted file mode 100644
index f2db390..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d7/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package d7;
-/* Test case for bug 29516 SearchEngine regressions in 20030114 */
-class A{
- A A;
- A A(A A){
- A:
- for (;;){
- if (A.A(A)==A)
- break A;
- }
- return A;
- };
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/A.java
deleted file mode 100644
index e76febf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d8;
-/* Test case for bug 29524 Search for declaration via patterns adds '"*" */
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/AA.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/AA.java
deleted file mode 100644
index 013426a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d8/AA.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d8;
-/* Test case for bug 29524 Search for declaration via patterns adds '"*" */
-public class AA {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p1/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p1/A.java
deleted file mode 100644
index 103f82d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p1/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d9.p1;
-/* Test case for bug 28236 Search for refs to class in hierarchy matches class outside hierarchy */
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p2/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p2/B.java
deleted file mode 100644
index d5bc82c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/d9/p2/B.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package d9.p2;
-/* Test case for bug 28236 Search for refs to class in hierarchy matches class outside hierarchy */
-import d9.p1.A;
-public class B {
- A a;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e1/A29366.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e1/A29366.java
deleted file mode 100644
index 6e8efde..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e1/A29366.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package e1;
-/* Test case for bug 29366 Search reporting invalid inaccurate match */
-public class A29366 {
- public void foo() {
- A29366 a;
- }
- public void bar() {
- new int[]{ 1
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/X31985.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/X31985.java
deleted file mode 100644
index 55adfbb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/X31985.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package e3;
-/* Test case for bug 31985 NPE searching non-qualified and case insensitive type ref */
-public class X31985 {
- static X31985 CONSTANT;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/Y31985.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/Y31985.java
deleted file mode 100644
index a9f214d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/e3/Y31985.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package e3;
-/* Test case for bug 31985 NPE searching non-qualified and case insensitive type ref */
-public class Y31985 {
- Object foo() {
- return X31985.CONSTANT;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/A.java
deleted file mode 100644
index bd7561a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/A.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package p;
-public class A {
- public static boolean DEBUG = false;
- public X x;
- public A(X x) {
- this.x = x;
- }
- void foo() {
- A.DEBUG = true;
- }
- public void foo(int i, String s, X x) {
- x.new Inner().foo();
- }
- public static void main(String[] args) {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/I.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/I.java
deleted file mode 100644
index de67757..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/I.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p;
-public interface I {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/X.java
deleted file mode 100644
index 59db2d5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/X.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package p;
-public class X implements I {
- public static boolean DEBUG = false;
- public I field;
- public class Inner {
- public String foo() {
- return "foo";
- }
- }
- public X() {
- X.DEBUG = true;
- }
- public X(int i) {
- }
- public static void bar() {
- }
- public void foo(int i, String s, X x) {
- Inner inner = new Inner();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Y.java
deleted file mode 100644
index 0823bc4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Y.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package p;
-public class Y extends X {
- public Y() {
- }
- public Y(int i) {
- super(i);
- }
- public Y(boolean b) {
- super(1);
- }
- public static void bar() {
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Z.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Z.java
deleted file mode 100644
index 91b3114..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p/Z.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package p;
-public class Z extends Y {
- public Z() {
- }
- public Z(int i) {
- super(i);
- }
- public void foo(int i, String s, X x) {
- super.foo(i, s, new Y(true));
- }
-
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p2/Z.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p2/Z.java
deleted file mode 100644
index 3e45aa2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p2/Z.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public class Z {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/X.java
deleted file mode 100644
index d78ec96..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3;
-public class X {
- public static int count;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/p2/p/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/p2/p/X.java
deleted file mode 100644
index e3ad8ee..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p3/p2/p/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3.p2.p;
-public class X {
- public static int count;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p4/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p4/A.java
deleted file mode 100644
index 3823325..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p4/A.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package p4;
-/* Regression test for 1GLBP65: ITPJCORE:WIN2000 - search: type refs - incorrect match */
-public class A {
- static A A;
-}
-class X extends p4.A{
- void x(){
- p4.A.A= A.A; /*1*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p5/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p5/A.java
deleted file mode 100644
index 44aeaa6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p5/A.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package p5;
-/* Regression test for 1GD79XM: ITPJCORE:WINNT - Search - search for field references - not all found */
-public class A{
- int f;
- A x;
- void k(){
- x.x.x.f= 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p6/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p6/A.java
deleted file mode 100644
index 5e3c9f3..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p6/A.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package p6;
-/* Test case for PR 1GKB9YH: ITPJCORE:WIN2000 - search for field refs - incorrect results */
-public class A {
- protected int f;
- void m() {
- f++;
- }
-}
-class AA extends A {
- protected int f;
-}
-class B {
- A a;
- AA b;
- A ab = new AA();
- void m() {
- a.f = 0; /*1*/
- b.f = 0; /*2*/
- ab.f = 0; /*3*/
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p7/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p7/A.java
deleted file mode 100644
index 7a29e63..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p7/A.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package p7;
-/* Test case for 1G52F7P: ITPJCORE:WINNT - Search - finds bogus references to class */
-public class A {
-}
-
-class C {
- void m() {
- class A {
- }
- new A();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p8/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p8/A.java
deleted file mode 100644
index a6cb544..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p8/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package p8;
-/* Test case for bug #3433 search: missing field occurrecnces (1GKZ8J6) */
-public class A{
- protected int g;
- void m(){
- g++;
- }
-}
-class B extends A{
- void m(){
- g= 0;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p9/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p9/X.java
deleted file mode 100644
index 57bdded..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p9/X.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package p9;
-/* Test case for PR 1GK8TXE: ITPJCORE:WIN2000 - search: missing field reference */
-public class X {
- public X f;
- public int k;
- void m() {
- for (int g = 0; g < 10; g++) {
- }
- f.k = 0; //<<
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q1/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q1/B.java
deleted file mode 100644
index 7755eeb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q1/B.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package q1;
-/* Test case for PR 1GK90H4: ITPJCORE:WIN2000 - search: missing package reference */
-public class B{
- void m(AA fred){
- q2.A.length(); //<<<
- }
-}
-class AA{
- static String A;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q2/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q2/A.java
deleted file mode 100644
index 8e95a5d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q2/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package q2;
-/* Test case for 1GK90H4: ITPJCORE:WIN2000 - search: missing package reference */
-public class A{
- public static int length(){return 42;};
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q3/A$B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q3/A$B.java
deleted file mode 100644
index 78061de..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q3/A$B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package q3;
-/* Test case for bug 3310 Smoke 124: Compile errors introduced with rename refactoring (1GFBK2G) */
-public class A$B {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q4/C.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q4/C.java
deleted file mode 100644
index d64f127..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q4/C.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package q4;
-/* Test case for 3310 Smoke 124: Compile errors introduced with rename refactoring (1GFBK2G) */
-public class C {
- Object foo() {
- return new q3.A$B();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q5/AQ.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q5/AQ.java
deleted file mode 100644
index a24f866..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q5/AQ.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package q5;
-/* Test case for bug 5068 search: missing method reference */
-interface I{
-void k();
-}
-class T{
- void m(){
- class X implements I{
- public void k(){}
- };
- X x= new X();
- x.k(); /**/
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q6/CD.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q6/CD.java
deleted file mode 100644
index d33e8c9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q6/CD.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package q6;
-/* Test case for bug 5069 search: method reference in super missing */
-class AQ {
- public void k(){}
-}
-
-class AQE extends AQ{
- public void k(){
- super.k();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q7/AQ.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q7/AQ.java
deleted file mode 100644
index 7270246..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q7/AQ.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package q7;
-/* Test case for bug 5070 search: missing interface method reference */
-interface I {
-void k();
-}
-class C1 implements I{
- public void k(){};
-}
-class D{
- void h(){
- I a= new C1();
- a.k();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q8/EclipseTest.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q8/EclipseTest.java
deleted file mode 100644
index fde6be1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q8/EclipseTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package q8;
-/* Test case for bug 5821 Refactor > Rename renames local variable instead of member in case of name clash */
-public class EclipseTest {
- public int test = 0;
-
- public static void main(String[] args) {
- EclipseTest test = new EclipseTest();
-
- test.test = 1;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q9/I.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q9/I.java
deleted file mode 100644
index 4af1c82..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/q9/I.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package q9;
-/* Test case for bug 5862 search : too many matches on search with OrPattern */
-interface I{
-void m();
-}
-
-class A1 implements I{
-public void m(){}
-}
-interface I1{
-void m();
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r/A.java
deleted file mode 100644
index f71bfe7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r/A.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package r;
-/* Test case for PR 1GKAQJS: ITPJCORE:WIN2000 - search: incorrect results for nested types */
-public class A {
- class X {
- X(X X) {
- new X(null);
- }
- }
- A() {
- }
- A(A A) {
- }
- A m() {
- new X(null);
- return (A) new A();
- }
-};
-class B {
- A.X ax = new A().new X(null);
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/I.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/I.java
deleted file mode 100644
index 39d9529..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/I.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package r2;
-/* Regression test for bug 22102 Not all implementors found for IPartListener */
-public interface I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/X.java
deleted file mode 100644
index fc11293..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r2/X.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package r2;
-/* Regression test for bug 22102 Not all implementors found for IPartListener */
-public class X {
- I field = new I() {
- };
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r3/A21485.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r3/A21485.java
deleted file mode 100644
index 0307f2d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r3/A21485.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package r3;
-/* Test case for bug 21485 NPE when doing a reference search to a package */
-class A21485 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r4/B21485.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r4/B21485.java
deleted file mode 100644
index b8df93a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r4/B21485.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package r4;
-/* Test case for bug 21485 NPE when doing a reference search to a package */
-import r3.A21485;
-public class B21485 extends A21485 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r5/XYZ.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r5/XYZ.java
deleted file mode 100644
index 129d7f9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r5/XYZ.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package r5;
-/* Test case for bug 17210 No match found when query contains '?' */
-public class XYZ {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/A.java
deleted file mode 100644
index 2b128eb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package r6;
-/* Test case for bug 23077 search: does not find type references in some imports */
-public class A {
- public class Inner{
- public class InnerInner{
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/B.java
deleted file mode 100644
index 7022a8d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r6/B.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package r6;
-/* Test case for bug 23077 search: does not find type references in some imports */
-import r6.A;
-import r6.A.Inner;
-import r6.A.Inner.InnerInner;
-import r6.A.*;
-import r6.A.Inner.*;
-import r6.A.Inner.InnerInner.*;
-public class B {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/A.java
deleted file mode 100644
index a0662a8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package r7;
-/* Test case for bug 37438 searchenging NPE in searchDeclarationsOfReferencedTypes */
-public class A {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/B.java
deleted file mode 100644
index 9555e6d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r7/B.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package r7;
-/* Test case for bug 37438 searchenging NPE in searchDeclarationsOfReferencedTypes */
-public class B {
- A a;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r8/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r8/A.java
deleted file mode 100644
index ea5b70d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/r8/A.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package r8;
-/* Test case for bug 37166 NPE in SearchEngine when matching type against ProblemReferenceBinding */
-import r8.B;
-public class A {
- A a;
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/X.java
deleted file mode 100644
index edca6a5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package s1;
-/* Test case for bug 3230 Search - Too many type references for query ending with * (1GAZVGI) */
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/Y.java
deleted file mode 100644
index d44cbdb..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s1/Y.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package s1;
-/* Test case for bug 3230 Search - Too many type references for query ending with * (1GAZVGI) */
-public class Y {
- X f[];
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/X.java
deleted file mode 100644
index 4959038..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package s2;
-/* Test case for bug 3230 Search - Too many type references for query ending with * (1GAZVGI) */
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/Z.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/Z.java
deleted file mode 100644
index 092ddcc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s2/Z.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package s2;
-/* Test case for bug 3230 Search - Too many type references for query ending with * (1GAZVGI) */
-public class Z {
- X f[];
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s3/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s3/A.java
deleted file mode 100644
index 7979877..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/s3/A.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package s3;
-/* Regression test for bug 23329 search: incorrect range for type references in brackets */
-public class A {
- int field;
- Object foo() {
- return ( B )this;
- }
- int bar() {
- return ( field );
- }
-}
-class B {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/sd/AQ.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/sd/AQ.java
deleted file mode 100644
index ff6ae08..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/sd/AQ.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package sd;
-
-/* Test case for PR 1GKCH3N: ITPJCORE:WIN2000 - search: method refs - super call not found */
-public class AQ{
- public void k(){}
-}
-
-class AQE extends AQ{
- public void k(){
- super.k();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc/X.java
deleted file mode 100644
index 208050a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package wc;
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc1/X.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc1/X.java
deleted file mode 100644
index 7bc0d09..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc1/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package wc1;
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc2/Y.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc2/Y.java
deleted file mode 100644
index 7a5fb73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/wc2/Y.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package wc2;
-public class Y {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.jar
deleted file mode 100644
index 743164e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.zip b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.zip
deleted file mode 100644
index a820f3d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test20631.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test24741.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test24741.jar
deleted file mode 100644
index b535fa0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/test24741.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Resolve/.classpath
deleted file mode 100644
index 3491704..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="zzz.jar" sourcepath="/Resolve/zzzsrc.zip"/>
- <classpathentry kind="lib" path="p3.jar" sourcepath="/Resolve/p3src.zip"/>
- <classpathentry kind="lib" path="test25888.jar" sourcepath="/Resolve/test25888src.zip"/>
- <classpathentry kind="lib" path="p4.jar"/>
- <classpathentry kind="lib" path="class-folder"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/.project b/org.eclipse.jdt.core.tests.model/workspace/Resolve/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType$Inner.class b/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType$Inner.class
deleted file mode 100644
index e5c9d5e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType$Inner.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.class b/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.class
deleted file mode 100644
index 0f9edac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.java
deleted file mode 100644
index 8b72b53..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveConstructorCallOfMemberType {
- class Inner {}
- void foo(){
- new Inner();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p3.jar b/org.eclipse.jdt.core.tests.model/workspace/Resolve/p3.jar
deleted file mode 100644
index efd52bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p3.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p3src.zip b/org.eclipse.jdt.core.tests.model/workspace/Resolve/p3src.zip
deleted file mode 100644
index e87e2c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p3src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p4.jar b/org.eclipse.jdt.core.tests.model/workspace/Resolve/p4.jar
deleted file mode 100644
index 32f474a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p4.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p4src.zip b/org.eclipse.jdt.core.tests.model/workspace/Resolve/p4src.zip
deleted file mode 100644
index 2f112c0..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/p4src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveAbstractMethod.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveAbstractMethod.java
deleted file mode 100644
index 280d536..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveAbstractMethod.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class ResolveAbstractMethod {
- void test(AbstractClass a){
- a.foo();
- }
-}
-abstract class AbstractClass implements SuperInterface {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArgumentName.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArgumentName.java
deleted file mode 100644
index c32664c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArgumentName.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class ResolveArgumentName {
- public void foo(Object var1, int var2){
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArrayLength.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArrayLength.java
deleted file mode 100644
index 9ed313b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveArrayLength.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveArrayLength {
- public int foo() {
- Object[] array = new Object[0];
- return array.length;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentName.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentName.java
deleted file mode 100644
index be1544c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentName.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class ResolveCatchArgumentName {
- public void foo(){
- try{
- } catch(Object var1){
- } catch(int var2){
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType1.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType1.java
deleted file mode 100644
index cf89006..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class ResolveCatchArgumentType1 {
- void foo() {
- try {
- } catch (X1.Y1 e) {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType2.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType2.java
deleted file mode 100644
index d48118c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class ResolveCatchArgumentType2 {
- void foo() {
- try {
- } catch (X1.Y1 e) {
- }
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass1.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass1.java
deleted file mode 100644
index d08d84c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import p1.*;
-
-public class ResolveClass1{
- private X[] x;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass2.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass2.java
deleted file mode 100644
index 944316f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-import p1.*;
-
-public class ResolveClass2{
- public void foo() {
- X x = null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass3.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass3.java
deleted file mode 100644
index f8d2bac..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import p1.*;
-
-public class ResolveClass3{
- X[] x = new X[]{};
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass4.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass4.java
deleted file mode 100644
index 983ec3e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass4.java
+++ /dev/null
@@ -1,7 +0,0 @@
-import p1.*;
-
-public class ResolveClass4{
- public X foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass5.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass5.java
deleted file mode 100644
index 990de28..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass5.java
+++ /dev/null
@@ -1,6 +0,0 @@
-import p1.*;
-
-public class ResolveClass5{
- public void foo(X x) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass6.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass6.java
deleted file mode 100644
index 7489e0a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveClass6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class ResolveClass6 extends p1.X {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructor.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructor.java
deleted file mode 100644
index ea12fa5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructor.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class ResolveConstructor {
- public ResolveConstructor(int i) {
- }
- public ResolveConstructor(String s) {
- }
- public void foo() {
- ResolveConstructor c = new ResolveConstructor("");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructorDeclaration.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructorDeclaration.java
deleted file mode 100644
index 921b8ff..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveConstructorDeclaration.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveConstructorDeclaration {
- public ResolveConstructorDeclaration(int i) {
- }
- public ResolveConstructorDeclaration(String s) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveEmptySelectionOnMethod.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveEmptySelectionOnMethod.java
deleted file mode 100644
index 0d49da9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveEmptySelectionOnMethod.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class ResolveEmptySelectionOnMethod {
- void foo(){
- }
- void bar(){
- foo();
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitSuperConstructorCall.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitSuperConstructorCall.java
deleted file mode 100644
index 621bb3a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitSuperConstructorCall.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class ResolveExplicitSuperConstructorCall extends SuperClass {
- public ResolveExplicitSuperConstructorCall(int x){
- super(x);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitThisConstructorCall.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitThisConstructorCall.java
deleted file mode 100644
index 68d82fd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveExplicitThisConstructorCall.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class ResolveExplicitThisConstructorCall {
- public ResolveExplicitThisConstructorCall(){
-
- }
-
- public ResolveExplicitThisConstructorCall(int x){
- this();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveField.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveField.java
deleted file mode 100644
index 4672288..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveField.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveField {
- public int foo;
- public void bar() {
- this.foo = 0;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveFieldDeclaration.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveFieldDeclaration.java
deleted file mode 100644
index 20bd1f2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveFieldDeclaration.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class ResolveFieldDeclaration {
- public int foo;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveImport.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveImport.java
deleted file mode 100644
index 579780e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveImport.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import a.b.ImportedClass;
-
-public class ResolveImport {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInnerClassAsParamater.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInnerClassAsParamater.java
deleted file mode 100644
index e3baec5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInnerClassAsParamater.java
+++ /dev/null
@@ -1,11 +0,0 @@
-public class ResolveInnerClassAsParamater {
- class Inner {
- }
- void foo(String s) {
- }
- void foo(Inner i) {
- }
- void bar(Inner i) {
- foo(i);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInterface.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInterface.java
deleted file mode 100644
index fb56395..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveInterface.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class ResolveInterface implements p1.Y {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveLocalName.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveLocalName.java
deleted file mode 100644
index 325d44f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveLocalName.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveLocalName {
- public void foo(){
- Object var1;
- int var2;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration1.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration1.java
deleted file mode 100644
index 80fa739..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class ResolveMemberTypeDeclaration1 {
- public interface MemberInterface {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration2.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration2.java
deleted file mode 100644
index b681984..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveMemberTypeDeclaration2 {
- class Member {
- class MemberOfMember {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMessageSendOnBaseType.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMessageSendOnBaseType.java
deleted file mode 100644
index 32e51ee..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMessageSendOnBaseType.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveMessageSendOnBaseType {
- boolean foo;
- public int boo() {
- foo.hello();
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethod.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethod.java
deleted file mode 100644
index 1400e69..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethod.java
+++ /dev/null
@@ -1,9 +0,0 @@
-public class ResolveMethod {
- public void foo(int i) {
- }
- public void foo(String s) {
- }
- public void bar() {
- new ResolveMethod().foo("");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclaration.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclaration.java
deleted file mode 100644
index 1616574..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclaration.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class ResolveMethodDeclaration {
- public void foo(int i) {
- }
- public void foo(String s) {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodWithIncorrectParameter.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodWithIncorrectParameter.java
deleted file mode 100644
index 9476627..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveMethodWithIncorrectParameter.java
+++ /dev/null
@@ -1,7 +0,0 @@
-public class ResolveMethodWithIncorrectParameter {
- public void foo(int x) {
- }
- public void bar() {
- foo("String");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePackage.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePackage.java
deleted file mode 100644
index 4de0ab1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePackage.java
+++ /dev/null
@@ -1,4 +0,0 @@
-import java.lang.*;
-
-public class ResolvePackage {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePartiallyQualifiedType.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePartiallyQualifiedType.java
deleted file mode 100644
index 8dfa649..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolvePartiallyQualifiedType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class ResolvePartiallyQualifiedType {
- void foo() {
- java.lang.Object o;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedType.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedType.java
deleted file mode 100644
index 74274e1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class ResolveQualifiedType {
- void foo() {
- java.lang.Object o;
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeDeclaration.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeDeclaration.java
deleted file mode 100644
index 76bde4d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeDeclaration.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class ResolveTypeDeclaration {
-
-}
-class OtherType {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection.java
deleted file mode 100644
index f66046d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class ResolveTypeEmptySelection {
- Object o;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection2.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection2.java
deleted file mode 100644
index e2732ff..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class ResolveTypeEmptySelection2 {
- Object o;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeInComment.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeInComment.java
deleted file mode 100644
index c2be2b4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveTypeInComment.java
+++ /dev/null
@@ -1,4 +0,0 @@
-import p2.X;
-public class ResolveTypeInComment{
- /* return X */
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveUnicode.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveUnicode.java
deleted file mode 100644
index 37b662a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/ResolveUnicode.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class ResolveUnicode {
- public java.lang.\u0053tring s;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperClass.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperClass.java
deleted file mode 100644
index 5e44433..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperClass.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class SuperClass {
- public SuperClass(int x){
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperInterface.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperInterface.java
deleted file mode 100644
index 2083e48..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/SuperInterface.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public interface SuperInterface {
- void foo();
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/X1.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/X1.java
deleted file mode 100644
index 81699d2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/X1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class X1 extends Exception {
- public class Y1 extends Exception {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/a/b/ImportedClass.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/a/b/ImportedClass.java
deleted file mode 100644
index 79386e7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/a/b/ImportedClass.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package a.b;
-
-public class ImportedClass {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/X.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/X.java
deleted file mode 100644
index 70db433..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/X.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p1;
-
-public class X {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/Y.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/Y.java
deleted file mode 100644
index 1af1c8b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p1/Y.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p1;
-
-public interface Y {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p2/X.java b/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p2/X.java
deleted file mode 100644
index f214936..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/src/p2/X.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p2;
-
-public class X {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888.jar b/org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888.jar
deleted file mode 100644
index d45b07c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888src.zip b/org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888src.zip
deleted file mode 100644
index c96f604..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/test25888src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/zzz.jar b/org.eclipse.jdt.core.tests.model/workspace/Resolve/zzz.jar
deleted file mode 100644
index a2d6719..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/zzz.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Resolve/zzzsrc.zip b/org.eclipse.jdt.core.tests.model/workspace/Resolve/zzzsrc.zip
deleted file mode 100644
index ed756e2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/Resolve/zzzsrc.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.classpath b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.classpath
deleted file mode 100644
index 41bc5c6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="class-folder"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.project b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$1$Victory.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$1$Victory.class
deleted file mode 100644
index 4ccf11b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$1$Victory.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$Inner.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$Inner.class
deleted file mode 100644
index 5b29382..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass$Inner.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass.class
deleted file mode 100644
index f095113..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/AClass.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$1$Victory.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$1$Victory.class
deleted file mode 100644
index 8872fca..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$1$Victory.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$Inner.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$Inner.class
deleted file mode 100644
index 965d4ba..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass$Inner.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.class
deleted file mode 100644
index 981da29..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.java b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.java
deleted file mode 100644
index 9356c6a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package aa.bb.cc;
-
-public class CClass extends SuperClass {
- public class Inner extends SuperInnerClass {
- public Inner() throws Exception {
- }
- }
-
- public void foo(SuperClass varsc, final int var){
- class Victory{}
- }
-
- public void bar(int x, int y){
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperClass.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperClass.class
deleted file mode 100644
index dd89361..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperClass.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperInnerClass.class b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperInnerClass.class
deleted file mode 100644
index 2c2cc39..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/SuperInnerClass.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/src/aa/bb/cc/BClass.java b/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/src/aa/bb/cc/BClass.java
deleted file mode 100644
index 521565f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/SnippetCompletion/src/aa/bb/cc/BClass.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package aa.bb.cc;
-
-public class BClass extends SuperClass {
- public class Inner extends SuperInnerClass {
- public Inner() throws Exception {
- }
- }
-
- public void foo(SuperClass varsc, final int var){
- class Victory{}
- }
-
- public void bar(int x, int y){
-
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.classpath b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.classpath
deleted file mode 100644
index dce3aa7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="lib.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.project b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/NotInClasspath/e/E.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/NotInClasspath/e/E.java
deleted file mode 100644
index dd87cc2..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/NotInClasspath/e/E.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package e;
-import p1.*;
-public class E extends X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/lib.jar b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/lib.jar
deleted file mode 100644
index 1475446..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/lib.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/A.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/A.java
deleted file mode 100644
index 9c2dead..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/A.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p1;
-public class A extends B {
-}
-class B {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Deep.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Deep.java
deleted file mode 100644
index 5cb2e77..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Deep.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public class Deep extends Z {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I1.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I1.java
deleted file mode 100644
index f355fd6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public interface I1 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I2.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I2.java
deleted file mode 100644
index 98baf88..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/I2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public interface I2 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/X.java
deleted file mode 100644
index 730eea6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Y.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Y.java
deleted file mode 100644
index 9c3bdd8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Y.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public class Y extends X implements I1, I2 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Z.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Z.java
deleted file mode 100644
index 2852116..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p1/Z.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public class Z extends Y {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I.java
deleted file mode 100644
index 518a987..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public interface I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I1.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I1.java
deleted file mode 100644
index fd3b805..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public interface I1 extends I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I2.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I2.java
deleted file mode 100644
index c04b58c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public interface I2 extends I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I3.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I3.java
deleted file mode 100644
index 0732256..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/I3.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public interface I3 extends I1 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/X.java
deleted file mode 100644
index fcbbc0e..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public class X implements I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/Y.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/Y.java
deleted file mode 100644
index ae1be6b..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p2/Y.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public class Y extends X implements I3 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/A.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/A.java
deleted file mode 100644
index d00c77d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3;
-/* Test case for bug 23644 hierarchy: getAllSuperTypes does not include all superinterfaces? */
-public class A implements I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/B.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/B.java
deleted file mode 100644
index 5a09970..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3;
-/* Test case for bug 23644 hierarchy: getAllSuperTypes does not include all superinterfaces? */
-public class B extends A implements I1 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I.java
deleted file mode 100644
index b479209..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3;
-/* Test case for bug 23644 hierarchy: getAllSuperTypes does not include all superinterfaces? */
-public interface I {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I1.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I1.java
deleted file mode 100644
index 288e319..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p3/I1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p3;
-/* Test case for bug 23644 hierarchy: getAllSuperTypes does not include all superinterfaces? */
-public interface I1 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p4/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p4/X.java
deleted file mode 100644
index 310ae8d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p4/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p4;
-/* Test case for bug 24691 Missing interface makes hierarchy incomplete */
-public class X implements Missing {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p5/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p5/X.java
deleted file mode 100644
index e0a81bf..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/p5/X.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package p5;
-public class X {
- public class Inner {
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/wc/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/wc/X.java
deleted file mode 100644
index 208050a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchy/src/wc/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package wc;
-public class X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.classpath b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.classpath
deleted file mode 100644
index 0888cd4..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="src" path="/TypeHierarchyNotification"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="output" path=""/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.project b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.project
deleted file mode 100644
index a8d5377..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- <project>TypeHierarchyNotification</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/Dependent.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/Dependent.java
deleted file mode 100644
index 7dc4ad1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyDependent/Dependent.java
+++ /dev/null
@@ -1,3 +0,0 @@
-import a.*;
-public class Dependent extends A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.classpath b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.classpath
deleted file mode 100644
index dce3aa7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="lib" path="lib.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.project b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/Error.class b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/Error.class
deleted file mode 100644
index 3fd1e09..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/Error.class
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/a/A.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/a/A.java
deleted file mode 100644
index 7e84311..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/a/A.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package a;
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/b/B.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/b/B.java
deleted file mode 100644
index 560c48a..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/b/B.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package b;
-import a.*;
-public class B extends A {
- public Object value;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/c/C.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/c/C.java
deleted file mode 100644
index 3fb14a8..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/c/C.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package c;
-import p.*;
-import i.*;
-public class C extends X implements I2 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/d/D.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/d/D.java
deleted file mode 100644
index 8638999..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/d/D.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package d;
-import c.*;
-public class D extends C {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/e/E.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/e/E.java
deleted file mode 100644
index 5ef56fc..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/e/E.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package e;
-import p.*;
-public class E extends X {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I1.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I1.java
deleted file mode 100644
index 08232c7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package i;
-public interface I1 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I2.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I2.java
deleted file mode 100644
index df7a61f..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package i;
-public interface I2 {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/External.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/External.java
deleted file mode 100644
index 00c1efe..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/External.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p;
-public class External {
- public Object field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/MyError.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/MyError.java
deleted file mode 100644
index 17e89f9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/MyError.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p;
-public class MyError extends Error {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/X.java
deleted file mode 100644
index 66a27be..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/X.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package p;
-import b.*;
-import i.*;
-public class X extends B implements I1 {
- public Object field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/other/External.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/other/External.java
deleted file mode 100644
index 0a83839..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/other/External.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p.other;
-public class External {
- public Object field;
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/A.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/A.java
deleted file mode 100644
index dc86add..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/A.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p2;
-/* Test case for bug 4917 Latest build fails updating TypeHierarchy */
-public class A {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/B.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/B.java
deleted file mode 100644
index 1b54471..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/B.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p2;
-/* Test case for bug 4917 Latest build fails updating TypeHierarchy */
-public class B {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.classpath b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.classpath
deleted file mode 100644
index b7a47d9..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.project b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I1.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I1.java
deleted file mode 100644
index c74ec72..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I1.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public interface I1 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I2.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I2.java
deleted file mode 100644
index b7e1519..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public interface I2 extends I6 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I3.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I3.java
deleted file mode 100644
index 19447b1..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I3.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public interface I3 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I4.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I4.java
deleted file mode 100644
index 868bcc7..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I4.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public interface I4 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I5.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I5.java
deleted file mode 100644
index 75fe10c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I5.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public interface I5 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I6.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I6.java
deleted file mode 100644
index 978d903..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/I6.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public interface I6 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/X.java
deleted file mode 100644
index 84b7d2c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/X.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public class X implements I5 {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Y.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Y.java
deleted file mode 100644
index b653e93..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Y.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public class Y extends X implements I1, I2, IA, IB {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Z.java b/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Z.java
deleted file mode 100644
index f638262..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Z.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package p1;
-public class Z extends Y implements I3, I4, IC {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.classpath b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.classpath
deleted file mode 100644
index 49cabdd..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.project b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.project
deleted file mode 100644
index c05ce73..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p/TypeResolve.java b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p/TypeResolve.java
deleted file mode 100644
index e85cc3c..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p/TypeResolve.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package p;
-import p1.X;
-import p2.*;
-public class TypeResolve {
- class A {
- class B {
- class D {
- }
- }
- class C {
- }
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p1/X.java b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p1/X.java
deleted file mode 100644
index 9d150f5..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p1/X.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p1;
-public class X {
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p2/Y.java b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p2/Y.java
deleted file mode 100644
index c6e7a82..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p2/Y.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package p2;
-public class Y {
-}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p3/B.java b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p3/B.java
deleted file mode 100644
index a3bb9ad..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p3/B.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package p3;
-/* Test case for bug 23829 IType::resolveType incorrectly returns null */
-public class B{}
-class A extends B{
-}
-
-class Test{
- void f(){
- A a= new A();
- f(a);
- }
- void f(B b){
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/A.java b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/A.java
deleted file mode 100644
index 8374df6..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/A.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package p4;
-public class A {
- class Inner {
- public int amount() {
- return 1;
- }
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/B.java b/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/B.java
deleted file mode 100644
index 74f268d..0000000
--- a/org.eclipse.jdt.core.tests.model/workspace/TypeResolve/src/p4/B.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package p4;
-public class B {
- B(int t, A.Inner a) {
- a.amount();
- }
-}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 627f39a..ecd0575 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -12,7 +12,7 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.356
+compiler.version = 0.359
compiler.copyright = Copyright IBM Corp 2000, 2003. All rights reserved.
### scanning
@@ -77,60 +77,74 @@
output.noClassFileCreated = No .class file created for file named {0} because of an IOException.
### miscellaneous
- ### {0=compiler.name} {1=compiler.version}, {2=compiler.copyright}
-misc.version = {0} {1}, {2}
- ### {0=compiler.name} {1=compiler.version}, {2=compiler.copyright}
-misc.usage = {0} {1}\n\
- {2}\n\n\
- Usage: <options> <source files | directories>\n\n\
- where options include:\n\
- -help display this help message\n\
- -version only display compiler version number\n\
- -classpath or -cp <dir 1>;<dir 2>;...;<dir P>\n\
- -bootclasspath <dir 1>;<dir 2>;...;<dir P>\n\
- -d <dir> destination directory (if omitted, no directory is created)\n\
- \t-d none no classfile is generated\n\
- -target <ver> set classfile target (1.1 to 1.4, default is ''1.1'')\n\
- -1.3 use 1.3 compliance level (default)\n\
- -1.4 use 1.4 compliance level\n\
- -source <ver> set source level (1.3 or 1.4, default matches compliance level)\n\
- -nowarn no warning (equivalent to ''-warn:none'')\n\
- -warn: <level> set warning level (e.g. ''-warn:unusedLocals,deprecation'')\n\
- \tallDeprecation deprecation (including in deprecated code)\n\
- \tassertIdentifier ''assert'' used as identifier\n\
- \tconstructorName method with constructor name \t\t\t\t (default) \n\
- \tdeprecation deprecation (outside deprecated code) \t\t (default)\n\
- \tmaskedCatchBlock hidden catch block \t\t\t\t\t\t (default)\n\
- \tnls string literal lacking non-nls tag //$NON-NLS-<n>$\n\
- \tpackageDefaultMethod attempt to override package-default method (default)\n\
- \tunusedArgument unused method argument (never read)\n\
- \tunusedImport unused import declaration \t\t\t\t\t (default)\n\
- \tunusedLocal unused local variable (never read)\n\
- \tunusedPrivate unused private member declaration\n\
- \tstaticReceiver non-static reference to static member \t\t (default)\n\
- \tnoEffectAssign assignment without effect \t\t\t\t\t (default)\n\
- \tconditionAssign possible accidental boolean assignment\n\
- \tsyntheticAccess synthetic access for innerclass\n\
- \tinterfaceNonInherited interface non-inherited method compatibility (default)\n\
- \tlocalHiding local variable hiding another variable\n\
- \tfieldHiding field hiding another variable\n\
- \tspecialParamHiding constructor or setter parameter hiding another field\n\
- \tnoImplicitStringConversion char[] in String concat\t\t\t\t\t (default)\n\
- \ttasks(<tag1>|...|<tagN>) tasks identified by tags inside comments\n\
- -deprecation equivalent to ''-warn:deprecation'' (default)\n\
- -g[:<level>] debug attributes level (default ''-g:lines,source'')\n\
- \t-g all debug info (''-g:lines,vars,source'')\n\
- \t-g:none no debug info\n\
- \t-g:[lines,vars,source] selective debug info\n\
- -preserveAllLocals preserve unused local vars for debug purpose (default is optimize out)\n\
- -noImportError no errors for unresolved imports (default is error)\n\
- -encoding <enc> specify a different default source encoding format (custom encoding can be specified on\n\
- \t\t\t\t\ta per file basis by adding suffix ''[<enc>]'' to file/folder names\n\
- -log <filename> specify a log file\n\
- -proceedOnError keep compiling when error, dumping class files with problem methods (default is off)\n\
- -verbose print accessed/processed compilation units\n\
- -referenceInfo compute reference info\n\
- -progress show progress (only in -log mode)\n\
- -time display speed information \n\
- -noExit do not call System.exit(n) at end of compilation (n=0 if no error)\n\
- -repeat <n> repeat compilation process <n> times (perf analysis)\n
+misc.version = {compiler.name} {compiler.version}, {compiler.copyright}
+misc.usage = {compiler.name} {compiler.version}, {compiler.copyright}\n\
+\ \n\
+\Usage: <options> <source files | directories>\n\
+\ If directories are specified, then their source contents are compiled.\n\
+\ Possible options are listed below. Those enabled by default are prefixed with ''+''\n\
+\ \n\
+\ Classpath options:\n\
+\ -cp -classpath <directories and zip/jar files separated by ;>\n\
+\ specify location for application classes and sources\n\
+\ -bootclasspath <directories and zip/jar files separated by ;>\n\
+\ specify location for system classes\n\
+\ -d <dir> destination directory (if omitted, no directory is created)\n\
+\ -d none generate no .class files\n\
+\ -encoding <enc> specify custom encoding for all sources. Each file/directory can override it\n\
+\ when suffixed with ''[''<enc>'']'' (e.g. X.java[utf8])\n\
+\ \n\
+\ Compliance options:\n\
+\ -1.3 + use 1.3 compliance level\n\
+\ -1.4 use 1.4 compliance level\n\
+\ -source <version> set source level (1.3 or 1.4, default matches compliance level)\n\
+\ -target <version> set classfile target (1.1 to 1.4, default matches compliance level)\n\
+\ \n\
+\ Error/Warning options:\n\
+\ -deprecation + deprecation outside deprecated code\n\
+\ -noImportError no errors for unresolved imports\n\
+\ -nowarn disable all warnings\n\
+\ -warn: <warnings separated by ,> where warnings include:\n\
+\ none disable all warnings\n\
+\ allDeprecation deprecation including inside deprecated code\n\
+\ assertIdentifier ''assert'' used as identifier\n\
+\ conditionAssign possible accidental boolean assignment\n\
+\ constructorName + method with constructor name\n\
+\ deprecation + deprecation outside deprecated code\n\
+\ fieldHiding field hiding another variable\n\
+\ intfNonInherited + interface non-inherited method compatibility\n\
+\ localHiding local variable hiding another variable\n\
+\ maskedCatchBlock + hidden catch block\n\
+\ nls string literal lacking non-nls tag //$NON-NLS-<n>$\n\
+\ noEffectAssign + assignment without effect\n\
+\ charConcat + char[] in String concat\n\
+\ pkgDefaultMethod + attempt to override package-default method\n\
+\ unusedArgument unread method argument\n\
+\ unusedImport + unused import declaration\n\
+\ unusedLocal unread local variable\n\
+\ unusedPrivate unused private member declaration\n\
+\ specialParamHiding constructor or setter parameter hiding another field\n\
+\ staticReceiver + non-static reference to static member\n\
+\ syntheticAccess synthetic access for innerclass\n\
+\ tasks(<tags separated by |>) tasks identified by tags inside comments\n\
+\ \n\
+\ Debug options:\n\
+\ -g[:lines,vars,source] custom debug info\n\
+\ -g:lines,source + both lines table and source debug info\n\
+\ -g all debug info\n\
+\ -g:none no debug info\n\
+\ -preserveAllLocals preserve unused local vars for debug purpose\n\
+\ \n\
+\ Advanced options:\n\
+\ -log <file> log to a file\n\
+\ -proceedOnError do not stop at first error, dumping class files with problem methods\n\
+\ -verbose enable verbose output\n\
+\ -referenceInfo compute reference info\n\
+\ -progress show progress (only in -log mode)\n\
+\ -time display speed information \n\
+\ -noExit do not call System.exit(n) at end of compilation (n==0 if no error)\n\
+\ -repeat <n> repeat compilation process <n> times for perf analysis\n\
+\ \n\
+\ -? -help print this help message\n\
+\ -v -version print compiler version\n\
+\ -showversion print compiler version and continue\n
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index d5170ab..daf925b 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -41,6 +41,334 @@
<p><hr><h1>
Eclipse Platform Build Notes <br>
Java Development Tooling Core</h1>
+Eclipse SDK 3.0 Build - 18th June 2003
+<br>Project org.eclipse.jdt.core v_357b
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>backport index manager deadlock fix on top of v_357</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38901">38901</a>
+IndexManager hangs in end-less loop
+
+<h3>Problem Reports Closed</h3>
+
+
+<p><hr><h1>
+Eclipse Platform Build Notes <br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0 Build - 16th June 2003
+<br>Project org.eclipse.jdt.core v_358
+
+<p><b>NOTE:</b> This version got backed out due to severe regression
+(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38951">38951</a> NPE in editor while saving contents).
+Until subsequent version is made available (see above), integration builds will revert to previous version (v_357).
+
+<h2>
+What's new in this drop</h2>
+<ul>
+<li><code>JavaCore.newLibraryEntry(...)</code> will now allow an empty source attachment (<code>new Path("")</code>) to
+be equivalent to no source attachment (i.e. <code>null</code>). This adjustment is made necessary for
+library entries generated from classpath variables which cannot be set to <code>null</code>. Also see
+bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38531">38531</a>.
+<pre>
+* @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
+* or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
+* and will be automatically converted to <code>null</code>.
+</pre>
+</li>
+<li>Added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code> to force reload of <code>.classpath</code> file
+before next automatic update occurs.
+<pre>
+/**
+ * Force the project to reload its <code>.classpath</code> file from disk and update the classpath accordingly.
+ * Usually, a change to the <code>.classpath</code> file is automatically noticed and reconciled at the next
+ * resource change notification event. If required to consider such a change prior to the next automatic
+ * refresh, then this functionnality should be used to trigger a refresh. In particular, if a change to the file is performed,
+ * during an operation where this change needs to be reflected before the operation ends, then an explicit refresh is
+ * necessary.
+ *
+ * @param monitor a progress monitor for reporting operation progress
+ * @exception JavaModelException if the classpath could not be updated. Reasons
+ * include:
+ * - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * - Two or more entries specify source roots with the same or overlapping paths (NAME_COLLISION)
+ * - A entry of kind <code>CPE_PROJECT</code> refers to this project (INVALID_PATH)
+ * - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * - The output location path refers to a location not contained in this project (<code>PATH_OUTSIDE_PROJECT</code>)
+ * - The output location path is not an absolute path (<code>RELATIVE_PATH</code>)
+ * - The output location path is nested inside a package fragment root of this project (<code>INVALID_PATH</code>)
+ * - The classpath is being modified during resource change event notification (CORE_EXCEPTION)
+ * @since 3.0
+ */
+</pre>
+</li>
+<li>In the process of closing the gap between compilation units and working copies
+(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888 ">bug 36888 </a>), the following new APIs
+are added to <code>ICompilationUnit</code>:
+ <ul>
+ <li><pre>
+/**
+ * Changes this compilation unit handle into a working copy. A new IBuffer is
+ * created using this compilation unit handle's owner. Uses the primary owner is none was
+ * specified when this compilation unit handle was created.
+ *
+ * When switching to working copy mode, problems are reported to given
+ * IProblemRequestor.
+ *
+ * Once in working copy mode, changes to this compilation unit or its children are done in memory.
+ * Only the new buffer is affected. Using commitWorkingCopy(boolean, IProgressMonitor)
+ * will bring the underlying resource in sync with this compilation unit.
+ *
+ * If this compilation unit was already in working copy mode, an internal counter is incremented and no
+ * other action is taken on this compilation unit. To bring this compilation unit back into the original mode
+ * (where it reflects the underlying resource), discardWorkingCopy must be call as many
+ * times as becomeWorkingCopy.
+ *
+ * @param problemRequestor a requestor which will get notified of problems detected during
+ * reconciling as they are discovered. The requestor can be set to null indicating
+ * that the client is not interested in problems.
+ * @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null if no progress should be reported
+ * @exception JavaModelException if this compilation unit could not become a working copy.
+ * @see discardWorkingCopy
+ * @since 3.0
+ */
+void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Commits the contents of this working copy to its underlying resource.
+ *
+ * It is possible that the contents of the original resource have changed
+ * since this working copy was created, in which case there is an update conflict.
+ * The value of the force parameter effects the resolution of
+ * such a conflict:
+ * - true - in this case the contents of this working copy are applied to
+ * the underlying resource even though this working copy was created
+ * before a subsequent change in the resource
+ * - false - in this case a JavaModelException is thrown
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing compilation
+ * unit. In particular, such a working copy can then be committed in order to create
+ * the corresponding compilation unit.
+ *
+ * @param force a flag to handle the cases when the contents of the original resource have changed
+ * since this working copy was created
+ * @param monitor the given progress monitor
+ * @exception JavaModelException if this working copy could not commit. Reasons include:
+ * - A CoreException occurred while updating an underlying resource
+ * - This element is not a working copy (INVALID_ELEMENT_TYPES)
+ * - A update conflict (described above) (UPDATE_CONFLICT)
+ * @since 3.0
+ */
+void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Changes this compilation unit in working copy mode back to its original mode.
+ *
+ * This has no effect if this compilation unit was not in working copy mode.
+ *
+ * If becomeWorkingCopy was called several times on this
+ * compilation unit, discardWorkingCopy must be called as
+ * many times before it switches back to the original mode.
+ *
+ * @see becomeWorkingCopy
+ * @exception JavaModelException if this working copy could not return in its original mode.
+ * @since 3.0
+ */
+void discardWorkingCopy() throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Returns the working copy owner of this working copy.
+ * Returns null if it is not a working copy or if it has no owner.
+ *
+ * @return WorkingCopyOwner the owner of this working copy or null
+ * @since 3.0
+ */
+WorkingCopyOwner getOwner();
+ </pre></li>
+ <li><pre>
+/**
+ * Returns a new working copy of this element if this element is not
+ * a working copy, or this element if this element is already a working copy.
+ *
+ * Note: if intending to share a working copy amongst several clients, then
+ * getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
+ * should be used instead.
+ *
+ * When the working copy instance is created, an ADDED IJavaElementDelta is
+ * reported on this working copy.
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing compilation
+ * unit. In particular, such a working copy can then be committed in order to create
+ * the corresponding compilation unit.
+ *
+* @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null if no progress should be reported
+ * @exception JavaModelException if the contents of this element can
+ * not be determined.
+ * @return a new working copy of this element if this element is not
+ * a working copy, or this element if this element is already a working copy
+ * @since 3.0
+ */
+ICompilationUnit getWorkingCopy(IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Returns a shared working copy on this element using the given working copy owner to create
+ * the buffer, or this element if this element is already a working copy.
+ * This API can only answer an already existing working copy if it is based on the same
+ * original compilation unit AND was using the same working copy owner (that is, as defined by Object.equals).
+ *
+ * The life time of a shared working copy is as follows:
+ * - The first call to getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
+ * creates a new working copy for this element
+ * - Subsequent calls increment an internal counter.
+ * - A call to discardWorkingCopy() decrements the internal counter.
+ * - When this counter is 0, the working copy is discarded.
+ *
+ * So users of this method must discard exactly once the working copy.
+ *
+ * Note that the working copy owner will be used for the life time of this working copy, that is if the
+ * working copy is closed then reopened, this owner will be used.
+ * The buffer will be automatically initialized with the original's compilation unit content
+ * upon creation.
+ *
+ * When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this
+ * working copy.
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing compilation
+ * unit. In particular, such a working copy can then be committed in order to create
+ * the corresponding compilation unit.
+ *
+ * @param owner the working copy owner that creates a buffer that is used to get the content
+ * of the working copy
+ * @param problemRequestor a requestor which will get notified of problems detected during
+ * reconciling as they are discovered. The requestor can be set to null indicating
+ * that the client is not interested in problems.
+ * @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null if no progress should be reported
+ * @exception JavaModelException if the contents of this element can
+ * not be determined.
+ * @return a new working copy of this element using the given factory to create
+ * the buffer, or this element if this element is already a working copy
+ * @since 3.0
+ */
+ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ </ul>
+And the following abstract class replaces <code>IBufferFactory</code>:
+ <pre>
+/**
+ * The owner of an ICompilationUnit handle in working copy mode.
+ * An owner is used to identify a working copy and to create its buffer.
+ *
+ * @see ICompilationUnit#becomeWorkingCopy
+ * @see ICompilationUnit#discardWorkingCopy
+ * @since 3.0
+ */
+public abstract class WorkingCopyOwner {
+ /**
+ * Creates a buffer for the given working copy.
+ * The new buffer will be initialized with the contents of the underlying file
+ * if and only if it was not already initialized by the compilation owner (a buffer is
+ * uninitialized if its content is null).
+ *
+ * @param workingCopy the working copy of the buffer
+ * @return IBuffer the created buffer for the given working copy
+ * @see IBuffer
+ */
+ public IBuffer createBuffer(ICompilationUnit workingCopy) {
+ ...
+ }
+}
+ </pre>
+
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38901">38901</a>
+IndexManager hangs in end-less loop
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38908">38908</a>
+Ant script reports that the bootclasspath cannot be infer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38531">38531</a>
+IllegalArgumentException "Source attachment path should be absolute"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38424">38424</a>
+Mistake on Web site
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732">38732</a>
+organize imports does not work with assert in source code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447">38447</a>
+AST: Source ranges with missing bracket
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36854">36854</a>
+NPE opening type hierarchy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33530">33530</a>
+JavaModel synchronization model should be more optimistic
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20931">20931</a>
+Need an API to reload the classpath from the file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38393">38393</a>
+bytecode generated for evaluation with parentheses is wrong
+
+
+<h3>Problem Reports Closed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38977">38977</a>
+Deadlock on index manager while shutting down target eclipse
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38873">38873</a>
+Compilation Units which aren't any.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=7294">7294</a>
+StackOverflowException during IType.getFields()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36777">36777</a>
+refreshing a library results in jzentry==0 failure message
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38766">38766</a>
+Would like the Compiler to ignore the serialVersionUID
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38763">38763</a>
+Unexpected NLS problem
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38441">38441</a>
+Allow src folder exclusion filters with no path that exclude all files of a certain type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38702">38702</a>
+Compiler generates illegal bytecode in switch statement. VerifyError.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38688">38688</a>
+exception in the console window
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38163">38163</a>
+NPE while building type hierarchy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37949">37949</a>
+NPE from SourceTypeConverter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37804">37804</a>
+NPE when opening class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38607">38607</a>
+Refresh does not capture changes in jar files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38674">38674</a>
+3.0 M1 - Preserve unused local variables doesn't seem to work
+
+<p><hr><h1>
+Eclipse Platform Build Notes <br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0 Build - 5th June 2003 - 3.0 MILESTONE-1
+<br>Project org.eclipse.jdt.core v_357
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37274">37274</a>
+Deadlock on plugin import
+
+<h3>Problem Reports Closed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38398">38398</a>
+Deadlock importing binaries
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38398">38509</a>
+deadlock on importing plugins
+
+
+<p><hr><h1>
+Eclipse Platform Build Notes <br>
+Java Development Tooling Core</h1>
Eclipse SDK 3.0 Build - 4th June 2003 - 3.0 MILESTONE-1
<br>Project org.eclipse.jdt.core v_356
<h2>
@@ -368,7 +696,9 @@
[DOM/AST] Incorrect grammar rule in TypeDeclaration
<h3>Problem Reports Closed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36709">36709</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21304">21304</a>
+Have option for compiler warning on redeclaration of instance/class variables as local variables
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36709">36709</a>
absent line numbers msg when debugging
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36620">36620</a>
NPE Searching for workspace references
@@ -421,6 +751,21 @@
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=25838">25838</a>
Warning when overriding field
+<p><hr><h1>
+Eclipse Platform Build Notes <br>
+Java Development Tooling Core</h1>
+Eclipse SDK 2.1 Build (before 3.0/2.1.1 branching) - 31st March 2003
+<br>Project org.eclipse.jdt.core v_312
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35831">35831</a>
+NPE navigating references using links
+
+<h3>Problem Reports Closed</h3>
<p><hr>
For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R21_buildnotes_jdt-core.html">build notes up to Release 2.1</a>.
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
index 6fbb0cf..1843eff 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
@@ -134,10 +134,11 @@
if (VERBOSE)
JobManager.verbose("DISCARD DONE with background job family - " + jobFamily); //$NON-NLS-1$
}
- public void enable() {
+ public synchronized void enable() {
enabled = true;
if (VERBOSE)
JobManager.verbose("ENABLING background indexing"); //$NON-NLS-1$
+ this.notifyAll(); // wake up the background thread if it is waiting (context must be synchronized)
}
public boolean isEnabled() {
return enabled;
@@ -347,7 +348,7 @@
if (idlingStart < 0)
idlingStart = System.currentTimeMillis();
notifyIdle(System.currentTimeMillis() - idlingStart);
- this.wait(); // wait until a new job is posted
+ this.wait(); // wait until a new job is posted (or reenabled:38901)
Thread.sleep(500); // delay before processing the new job, allow some time for the active thread to finish
continue;
} else {