id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
6,000 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"JavaElementResourceMapping",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"CopyArguments",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"MoveArguments",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"RenameArguments",
";",
"public",
"class",
"ParticipantTesting",
"{",
"public",
"static",
"void",
"reset",
"(",
")",
"{",
"TestRenameParticipantShared",
".",
"reset",
"(",
")",
";",
"TestRenameParticipantSingle",
".",
"reset",
"(",
")",
";",
"}",
"public",
"static",
"String",
"[",
"]",
"createHandles",
"(",
"Object",
"object",
")",
"{",
"return",
"createHandles",
"(",
"new",
"Object",
"[",
"]",
"{",
"object",
"}",
")",
";",
"}",
"public",
"static",
"String",
"[",
"]",
"createHandles",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
")",
"{",
"return",
"createHandles",
"(",
"new",
"Object",
"[",
"]",
"{",
"obj1",
",",
"obj2",
"}",
")",
";",
"}",
"public",
"static",
"String",
"[",
"]",
"createHandles",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
",",
"Object",
"obj3",
")",
"{",
"return",
"createHandles",
"(",
"new",
"Object",
"[",
"]",
"{",
"obj1",
",",
"obj2",
",",
"obj3",
"}",
")",
";",
"}",
"public",
"static",
"String",
"[",
"]",
"createHandles",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
",",
"Object",
"obj3",
",",
"Object",
"obj4",
")",
"{",
"return",
"createHandles",
"(",
"new",
"Object",
"[",
"]",
"{",
"obj1",
",",
"obj2",
",",
"obj3",
",",
"obj4",
"}",
")",
";",
"}",
"public",
"static",
"String",
"[",
"]",
"createHandles",
"(",
"Object",
"[",
"]",
"elements",
")",
"{",
"List",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"element",
"=",
"elements",
"[",
"i",
"]",
";",
"if",
"(",
"element",
"instanceof",
"IJavaElement",
")",
"{",
"result",
".",
"add",
"(",
"(",
"(",
"IJavaElement",
")",
"element",
")",
".",
"getHandleIdentifier",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"IResource",
")",
"{",
"result",
".",
"add",
"(",
"(",
"(",
"IResource",
")",
"element",
")",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"JavaElementResourceMapping",
")",
"{",
"result",
".",
"add",
"(",
"(",
"(",
"JavaElementResourceMapping",
")",
"element",
")",
".",
"getJavaElement",
"(",
")",
".",
"getHandleIdentifier",
"(",
")",
"+",
"\"_mapping\"",
")",
";",
"}",
"}",
"return",
"(",
"String",
"[",
"]",
")",
"result",
".",
"toArray",
"(",
"new",
"String",
"[",
"result",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"public",
"static",
"void",
"testRename",
"(",
"String",
"[",
"]",
"expectedHandles",
",",
"RenameArguments",
"[",
"]",
"args",
")",
"{",
"Assert",
".",
"assertEquals",
"(",
"expectedHandles",
".",
"length",
",",
"args",
".",
"length",
")",
";",
"if",
"(",
"expectedHandles",
".",
"length",
"==",
"0",
")",
"{",
"TestRenameParticipantShared",
".",
"testNumberOfElements",
"(",
"0",
")",
";",
"TestRenameParticipantSingle",
".",
"testNumberOfInstances",
"(",
"0",
")",
";",
"}",
"else",
"{",
"testElementsShared",
"(",
"expectedHandles",
",",
"TestRenameParticipantShared",
".",
"fgInstance",
".",
"fHandles",
")",
";",
"TestRenameParticipantShared",
".",
"testArguments",
"(",
"args",
")",
";",
"TestRenameParticipantSingle",
".",
"testNumberOfInstances",
"(",
"expectedHandles",
".",
"length",
")",
";",
"TestRenameParticipantSingle",
".",
"testElements",
"(",
"expectedHandles",
")",
";",
"TestRenameParticipantSingle",
".",
"testArguments",
"(",
"args",
")",
";",
"}",
"}",
"public",
"static",
"void",
"testSimilarElements",
"(",
"List",
"similarList",
",",
"List",
"similarNewNameList",
",",
"List",
"similarNewHandleList",
")",
"{",
"Assert",
".",
"assertEquals",
"(",
"similarList",
".",
"size",
"(",
")",
",",
"similarNewNameList",
".",
"size",
"(",
")",
")",
";",
"if",
"(",
"similarList",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"TestRenameParticipantShared",
".",
"testNumberOfSimilarElements",
"(",
"0",
")",
";",
"}",
"else",
"{",
"TestRenameParticipantShared",
".",
"testSimilarElements",
"(",
"similarList",
",",
"similarNewNameList",
",",
"similarNewHandleList",
")",
";",
"}",
"}",
"private",
"static",
"void",
"testElementsShared",
"(",
"String",
"[",
"]",
"expected",
",",
"List",
"actual",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expected",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"handle",
"=",
"expected",
"[",
"i",
"]",
";",
"Assert",
".",
"assertTrue",
"(",
"\"\"",
"+",
"handle",
",",
"actual",
".",
"contains",
"(",
"handle",
")",
")",
";",
"}",
"testNumberOfElements",
"(",
"expected",
".",
"length",
",",
"actual",
")",
";",
"}",
"private",
"static",
"void",
"testNumberOfElements",
"(",
"int",
"expected",
",",
"List",
"actual",
")",
"{",
"if",
"(",
"expected",
"==",
"0",
"&&",
"actual",
"==",
"null",
")",
"return",
";",
"Assert",
".",
"assertEquals",
"(",
"expected",
",",
"actual",
".",
"size",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,001 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"rename",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"ParticipantTesting",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTestSetup",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotatable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"IJavaRefactorings",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RenameJavaElementDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RefactoringSignatureDescriptorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"refactoring",
".",
"rename",
".",
"RenameFieldProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"JdtFlags",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringCore",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"RenameArguments",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"RenameRefactoring",
";",
"public",
"class",
"RenameFieldTests",
"extends",
"RefactoringTest",
"{",
"private",
"static",
"final",
"Class",
"<",
"RenameFieldTests",
">",
"clazz",
"=",
"RenameFieldTests",
".",
"class",
";",
"private",
"static",
"final",
"String",
"REFACTORING_PATH",
"=",
"\"RenameField/\"",
";",
"public",
"RenameFieldTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"new",
"TestSuite",
"(",
"clazz",
")",
")",
";",
"}",
"public",
"static",
"Test",
"setUpTest",
"(",
"Test",
"test",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"test",
")",
";",
"}",
"protected",
"String",
"getRefactoringPath",
"(",
")",
"{",
"return",
"REFACTORING_PATH",
";",
"}",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"fIsPreDeltaTest",
"=",
"true",
";",
"}",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"private",
"void",
"helper2_0",
"(",
"String",
"typeName",
",",
"String",
"fieldName",
",",
"String",
"newFieldName",
",",
"boolean",
"updateReferences",
",",
"boolean",
"createDelegates",
",",
"boolean",
"renameGetter",
",",
"boolean",
"renameSetter",
",",
"boolean",
"performOnError",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"cu",
"=",
"createCUfromTestFile",
"(",
"getPackageP",
"(",
")",
",",
"\"A\"",
")",
";",
"try",
"{",
"IType",
"classA",
"=",
"getType",
"(",
"cu",
",",
"typeName",
")",
";",
"if",
"(",
"classA",
"==",
"null",
")",
"{",
"classA",
"=",
"cu",
".",
"getJavaProject",
"(",
")",
".",
"findType",
"(",
"typeName",
")",
";",
"}",
"IField",
"field",
"=",
"classA",
".",
"getField",
"(",
"fieldName",
")",
";",
"boolean",
"isEnum",
"=",
"JdtFlags",
".",
"isEnum",
"(",
"field",
")",
";",
"String",
"id",
"=",
"isEnum",
"?",
"IJavaRefactorings",
".",
"RENAME_ENUM_CONSTANT",
":",
"IJavaRefactorings",
".",
"RENAME_FIELD",
";",
"RenameJavaElementDescriptor",
"descriptor",
"=",
"RefactoringSignatureDescriptorFactory",
".",
"createRenameJavaElementDescriptor",
"(",
"id",
")",
";",
"descriptor",
".",
"setUpdateReferences",
"(",
"updateReferences",
")",
";",
"descriptor",
".",
"setJavaElement",
"(",
"field",
")",
";",
"descriptor",
".",
"setNewName",
"(",
"newFieldName",
")",
";",
"if",
"(",
"!",
"isEnum",
")",
"{",
"descriptor",
".",
"setRenameGetters",
"(",
"renameGetter",
")",
";",
"descriptor",
".",
"setRenameSetters",
"(",
"renameSetter",
")",
";",
"descriptor",
".",
"setKeepOriginal",
"(",
"createDelegates",
")",
";",
"descriptor",
".",
"setDeprecateDelegate",
"(",
"true",
")",
";",
"}",
"RenameRefactoring",
"refactoring",
"=",
"(",
"RenameRefactoring",
")",
"createRefactoring",
"(",
"descriptor",
")",
";",
"RenameFieldProcessor",
"processor",
"=",
"(",
"RenameFieldProcessor",
")",
"refactoring",
".",
"getProcessor",
"(",
")",
";",
"List",
"<",
"IAnnotatable",
">",
"elements",
"=",
"new",
"ArrayList",
"<",
"IAnnotatable",
">",
"(",
")",
";",
"elements",
".",
"add",
"(",
"field",
")",
";",
"List",
"<",
"RenameArguments",
">",
"args",
"=",
"new",
"ArrayList",
"<",
"RenameArguments",
">",
"(",
")",
";",
"args",
".",
"add",
"(",
"new",
"RenameArguments",
"(",
"newFieldName",
",",
"updateReferences",
")",
")",
";",
"if",
"(",
"renameGetter",
")",
"{",
"elements",
".",
"add",
"(",
"processor",
".",
"getGetter",
"(",
")",
")",
";",
"args",
".",
"add",
"(",
"new",
"RenameArguments",
"(",
"processor",
".",
"getNewGetterName",
"(",
")",
",",
"updateReferences",
")",
")",
";",
"}",
"if",
"(",
"renameSetter",
")",
"{",
"elements",
".",
"add",
"(",
"processor",
".",
"getSetter",
"(",
")",
")",
";",
"args",
".",
"add",
"(",
"new",
"RenameArguments",
"(",
"processor",
".",
"getNewSetterName",
"(",
")",
",",
"updateReferences",
")",
")",
";",
"}",
"String",
"[",
"]",
"renameHandles",
"=",
"ParticipantTesting",
".",
"createHandles",
"(",
"elements",
".",
"toArray",
"(",
")",
")",
";",
"RefactoringStatus",
"result",
"=",
"performRefactoring",
"(",
"refactoring",
",",
"performOnError",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"result",
"==",
"null",
"||",
"result",
".",
"isOK",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"\"A\"",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"ParticipantTesting",
".",
"testRename",
"(",
"renameHandles",
",",
"(",
"RenameArguments",
"[",
"]",
")",
"args",
".",
"toArray",
"(",
"new",
"RenameArguments",
"[",
"args",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performUndo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"invalid",
"undo\"",
",",
"getFileContents",
"(",
"getInputTestFileName",
"(",
"\"A\"",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performRedo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"invalid",
"redo\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"\"A\"",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"}",
"finally",
"{",
"performDummySearch",
"(",
")",
";",
"cu",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"}",
"private",
"void",
"helper2",
"(",
"boolean",
"updateReferences",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"f\"",
",",
"\"g\"",
",",
"updateReferences",
",",
"false",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"}",
"private",
"void",
"helperPerformOnError",
"(",
"boolean",
"updateReferences",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"f\"",
",",
"\"g\"",
",",
"updateReferences",
",",
"false",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"}",
"private",
"void",
"helperScript",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"B\"",
",",
"\"f\"",
",",
"\"g\"",
",",
"true",
",",
"false",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"}",
"private",
"void",
"helper2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"true",
")",
";",
"}",
"public",
"void",
"testInitializer1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"testInitializer2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"testInitializer3",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test3",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test4",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test5",
"(",
")",
"throws",
"Exception",
"{",
"helperPerformOnError",
"(",
"true",
")",
";",
"}",
"public",
"void",
"test6",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test7",
"(",
")",
"throws",
"Exception",
"{",
"helperPerformOnError",
"(",
"true",
")",
";",
"}",
"public",
"void",
"test8",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test9",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test10",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test11",
"(",
")",
"throws",
"Exception",
"{",
"createCU",
"(",
"(",
"(",
"IPackageFragmentRoot",
")",
"getPackageP",
"(",
")",
".",
"getParent",
"(",
")",
")",
".",
"createPackageFragment",
"(",
"\"o\"",
",",
"true",
",",
"null",
")",
",",
"\"Other.java\"",
",",
"\"\"",
")",
";",
"helper2_0",
"(",
"\"o.Other\"",
",",
"\"FOO\"",
",",
"\"BAR\"",
",",
"true",
",",
"false",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"}",
"public",
"void",
"testScript1",
"(",
")",
"throws",
"Exception",
"{",
"helperScript",
"(",
")",
";",
"}",
"public",
"void",
"testScript2",
"(",
")",
"throws",
"Exception",
"{",
"helperScript",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,002 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"rename",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"rename",
".",
"JavaRefactoringDispatcher",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTestSetup",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ILocalVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RenameJavaElementDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringCore",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"RenameRefactoring",
";",
"public",
"class",
"RenameLocalTests",
"extends",
"RefactoringTest",
"{",
"private",
"static",
"final",
"Class",
"<",
"RenameLocalTests",
">",
"clazz",
"=",
"RenameLocalTests",
".",
"class",
";",
"private",
"static",
"final",
"String",
"REFACTORING_PATH",
"=",
"\"RenameLocal/\"",
";",
"public",
"RenameLocalTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"new",
"TestSuite",
"(",
"clazz",
")",
")",
";",
"}",
"public",
"static",
"Test",
"setUpTest",
"(",
"Test",
"test",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"test",
")",
";",
"}",
"protected",
"String",
"getRefactoringPath",
"(",
")",
"{",
"return",
"REFACTORING_PATH",
";",
"}",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"fIsPreDeltaTest",
"=",
"true",
";",
"}",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"private",
"void",
"helper",
"(",
"String",
"initial",
",",
"String",
"expected",
")",
"throws",
"Exception",
"{",
"RefactoringStatus",
"result",
"=",
"helper",
"(",
"\"A\"",
",",
"initial",
",",
"expected",
",",
"\"NEW\"",
",",
"initial",
".",
"indexOf",
"(",
"\"XXX\"",
")",
",",
"false",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"result",
",",
"result",
".",
"isOK",
"(",
")",
")",
";",
"}",
"private",
"void",
"helperExpectWarning",
"(",
"String",
"initial",
",",
"String",
"expected",
")",
"throws",
"Exception",
"{",
"RefactoringStatus",
"result",
"=",
"helper",
"(",
"\"A\"",
",",
"initial",
",",
"expected",
",",
"\"NEW\"",
",",
"initial",
".",
"indexOf",
"(",
"\"XXX\"",
")",
",",
"true",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"result",
",",
"result",
".",
"hasWarning",
"(",
")",
"&&",
"!",
"result",
".",
"hasError",
"(",
")",
")",
";",
"}",
"private",
"RefactoringStatus",
"helper",
"(",
"String",
"unitNameNoExtension",
",",
"String",
"initial",
",",
"String",
"expected",
",",
"String",
"newVariableName",
",",
"int",
"refactorLocation",
",",
"boolean",
"expectingWarning",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"cu",
"=",
"createCU",
"(",
"getPackageP",
"(",
")",
",",
"\"A.groovy\"",
",",
"initial",
")",
";",
"try",
"{",
"ILocalVariable",
"toRename",
"=",
"(",
"ILocalVariable",
")",
"cu",
".",
"codeSelect",
"(",
"refactorLocation",
",",
"1",
")",
"[",
"0",
"]",
";",
"JavaRefactoringDispatcher",
"dispatcher",
"=",
"new",
"JavaRefactoringDispatcher",
"(",
"toRename",
")",
";",
"dispatcher",
".",
"setNewName",
"(",
"newVariableName",
")",
";",
"RenameJavaElementDescriptor",
"descriptor",
"=",
"dispatcher",
".",
"createDescriptorForLocalVariable",
"(",
")",
";",
"RenameRefactoring",
"refactoring",
"=",
"(",
"RenameRefactoring",
")",
"createRefactoring",
"(",
"descriptor",
")",
";",
"RefactoringStatus",
"result",
"=",
"performRefactoring",
"(",
"refactoring",
",",
"!",
"expectingWarning",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"result",
"==",
"null",
"||",
"result",
".",
"isOK",
"(",
")",
"||",
"result",
".",
"hasWarning",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"\"",
",",
"expected",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performUndo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"invalid",
"undo\"",
",",
"initial",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performRedo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"invalid",
"redo\"",
",",
"expected",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"result",
":",
"new",
"RefactoringStatus",
"(",
")",
";",
"}",
"finally",
"{",
"performDummySearch",
"(",
")",
";",
"cu",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"}",
"public",
"void",
"test0",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"def",
"XXX",
"=",
"9\"",
",",
"\"def",
"NEW",
"=",
"9\"",
")",
";",
"}",
"public",
"void",
"test1",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test2",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test3",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test4",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test5",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test6",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test6a",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test6c",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test7",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test8",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test9",
"(",
")",
"throws",
"Exception",
"{",
"helper",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testWarning0",
"(",
")",
"throws",
"Exception",
"{",
"helperExpectWarning",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testWarning1",
"(",
")",
"throws",
"Exception",
"{",
"helperExpectWarning",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testWarning2",
"(",
")",
"throws",
"Exception",
"{",
"helperExpectWarning",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testWarning3",
"(",
")",
"throws",
"Exception",
"{",
"helperExpectWarning",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
6,003 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"rename",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"ParticipantTesting",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTestSetup",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"IJavaRefactorings",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RenameJavaElementDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RefactoringSignatureDescriptorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"refactoring",
".",
"rename",
".",
"RenameTypeProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"refactoring",
".",
"tagging",
".",
"INameUpdating",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"Refactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"RenameRefactoring",
";",
"public",
"class",
"RenameTypeTests",
"extends",
"RefactoringTest",
"{",
"private",
"static",
"final",
"Class",
"<",
"RenameTypeTests",
">",
"clazz",
"=",
"RenameTypeTests",
".",
"class",
";",
"private",
"static",
"final",
"String",
"REFACTORING_PATH",
"=",
"\"RenameType/\"",
";",
"public",
"RenameTypeTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"new",
"TestSuite",
"(",
"clazz",
")",
")",
";",
"}",
"public",
"static",
"Test",
"setUpTest",
"(",
"Test",
"someTest",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"someTest",
")",
";",
"}",
"protected",
"String",
"getRefactoringPath",
"(",
")",
"{",
"return",
"REFACTORING_PATH",
";",
"}",
"private",
"RenameJavaElementDescriptor",
"createRefactoringDescriptor",
"(",
"IType",
"type",
",",
"String",
"newName",
")",
"{",
"RenameJavaElementDescriptor",
"descriptor",
"=",
"RefactoringSignatureDescriptorFactory",
".",
"createRenameJavaElementDescriptor",
"(",
"IJavaRefactorings",
".",
"RENAME_TYPE",
")",
";",
"descriptor",
".",
"setJavaElement",
"(",
"type",
")",
";",
"descriptor",
".",
"setNewName",
"(",
"newName",
")",
";",
"descriptor",
".",
"setUpdateReferences",
"(",
"true",
")",
";",
"return",
"descriptor",
";",
"}",
"private",
"String",
"[",
"]",
"helperWithTextual",
"(",
"String",
"oldCuName",
",",
"String",
"oldName",
",",
"String",
"newName",
",",
"String",
"newCUName",
",",
"boolean",
"updateReferences",
",",
"boolean",
"updateTextualMatches",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"cu",
"=",
"createCUfromTestFile",
"(",
"getPackageP",
"(",
")",
",",
"oldCuName",
")",
";",
"IType",
"classA",
"=",
"getType",
"(",
"cu",
",",
"oldName",
")",
";",
"IJavaElement",
"[",
"]",
"classAMembers",
"=",
"classA",
".",
"getChildren",
"(",
")",
";",
"IPackageFragment",
"pack",
"=",
"(",
"IPackageFragment",
")",
"cu",
".",
"getParent",
"(",
")",
";",
"String",
"[",
"]",
"renameHandles",
"=",
"null",
";",
"if",
"(",
"classA",
".",
"getDeclaringType",
"(",
")",
"==",
"null",
"&&",
"cu",
".",
"getElementName",
"(",
")",
".",
"startsWith",
"(",
"classA",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"renameHandles",
"=",
"ParticipantTesting",
".",
"createHandles",
"(",
"classA",
",",
"cu",
",",
"cu",
".",
"getResource",
"(",
")",
")",
";",
"}",
"else",
"{",
"renameHandles",
"=",
"ParticipantTesting",
".",
"createHandles",
"(",
"classA",
")",
";",
"}",
"RenameJavaElementDescriptor",
"descriptor",
"=",
"createRefactoringDescriptor",
"(",
"classA",
",",
"newName",
")",
";",
"descriptor",
".",
"setUpdateReferences",
"(",
"updateReferences",
")",
";",
"descriptor",
".",
"setUpdateTextualOccurrences",
"(",
"updateTextualMatches",
")",
";",
"Refactoring",
"refactoring",
"=",
"createRefactoring",
"(",
"descriptor",
")",
";",
"RefactoringStatus",
"result",
"=",
"performRefactoring",
"(",
"refactoring",
",",
"false",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"result",
"==",
"null",
"||",
"result",
".",
"isOK",
"(",
")",
")",
";",
"ICompilationUnit",
"newcu",
"=",
"pack",
".",
"getCompilationUnit",
"(",
"newCUName",
"+",
"\".groovy\"",
")",
";",
"assertTrue",
"(",
"\"cu",
"\"",
"+",
"newcu",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"newcu",
".",
"exists",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"newCUName",
")",
")",
",",
"newcu",
".",
"getSource",
"(",
")",
")",
";",
"INameUpdating",
"nameUpdating",
"=",
"(",
"(",
"INameUpdating",
")",
"refactoring",
".",
"getAdapter",
"(",
"INameUpdating",
".",
"class",
")",
")",
";",
"IType",
"newElement",
"=",
"(",
"IType",
")",
"nameUpdating",
".",
"getNewElement",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"newElement",
".",
"toString",
"(",
")",
",",
"newElement",
".",
"exists",
"(",
")",
")",
";",
"checkMappers",
"(",
"refactoring",
",",
"classA",
",",
"newCUName",
"+",
"\".groovy\"",
",",
"classAMembers",
")",
";",
"return",
"renameHandles",
";",
"}",
"private",
"String",
"[",
"]",
"helper2_0",
"(",
"String",
"oldName",
",",
"String",
"newName",
",",
"String",
"newCUName",
",",
"boolean",
"updateReferences",
")",
"throws",
"Exception",
"{",
"return",
"helperWithTextual",
"(",
"oldName",
",",
"oldName",
",",
"newName",
",",
"newCUName",
",",
"updateReferences",
",",
"false",
")",
";",
"}",
"private",
"String",
"[",
"]",
"helper2",
"(",
"String",
"oldName",
",",
"String",
"newName",
")",
"throws",
"Exception",
"{",
"return",
"helper2_0",
"(",
"oldName",
",",
"newName",
",",
"newName",
",",
"true",
")",
";",
"}",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"setSomeFieldOptions",
"(",
"getPackageP",
"(",
")",
".",
"getJavaProject",
"(",
")",
",",
"\"f\"",
",",
"\"Suf1\"",
",",
"false",
")",
";",
"setSomeFieldOptions",
"(",
"getPackageP",
"(",
")",
".",
"getJavaProject",
"(",
")",
",",
"\"fs\"",
",",
"\"_suffix\"",
",",
"true",
")",
";",
"setSomeLocalOptions",
"(",
"getPackageP",
"(",
")",
".",
"getJavaProject",
"(",
")",
",",
"\"lv\"",
",",
"\"_lv\"",
")",
";",
"setSomeArgumentOptions",
"(",
"getPackageP",
"(",
")",
".",
"getJavaProject",
"(",
")",
",",
"\"pm\"",
",",
"\"_pm\"",
")",
";",
"fIsPreDeltaTest",
"=",
"true",
";",
"}",
"private",
"void",
"setSomeFieldOptions",
"(",
"IJavaProject",
"project",
",",
"String",
"prefixes",
",",
"String",
"suffixes",
",",
"boolean",
"forStatic",
")",
"{",
"if",
"(",
"forStatic",
")",
"{",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_STATIC_FIELD_PREFIXES",
",",
"prefixes",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_STATIC_FIELD_SUFFIXES",
",",
"suffixes",
")",
";",
"}",
"else",
"{",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_FIELD_PREFIXES",
",",
"prefixes",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_FIELD_SUFFIXES",
",",
"suffixes",
")",
";",
"}",
"}",
"private",
"void",
"setSomeLocalOptions",
"(",
"IJavaProject",
"project",
",",
"String",
"prefixes",
",",
"String",
"suffixes",
")",
"{",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_LOCAL_PREFIXES",
",",
"prefixes",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_LOCAL_SUFFIXES",
",",
"suffixes",
")",
";",
"}",
"private",
"void",
"setSomeArgumentOptions",
"(",
"IJavaProject",
"project",
",",
"String",
"prefixes",
",",
"String",
"suffixes",
")",
"{",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_ARGUMENT_PREFIXES",
",",
"prefixes",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CODEASSIST_ARGUMENT_SUFFIXES",
",",
"suffixes",
")",
";",
"}",
"private",
"void",
"checkMappers",
"(",
"Refactoring",
"refactoring",
",",
"IType",
"type",
",",
"String",
"newCUName",
",",
"IJavaElement",
"[",
"]",
"someClassMembers",
")",
"{",
"RenameTypeProcessor",
"rtp",
"=",
"(",
"RenameTypeProcessor",
")",
"(",
"(",
"RenameRefactoring",
")",
"refactoring",
")",
".",
"getProcessor",
"(",
")",
";",
"ICompilationUnit",
"newUnit",
"=",
"(",
"ICompilationUnit",
")",
"rtp",
".",
"getRefactoredJavaElement",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
")",
";",
"assertTrue",
"(",
"newUnit",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"newUnit",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"newCUName",
")",
")",
";",
"IFile",
"newFile",
"=",
"(",
"IFile",
")",
"rtp",
".",
"getRefactoredResource",
"(",
"type",
".",
"getResource",
"(",
")",
")",
";",
"assertTrue",
"(",
"newFile",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"newFile",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"newCUName",
")",
")",
";",
"if",
"(",
"(",
"type",
".",
"getParent",
"(",
")",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"&&",
"type",
".",
"getCompilationUnit",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"type",
".",
"getElementName",
"(",
")",
"+",
"\".groovy\"",
")",
")",
"{",
"assertFalse",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"type",
".",
"getResource",
"(",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"IPackageFragment",
"oldPackage",
"=",
"(",
"IPackageFragment",
")",
"type",
".",
"getCompilationUnit",
"(",
")",
".",
"getParent",
"(",
")",
";",
"IPackageFragment",
"newPackage",
"=",
"(",
"IPackageFragment",
")",
"rtp",
".",
"getRefactoredJavaElement",
"(",
"oldPackage",
")",
";",
"assertEquals",
"(",
"oldPackage",
",",
"newPackage",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"someClassMembers",
".",
"length",
";",
"i",
"++",
")",
"{",
"IMember",
"member",
"=",
"(",
"IMember",
")",
"someClassMembers",
"[",
"i",
"]",
";",
"IJavaElement",
"refactoredMember",
"=",
"rtp",
".",
"getRefactoredJavaElement",
"(",
"member",
")",
";",
"if",
"(",
"member",
"instanceof",
"IMethod",
"&&",
"member",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"type",
".",
"getElementName",
"(",
")",
")",
")",
"continue",
";",
"assertTrue",
"(",
"refactoredMember",
".",
"exists",
"(",
")",
")",
";",
"assertEquals",
"(",
"member",
".",
"getElementName",
"(",
")",
",",
"refactoredMember",
".",
"getElementName",
"(",
")",
")",
";",
"assertFalse",
"(",
"refactoredMember",
".",
"equals",
"(",
"member",
")",
")",
";",
"}",
"}",
"public",
"void",
"test1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test3",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test4",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test5",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test6",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test7",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test8",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test9",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test10",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test11",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test12",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"test13",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testAnnotation1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testAnnotation2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testAnnotation3",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testAlias1",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"p2",
"=",
"getRoot",
"(",
")",
".",
"createPackageFragment",
"(",
"\"p2\"",
",",
"true",
",",
"null",
")",
";",
"String",
"folder",
"=",
"\"p2/\"",
";",
"String",
"type",
"=",
"\"A\"",
";",
"ICompilationUnit",
"cu",
"=",
"createCUfromTestFile",
"(",
"p2",
",",
"type",
",",
"folder",
")",
";",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"assertEqualLines",
"(",
"\"\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"type",
",",
"folder",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"}",
"public",
"void",
"testEnum1",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"p2",
"=",
"getRoot",
"(",
")",
".",
"createPackageFragment",
"(",
"\"p2\"",
",",
"true",
",",
"null",
")",
";",
"String",
"folder",
"=",
"\"p2/\"",
";",
"String",
"type",
"=",
"\"A\"",
";",
"ICompilationUnit",
"cu",
"=",
"createCUfromTestFile",
"(",
"p2",
",",
"type",
",",
"folder",
")",
";",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"assertEqualLines",
"(",
"\"\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"type",
",",
"folder",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"}",
"public",
"void",
"testEnum2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testGenerics1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testGenerics2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testGenerics3",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testGenerics4",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"\"A\"",
",",
"\"B\"",
")",
";",
"}",
"public",
"void",
"testInner1",
"(",
")",
"throws",
"Exception",
"{",
"helperWithTextual",
"(",
"\"Outer\"",
",",
"\"A\"",
",",
"\"B\"",
",",
"\"Outer\"",
",",
"true",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
6,004 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"rename",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"AbstractRefactoringTest",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"MoveDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RefactoringSignatureDescriptorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"Refactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringCore",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"public",
"class",
"MoveCURefactoringTests",
"extends",
"AbstractRefactoringTest",
"{",
"public",
"void",
"testSimpleMove1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"Java.java\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testSimpleMove2",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testSimpleMove3",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"Java.java\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testQualifiedMove1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"Java.java\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testSimpleMove4",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p1\"",
",",
"\"p2\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testQualifiedMove2",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p1\"",
",",
"\"p2\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testNonPrimaryMove1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p1\"",
",",
"\"p2\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testNonPrimaryQualifiedMove1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p1\"",
",",
"\"p2\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"testMoveBack1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"p2\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p1\"",
",",
"\"p2\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"_testInnerMove1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"_testInnerMove2",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"_testInnerMove3",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"public",
"void",
"_testInnerMove4",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"NEW\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"p\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"}",
")",
";",
"}",
"private",
"void",
"performRefactoringAndUndo",
"(",
"String",
"newPackageName",
",",
"String",
"[",
"]",
"packNames",
",",
"String",
"[",
"]",
"cuNames",
",",
"String",
"[",
"]",
"initialContents",
",",
"String",
"[",
"]",
"finalContents",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"newPackage",
"=",
"testProject",
".",
"createPackage",
"(",
"newPackageName",
")",
";",
"ICompilationUnit",
"[",
"]",
"units",
"=",
"createUnits",
"(",
"packNames",
",",
"cuNames",
",",
"initialContents",
")",
";",
"MoveDescriptor",
"descriptor",
"=",
"RefactoringSignatureDescriptorFactory",
".",
"createMoveDescriptor",
"(",
")",
";",
"descriptor",
".",
"setDestination",
"(",
"newPackage",
")",
";",
"descriptor",
".",
"setUpdateReferences",
"(",
"true",
")",
";",
"descriptor",
".",
"setProject",
"(",
"testProject",
".",
"getProject",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"descriptor",
".",
"setUpdateQualifiedNames",
"(",
"true",
")",
";",
"descriptor",
".",
"setMoveResources",
"(",
"new",
"IFile",
"[",
"0",
"]",
",",
"new",
"IFolder",
"[",
"0",
"]",
",",
"new",
"ICompilationUnit",
"[",
"]",
"{",
"units",
"[",
"0",
"]",
"}",
")",
";",
"Refactoring",
"refactoring",
"=",
"createRefactoring",
"(",
"descriptor",
")",
";",
"RefactoringStatus",
"result",
"=",
"performRefactoring",
"(",
"refactoring",
",",
"true",
",",
"true",
")",
";",
"result",
"=",
"ignoreKnownErrors",
"(",
"result",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"result",
",",
"result",
".",
"isOK",
"(",
")",
")",
";",
"ICompilationUnit",
"newUnit",
"=",
"getNewUnit",
"(",
"newPackageName",
",",
"cuNames",
"[",
"0",
"]",
")",
";",
"ICompilationUnit",
"origUnit",
"=",
"units",
"[",
"0",
"]",
";",
"units",
"[",
"0",
"]",
"=",
"newUnit",
";",
"assertContents",
"(",
"units",
",",
"finalContents",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performUndo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"units",
"[",
"0",
"]",
"=",
"origUnit",
";",
"assertContents",
"(",
"units",
",",
"initialContents",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performRedo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"units",
"[",
"0",
"]",
"=",
"newUnit",
";",
"assertContents",
"(",
"units",
",",
"finalContents",
")",
";",
"}",
"private",
"ICompilationUnit",
"getNewUnit",
"(",
"String",
"newPackName",
",",
"String",
"name",
")",
"throws",
"JavaModelException",
"{",
"int",
"dotIndex",
"=",
"name",
".",
"indexOf",
"(",
"'.'",
")",
";",
"String",
"typeName",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"dotIndex",
")",
";",
"String",
"qualName",
"=",
"newPackName",
".",
"length",
"(",
")",
">",
"0",
"?",
"newPackName",
"+",
"\".\"",
"+",
"typeName",
":",
"typeName",
";",
"return",
"testProject",
".",
"getJavaProject",
"(",
")",
".",
"findType",
"(",
"qualName",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,005 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"rename",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"rename",
".",
"SyntheticAccessorsRenameParticipant",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"AbstractRefactoringTest",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"IJavaRefactorings",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RenameJavaElementDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RefactoringSignatureDescriptorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringCore",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"participants",
".",
"RenameRefactoring",
";",
"public",
"class",
"SyntheticAccessorRenamingTests",
"extends",
"AbstractRefactoringTest",
"{",
"public",
"void",
"testSingleFileRename1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"flar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"foon\"",
"+",
"\"\"",
"+",
"\"",
"foon\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"isFoo()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"flarn\"",
"+",
"\"\"",
"+",
"\"",
"flarn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
")",
";",
"}",
"public",
"void",
"testSingleFileRename2",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"flar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"foon\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"foon\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"isFoo()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"flarn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"flarn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"isFoo()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
")",
";",
"}",
"public",
"void",
"testMultiFileRename1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"flar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"foon\"",
"+",
"\"}\"",
",",
"\"package",
"qn\"",
"+",
"\"\"",
"+",
"\"f.foon\"",
"+",
"\"f.getFoo()n\"",
"+",
"\"f.setFoo()n\"",
"+",
"\"f.isFoo()\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"flarn\"",
"+",
"\"}\"",
",",
"\"package",
"qn\"",
"+",
"\"\"",
"+",
"\"f.flarn\"",
"+",
"\"f.getFlar()n\"",
"+",
"\"f.setFlar()n\"",
"+",
"\"f.isFlar()\"",
"}",
")",
";",
"}",
"public",
"void",
"testMultiFileRename2",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"flar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"foon\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"qn\"",
"+",
"\"\"",
"+",
"\"f.foon\"",
"+",
"\"f.getFoo()n\"",
"+",
"\"f.setFoo()n\"",
"+",
"\"f.isFoo()\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"flarn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"qn\"",
"+",
"\"\"",
"+",
"\"f.flarn\"",
"+",
"\"f.getFoo()n\"",
"+",
"\"f.setFoo()n\"",
"+",
"\"f.isFoo()\"",
"}",
")",
";",
"}",
"public",
"void",
"testJavaRename1",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"flar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"Java.java\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"foon\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"flarn\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
")",
";",
"}",
"public",
"void",
"testJavaRename2",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"flar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"foon\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"",
"def",
"flarn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
")",
";",
"}",
"public",
"void",
"testGetterOnly",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"getFlar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
",",
"\"r\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"Java.java\"",
",",
"\"\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"f.foon\"",
"+",
"\"f.getFoo()n\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"f.flarn\"",
"+",
"\"f.getFlar()n\"",
"}",
")",
";",
"}",
"public",
"void",
"testIsserOnly",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"isFlar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
",",
"\"r\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"Java.java\"",
",",
"\"\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"f.foon\"",
"+",
"\"f.isFoo()n\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"f.flarn\"",
"+",
"\"f.isFlar()n\"",
"}",
")",
";",
"}",
"public",
"void",
"testSetterOnly",
"(",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"\"setFlar\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"p\"",
",",
"\"q\"",
",",
"\"r\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"First.groovy\"",
",",
"\"Java.java\"",
",",
"\"\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"f.foon\"",
"+",
"\"f.setFoo()n\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"f.flarn\"",
"+",
"\"f.setFlar()n\"",
"}",
")",
";",
"}",
"private",
"void",
"performRefactoringAndUndo",
"(",
"String",
"newName",
",",
"String",
"[",
"]",
"packNames",
",",
"String",
"[",
"]",
"cuNames",
",",
"String",
"[",
"]",
"initialContents",
",",
"String",
"[",
"]",
"finalContents",
")",
"throws",
"Exception",
"{",
"performRefactoringAndUndo",
"(",
"newName",
",",
"true",
",",
"true",
",",
"packNames",
",",
"cuNames",
",",
"initialContents",
",",
"finalContents",
")",
";",
"}",
"private",
"void",
"performRefactoringAndUndo",
"(",
"String",
"newName",
",",
"boolean",
"updateReferences",
",",
"boolean",
"performOnError",
",",
"String",
"[",
"]",
"packNames",
",",
"String",
"[",
"]",
"cuNames",
",",
"String",
"[",
"]",
"initialContents",
",",
"String",
"[",
"]",
"finalContents",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"[",
"]",
"units",
"=",
"createUnits",
"(",
"packNames",
",",
"cuNames",
",",
"initialContents",
")",
";",
"IMember",
"toRename",
"=",
"(",
"IMember",
")",
"units",
"[",
"0",
"]",
".",
"getTypes",
"(",
")",
"[",
"0",
"]",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"String",
"id",
"=",
"toRename",
"instanceof",
"IField",
"?",
"IJavaRefactorings",
".",
"RENAME_FIELD",
":",
"IJavaRefactorings",
".",
"RENAME_METHOD",
";",
"RenameJavaElementDescriptor",
"descriptor",
"=",
"RefactoringSignatureDescriptorFactory",
".",
"createRenameJavaElementDescriptor",
"(",
"id",
")",
";",
"descriptor",
".",
"setUpdateReferences",
"(",
"updateReferences",
")",
";",
"descriptor",
".",
"setJavaElement",
"(",
"toRename",
")",
";",
"descriptor",
".",
"setNewName",
"(",
"newName",
")",
";",
"descriptor",
".",
"setRenameGetters",
"(",
"false",
")",
";",
"descriptor",
".",
"setRenameSetters",
"(",
"false",
")",
";",
"descriptor",
".",
"setProject",
"(",
"testProject",
".",
"getProject",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"RenameRefactoring",
"refactoring",
"=",
"(",
"RenameRefactoring",
")",
"createRefactoring",
"(",
"descriptor",
")",
";",
"RefactoringStatus",
"result",
"=",
"performRefactoring",
"(",
"refactoring",
",",
"true",
",",
"performOnError",
")",
";",
"if",
"(",
"!",
"performOnError",
")",
"{",
"assertTrue",
"(",
"\"\"",
"+",
"result",
",",
"result",
".",
"isOK",
"(",
")",
")",
";",
"}",
"assertContents",
"(",
"units",
",",
"finalContents",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performUndo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertContents",
"(",
"units",
",",
"initialContents",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performRedo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertContents",
"(",
"units",
",",
"finalContents",
")",
";",
"}",
"}",
"</s>"
] |
6,006 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"rename",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"RefactoringTestSetup",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"IJavaRefactorings",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RenameJavaElementDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"refactoring",
".",
"descriptors",
".",
"RefactoringSignatureDescriptorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringCore",
";",
"public",
"class",
"RenameMethodTests",
"extends",
"RefactoringTest",
"{",
"private",
"static",
"final",
"Class",
"<",
"RenameMethodTests",
">",
"clazz",
"=",
"RenameMethodTests",
".",
"class",
";",
"private",
"static",
"final",
"String",
"REFACTORING_PATH",
"=",
"\"\"",
";",
"public",
"RenameMethodTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"new",
"TestSuite",
"(",
"clazz",
")",
")",
";",
"}",
"public",
"static",
"Test",
"setUpTest",
"(",
"Test",
"test",
")",
"{",
"return",
"new",
"RefactoringTestSetup",
"(",
"test",
")",
";",
"}",
"protected",
"String",
"getRefactoringPath",
"(",
")",
"{",
"return",
"REFACTORING_PATH",
";",
"}",
"private",
"void",
"helper2_0",
"(",
"String",
"typeName",
",",
"String",
"methodName",
",",
"String",
"newMethodName",
",",
"String",
"[",
"]",
"signatures",
",",
"boolean",
"updateReferences",
",",
"boolean",
"createDelegate",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"cu",
"=",
"createCUfromTestFile",
"(",
"getPackageP",
"(",
")",
",",
"\"A\"",
")",
";",
"try",
"{",
"IType",
"classA",
"=",
"getType",
"(",
"cu",
",",
"typeName",
")",
";",
"if",
"(",
"classA",
"==",
"null",
")",
"{",
"classA",
"=",
"cu",
".",
"getJavaProject",
"(",
")",
".",
"findType",
"(",
"typeName",
")",
";",
"}",
"IMethod",
"method",
"=",
"classA",
".",
"getMethod",
"(",
"methodName",
",",
"signatures",
")",
";",
"RenameJavaElementDescriptor",
"descriptor",
"=",
"RefactoringSignatureDescriptorFactory",
".",
"createRenameJavaElementDescriptor",
"(",
"IJavaRefactorings",
".",
"RENAME_METHOD",
")",
";",
"descriptor",
".",
"setUpdateReferences",
"(",
"updateReferences",
")",
";",
"descriptor",
".",
"setJavaElement",
"(",
"method",
")",
";",
"descriptor",
".",
"setNewName",
"(",
"newMethodName",
")",
";",
"descriptor",
".",
"setKeepOriginal",
"(",
"createDelegate",
")",
";",
"descriptor",
".",
"setDeprecateDelegate",
"(",
"true",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"null",
",",
"performRefactoring",
"(",
"descriptor",
")",
")",
";",
"assertEqualLines",
"(",
"\"\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"\"A\"",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performUndo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"invalid",
"undo\"",
",",
"getFileContents",
"(",
"getInputTestFileName",
"(",
"\"A\"",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"!",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToUndo",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"anythingToRedo",
"(",
")",
")",
";",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
".",
"performRedo",
"(",
"null",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEqualLines",
"(",
"\"invalid",
"redo\"",
",",
"getFileContents",
"(",
"getOutputTestFileName",
"(",
"\"A\"",
")",
")",
",",
"cu",
".",
"getSource",
"(",
")",
")",
";",
"}",
"finally",
"{",
"performDummySearch",
"(",
")",
";",
"cu",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"}",
"private",
"void",
"helperDelegate",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"0",
"]",
",",
"true",
",",
"true",
")",
";",
"}",
"private",
"void",
"helper2",
"(",
"boolean",
"updateReferences",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"0",
"]",
",",
"updateReferences",
",",
"false",
")",
";",
"}",
"private",
"void",
"helper2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
"true",
")",
";",
"}",
"public",
"void",
"test1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test3",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"QD;\"",
"}",
",",
"true",
",",
"false",
")",
";",
"}",
"public",
"void",
"test4",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test5",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test6",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test7",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test8",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"B\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"]",
"{",
"}",
",",
"true",
",",
"false",
")",
";",
"}",
"public",
"void",
"test9",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"test10",
"(",
")",
"throws",
"Exception",
"{",
"createCU",
"(",
"(",
"(",
"IPackageFragmentRoot",
")",
"getPackageP",
"(",
")",
".",
"getParent",
"(",
")",
")",
".",
"createPackageFragment",
"(",
"\"o\"",
",",
"true",
",",
"null",
")",
",",
"\"Other.java\"",
",",
"\"\"",
")",
";",
"helper2_0",
"(",
"\"o.Other\"",
",",
"\"FOO\"",
",",
"\"BAR\"",
",",
"new",
"String",
"[",
"0",
"]",
",",
"true",
",",
"false",
")",
";",
"}",
"public",
"void",
"testInitializer1",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"testInitializer2",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"testInitializer3",
"(",
")",
"throws",
"Exception",
"{",
"helper2",
"(",
")",
";",
"}",
"public",
"void",
"testDelegate1",
"(",
")",
"throws",
"Exception",
"{",
"helperDelegate",
"(",
")",
";",
"}",
"public",
"void",
"testDelegate2",
"(",
")",
"throws",
"Exception",
"{",
"helperDelegate",
"(",
")",
";",
"}",
"public",
"void",
"testOverload1",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
",",
"true",
",",
"false",
")",
";",
"}",
"public",
"void",
"testOverload2",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
",",
"true",
",",
"false",
")",
";",
"}",
"public",
"void",
"testOverload3",
"(",
")",
"throws",
"Exception",
"{",
"helper2_0",
"(",
"\"A\"",
",",
"\"m\"",
",",
"\"k\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
",",
"true",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
6,007 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"formatter",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"DefaultGroovyFormatter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"FormatterPreferencesOnStore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"BaseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"TestPrefInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MalformedTreeException",
";",
"public",
"class",
"FormatterTestCase",
"extends",
"BaseTestCase",
"{",
"public",
"FormatterTestCase",
"(",
"String",
"arg0",
",",
"File",
"arg1",
")",
"{",
"super",
"(",
"arg0",
",",
"arg1",
")",
";",
"setName",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFormatter",
"(",
")",
"{",
"doTest",
"(",
")",
";",
"}",
"private",
"void",
"doTest",
"(",
")",
"{",
"boolean",
"indentendOnly",
"=",
"false",
";",
"IPreferenceStore",
"pref",
"=",
"null",
";",
"if",
"(",
"properties",
".",
"get",
"(",
"\"\"",
")",
"!=",
"null",
"&&",
"properties",
".",
"get",
"(",
"\"\"",
")",
".",
"equals",
"(",
"\"true\"",
")",
")",
"{",
"try",
"{",
"pref",
"=",
"TestPrefInitializer",
".",
"initializePreferences",
"(",
"properties",
")",
";",
"String",
"indOnly",
"=",
"properties",
".",
"get",
"(",
"\"\"",
")",
";",
"if",
"(",
"indOnly",
"!=",
"null",
"&&",
"indOnly",
".",
"equals",
"(",
"\"true\"",
")",
")",
"{",
"indentendOnly",
"=",
"true",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"fail",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"DefaultGroovyFormatter",
"formatter",
"=",
"new",
"DefaultGroovyFormatter",
"(",
"selection",
",",
"getDocument",
"(",
")",
",",
"new",
"FormatterPreferencesOnStore",
"(",
"pref",
")",
",",
"indentendOnly",
")",
";",
"try",
"{",
"formatter",
".",
"format",
"(",
")",
".",
"apply",
"(",
"getDocument",
"(",
")",
")",
";",
"}",
"catch",
"(",
"MalformedTreeException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finalAssert",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"finalAssert",
"(",
")",
"{",
"String",
"expected",
"=",
"getExpected",
"(",
")",
".",
"get",
"(",
")",
";",
"String",
"content",
"=",
"getDocument",
"(",
")",
".",
"get",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"file",
"+",
"\"",
"\"",
",",
"expected",
",",
"content",
")",
";",
"}",
"}",
"</s>"
] |
6,008 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"formatter",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
".",
"FormatterPreferenceInitializer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
".",
"FormatterPreferencesPage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"FormatterPreferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"IFormatterPreferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"formatter",
".",
"DefaultCodeFormatterConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"ScopedPreferenceStore",
";",
"public",
"class",
"TestFormatterPreferences",
"extends",
"EclipseTestCase",
"{",
"private",
"static",
"final",
"String",
"TAB_SIZE",
"=",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_SIZE",
";",
"private",
"static",
"final",
"String",
"INDENT_SIZE",
"=",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INDENTATION_SIZE",
";",
"private",
"static",
"final",
"String",
"TAB_CHAR",
"=",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
";",
"private",
"static",
"final",
"String",
"INDENT_EMPTY_LINES",
"=",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INDENT_EMPTY_LINES",
";",
"private",
"static",
"final",
"String",
"BRACES_START",
"=",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_BRACES_START",
";",
"private",
"static",
"final",
"String",
"BRACES_END",
"=",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_BRACES_END",
";",
"private",
"static",
"final",
"String",
"SMART_PASTE",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"PreferenceConstants",
".",
"EDITOR_SMART_PASTE",
";",
"private",
"GroovyCompilationUnit",
"gunit",
";",
"private",
"Hashtable",
"saveJavaOptions",
";",
"@",
"Override",
"public",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"saveJavaOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"if",
"(",
"!",
"hasGroovyNature",
"(",
")",
")",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"pack",
"=",
"testProject",
".",
"createPackage",
"(",
"\"nice.pkg\"",
")",
";",
"gunit",
"=",
"(",
"GroovyCompilationUnit",
")",
"pack",
".",
"createCompilationUnit",
"(",
"\"Test.groovy\"",
",",
"\"\"",
",",
"true",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"new",
"FormatterPreferenceInitializer",
"(",
")",
".",
"initializeDefaultPreferences",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"saveJavaOptions",
")",
";",
"new",
"FormatterPreferenceInitializer",
"(",
")",
".",
"initializeDefaultPreferences",
"(",
")",
";",
"}",
"public",
"void",
"testBracesPrefs",
"(",
")",
"throws",
"Exception",
"{",
"FormatterPreferencesPage",
"preferencesPage",
"=",
"new",
"FormatterPreferencesPage",
"(",
")",
";",
"IPreferenceStore",
"groovyPrefs",
"=",
"preferencesPage",
".",
"getPreferenceStore",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"groovyPrefs",
".",
"contains",
"(",
"BRACES_START",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"groovyPrefs",
".",
"contains",
"(",
"BRACES_END",
")",
")",
";",
"groovyPrefs",
".",
"setValue",
"(",
"BRACES_START",
",",
"PreferenceConstants",
".",
"NEXT",
")",
";",
"FormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"getBracesStart",
"(",
")",
"==",
"PreferenceConstants",
".",
"NEXT_LINE",
")",
";",
"groovyPrefs",
".",
"setValue",
"(",
"BRACES_START",
",",
"PreferenceConstants",
".",
"SAME",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"getBracesStart",
"(",
")",
"==",
"PreferenceConstants",
".",
"SAME_LINE",
")",
";",
"groovyPrefs",
".",
"setValue",
"(",
"BRACES_END",
",",
"PreferenceConstants",
".",
"NEXT",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"getBracesEnd",
"(",
")",
"==",
"PreferenceConstants",
".",
"NEXT_LINE",
")",
";",
"groovyPrefs",
".",
"setValue",
"(",
"BRACES_END",
",",
"PreferenceConstants",
".",
"SAME",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"getBracesEnd",
"(",
")",
"==",
"PreferenceConstants",
".",
"SAME_LINE",
")",
";",
"}",
"public",
"void",
"testTabRelatedPrefs",
"(",
")",
"throws",
"Exception",
"{",
"IPreferenceStore",
"projectPrefs",
"=",
"new",
"ScopedPreferenceStore",
"(",
"new",
"ProjectScope",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
",",
"JavaCore",
".",
"PLUGIN_ID",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"projectPrefs",
".",
"contains",
"(",
"TAB_CHAR",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"projectPrefs",
".",
"contains",
"(",
"TAB_SIZE",
")",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_CHAR",
",",
"JavaCore",
".",
"SPACE",
")",
";",
"IFormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"useTabs",
"(",
")",
"==",
"false",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_CHAR",
",",
"JavaCore",
".",
"TAB",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"useTabs",
"(",
")",
"==",
"true",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_SIZE",
",",
"13",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertEquals",
"(",
"13",
",",
"formatPrefs",
".",
"getTabSize",
"(",
")",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_CHAR",
",",
"JavaCore",
".",
"TAB",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_SIZE",
",",
"11",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"INDENT_SIZE",
",",
"5",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertEquals",
"(",
"11",
",",
"formatPrefs",
".",
"getIndentationSize",
"(",
")",
")",
";",
"assertEquals",
"(",
"11",
",",
"formatPrefs",
".",
"getTabSize",
"(",
")",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_CHAR",
",",
"DefaultCodeFormatterConstants",
".",
"MIXED",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"TAB_SIZE",
",",
"11",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"INDENT_SIZE",
",",
"5",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertEquals",
"(",
"5",
",",
"formatPrefs",
".",
"getIndentationSize",
"(",
")",
")",
";",
"assertEquals",
"(",
"11",
",",
"formatPrefs",
".",
"getTabSize",
"(",
")",
")",
";",
"}",
"public",
"void",
"testIndentEmptyLinesPrefs",
"(",
")",
"throws",
"Exception",
"{",
"IPreferenceStore",
"projectPrefs",
"=",
"new",
"ScopedPreferenceStore",
"(",
"new",
"ProjectScope",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
",",
"JavaCore",
".",
"PLUGIN_ID",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"projectPrefs",
".",
"contains",
"(",
"INDENT_EMPTY_LINES",
")",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"INDENT_EMPTY_LINES",
",",
"DefaultCodeFormatterConstants",
".",
"TRUE",
")",
";",
"IFormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"isIndentEmptyLines",
"(",
")",
")",
";",
"projectPrefs",
".",
"setValue",
"(",
"INDENT_EMPTY_LINES",
",",
"DefaultCodeFormatterConstants",
".",
"FALSE",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertFalse",
"(",
"formatPrefs",
".",
"isIndentEmptyLines",
"(",
")",
")",
";",
"}",
"public",
"void",
"testIndentEmptyLinesFromCore",
"(",
")",
"throws",
"Exception",
"{",
"setJavaPreference",
"(",
"INDENT_EMPTY_LINES",
",",
"DefaultCodeFormatterConstants",
".",
"TRUE",
")",
";",
"IFormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"isIndentEmptyLines",
"(",
")",
")",
";",
"}",
"public",
"void",
"testTabRelatedPrefsFromCore",
"(",
")",
"throws",
"Exception",
"{",
"setJavaPreference",
"(",
"TAB_SIZE",
",",
"\"\"",
"+",
"13",
")",
";",
"IFormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertEquals",
"(",
"13",
",",
"formatPrefs",
".",
"getTabSize",
"(",
")",
")",
";",
"}",
"public",
"void",
"testRefreshPrefsFromCore",
"(",
")",
"throws",
"Exception",
"{",
"setJavaPreference",
"(",
"TAB_SIZE",
",",
"\"\"",
"+",
"13",
")",
";",
"FormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertEquals",
"(",
"13",
",",
"formatPrefs",
".",
"getTabSize",
"(",
")",
")",
";",
"setJavaPreference",
"(",
"TAB_SIZE",
",",
"\"\"",
"+",
"7",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertEquals",
"(",
"7",
",",
"formatPrefs",
".",
"getTabSize",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSmartPaste",
"(",
")",
"throws",
"Exception",
"{",
"IPreferenceStore",
"uiprefs",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"boolean",
"org",
"=",
"uiprefs",
".",
"getBoolean",
"(",
"SMART_PASTE",
")",
";",
"try",
"{",
"assertEquals",
"(",
"org",
",",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
".",
"isSmartPaste",
"(",
")",
")",
";",
"uiprefs",
".",
"setValue",
"(",
"SMART_PASTE",
",",
"!",
"org",
")",
";",
"assertEquals",
"(",
"!",
"org",
",",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
".",
"isSmartPaste",
"(",
")",
")",
";",
"uiprefs",
".",
"setValue",
"(",
"SMART_PASTE",
",",
"org",
")",
";",
"assertEquals",
"(",
"org",
",",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
".",
"isSmartPaste",
"(",
")",
")",
";",
"}",
"finally",
"{",
"uiprefs",
".",
"setValue",
"(",
"SMART_PASTE",
",",
"org",
")",
";",
"}",
"}",
"public",
"void",
"testSemicolonPrefs",
"(",
")",
"throws",
"Exception",
"{",
"FormatterPreferencesPage",
"preferencesPage",
"=",
"new",
"FormatterPreferencesPage",
"(",
")",
";",
"IPreferenceStore",
"groovyPrefs",
"=",
"preferencesPage",
".",
"getPreferenceStore",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"groovyPrefs",
".",
"contains",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS",
")",
")",
";",
"groovyPrefs",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS",
",",
"true",
")",
";",
"FormatterPreferences",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"isRemoveUnnecessarySemicolons",
"(",
")",
"==",
"true",
")",
";",
"groovyPrefs",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS",
",",
"false",
")",
";",
"formatPrefs",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"assertTrue",
"(",
"formatPrefs",
".",
"isRemoveUnnecessarySemicolons",
"(",
")",
"==",
"false",
")",
";",
"}",
"protected",
"void",
"setJavaPreference",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"}",
"</s>"
] |
6,009 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"formatter",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"DefaultGroovyFormatter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"FormatterPreferencesOnStore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"TestPrefInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"public",
"class",
"FindIndentsTests",
"extends",
"TestCase",
"{",
"DefaultGroovyFormatter",
"formatter",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
"String",
">",
"props",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"props",
".",
"put",
"(",
"\"tabsize\"",
",",
"\"3\"",
")",
";",
"IPreferenceStore",
"pref",
"=",
"TestPrefInitializer",
".",
"initializePreferences",
"(",
"props",
")",
";",
"formatter",
"=",
"new",
"DefaultGroovyFormatter",
"(",
"new",
"Document",
"(",
")",
",",
"new",
"FormatterPreferencesOnStore",
"(",
"pref",
")",
",",
"0",
")",
";",
"}",
"public",
"void",
"testIndent1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"",
"f\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"3",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"tttf\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"3",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"ttt\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"3",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"tttn\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"3",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"",
"t",
"t",
"t",
"f\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"3",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"",
"t",
"t",
"tf\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"4",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"f\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"0",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"0",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"public",
"void",
"testIndent9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"line",
"=",
"\"n\"",
";",
"assertEquals",
"(",
"\"\"",
"+",
"line",
"+",
"\"\\\"\"",
",",
"0",
",",
"formatter",
".",
"computeIndentLevel",
"(",
"line",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,010 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"formatter",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"BaseTestSuite",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"public",
"class",
"FormatterTestSuite",
"extends",
"BaseTestSuite",
"{",
"public",
"static",
"TestSuite",
"suite",
"(",
")",
"{",
"TestSuite",
"ts",
"=",
"new",
"TestSuite",
"(",
"\"\"",
")",
";",
"List",
"<",
"File",
">",
"files",
"=",
"getFileList",
"(",
"\"/Formatter\"",
",",
"\"\"",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"ts",
".",
"addTest",
"(",
"new",
"FormatterTestCase",
"(",
"file",
".",
"getName",
"(",
")",
",",
"file",
")",
")",
";",
"}",
"ts",
".",
"addTestSuite",
"(",
"FindIndentsTests",
".",
"class",
")",
";",
"ts",
".",
"addTestSuite",
"(",
"TestFormatterPreferences",
".",
"class",
")",
";",
"ts",
".",
"addTestSuite",
"(",
"GroovyDocumentScannerTests",
".",
"class",
")",
";",
"return",
"ts",
";",
"}",
"}",
"</s>"
] |
6,011 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"formatter",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"greclipse",
".",
"GroovyTokenTypeBridge",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyDocumentScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"antlr",
".",
"Token",
";",
"public",
"class",
"GroovyDocumentScannerTests",
"extends",
"TestCase",
"{",
"private",
"Document",
"editDoc",
";",
"private",
"int",
"caret",
"=",
"0",
";",
"public",
"void",
"testGetTokenBefore",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"a",
"b",
"c\"",
"+",
"\"n\"",
"+",
"\"d",
"e",
"f\"",
")",
";",
"IDocument",
"doc",
"=",
"getDocument",
"(",
")",
";",
"GroovyDocumentScanner",
"scanner",
"=",
"new",
"GroovyDocumentScanner",
"(",
"doc",
")",
";",
"String",
"[",
"]",
"expected",
"=",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"f\"",
",",
"\"e\"",
",",
"\"d\"",
",",
"\"<newline>\"",
",",
"\"c\"",
",",
"\"b\"",
",",
"\"a\"",
"}",
";",
"int",
"expect",
"=",
"0",
";",
"Token",
"token",
"=",
"scanner",
".",
"getLastToken",
"(",
")",
";",
"assertEquals",
"(",
"GroovyTokenTypeBridge",
".",
"EOF",
",",
"token",
".",
"getType",
"(",
")",
")",
";",
"while",
"(",
"token",
"!=",
"null",
")",
"{",
"assertEquals",
"(",
"expected",
"[",
"expect",
"++",
"]",
",",
"token",
".",
"getText",
"(",
")",
")",
";",
"token",
"=",
"scanner",
".",
"getLastTokenBefore",
"(",
"token",
")",
";",
"}",
"assertEquals",
"(",
"expected",
".",
"length",
",",
"expect",
")",
";",
"scanner",
".",
"dispose",
"(",
")",
";",
"}",
"public",
"void",
"testGetLineTokens",
"(",
")",
"throws",
"Exception",
"{",
"String",
"text",
"=",
"\"a",
"b",
"cn\"",
"+",
"\"d",
"e",
"f\"",
";",
"makeEditor",
"(",
"text",
")",
";",
"IDocument",
"doc",
"=",
"getDocument",
"(",
")",
";",
"GroovyDocumentScanner",
"scanner",
"=",
"new",
"GroovyDocumentScanner",
"(",
"doc",
")",
";",
"List",
"<",
"Token",
">",
"tokens",
"=",
"scanner",
".",
"getLineTokensUpto",
"(",
"text",
".",
"indexOf",
"(",
"\"c\"",
")",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"\"a\"",
",",
"\"b\"",
"}",
",",
"tokens",
")",
";",
"tokens",
"=",
"scanner",
".",
"getLineTokensUpto",
"(",
"text",
".",
"indexOf",
"(",
"\"f\"",
")",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"\"d\"",
",",
"\"e\"",
"}",
",",
"tokens",
")",
";",
"scanner",
".",
"dispose",
"(",
")",
";",
"}",
"public",
"void",
"testGetEmptyLineTokens",
"(",
")",
"throws",
"Exception",
"{",
"String",
"text",
"=",
"\"class",
"Foo",
"{n\"",
"+",
"\"",
"n\"",
"+",
"\"",
"n\"",
"+",
"\"}\"",
";",
"makeEditor",
"(",
"text",
")",
";",
"IDocument",
"doc",
"=",
"getDocument",
"(",
")",
";",
"GroovyDocumentScanner",
"scanner",
"=",
"new",
"GroovyDocumentScanner",
"(",
"doc",
")",
";",
"List",
"<",
"Token",
">",
"tokens",
"=",
"scanner",
".",
"getLineTokens",
"(",
"0",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"\"class\"",
",",
"\"Foo\"",
",",
"\"{\"",
",",
"\"<newline>\"",
"}",
",",
"tokens",
")",
";",
"tokens",
"=",
"scanner",
".",
"getLineTokens",
"(",
"1",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
",",
"tokens",
")",
";",
"tokens",
"=",
"scanner",
".",
"getLineTokens",
"(",
"2",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
",",
"tokens",
")",
";",
"tokens",
"=",
"scanner",
".",
"getLineTokens",
"(",
"3",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"\"}\"",
"}",
",",
"tokens",
")",
";",
"scanner",
".",
"dispose",
"(",
")",
";",
"}",
"public",
"void",
"testDocumentEdits",
"(",
")",
"throws",
"Exception",
"{",
"String",
"text",
"=",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
";",
"makeEditor",
"(",
"text",
")",
";",
"IDocument",
"doc",
"=",
"getDocument",
"(",
")",
";",
"GroovyDocumentScanner",
"scanner",
"=",
"new",
"GroovyDocumentScanner",
"(",
"doc",
")",
";",
"List",
"<",
"Token",
">",
"tokens",
"=",
"scanner",
".",
"getLineTokens",
"(",
"1",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"\"def\"",
",",
"\"a\"",
",",
"\"=\"",
",",
"\"<newline>\"",
"}",
",",
"tokens",
")",
";",
"send",
"(",
"\"3+4\"",
")",
";",
"tokens",
"=",
"scanner",
".",
"getLineTokens",
"(",
"1",
")",
";",
"assertTokens",
"(",
"new",
"String",
"[",
"]",
"{",
"\"def\"",
",",
"\"a\"",
",",
"\"=\"",
",",
"\"3\"",
",",
"\"+\"",
",",
"\"4\"",
",",
"\"<newline>\"",
"}",
",",
"tokens",
")",
";",
"scanner",
".",
"dispose",
"(",
")",
";",
"}",
"private",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"editDoc",
";",
"}",
"private",
"void",
"makeEditor",
"(",
"String",
"string",
")",
"{",
"caret",
"=",
"string",
".",
"indexOf",
"(",
"\"<***>\"",
")",
";",
"if",
"(",
"caret",
"<",
"0",
")",
"{",
"caret",
"=",
"0",
";",
"}",
"else",
"{",
"string",
"=",
"string",
".",
"substring",
"(",
"0",
",",
"caret",
")",
"+",
"string",
".",
"substring",
"(",
"caret",
"+",
"\"<***>\"",
".",
"length",
"(",
")",
")",
";",
"}",
"editDoc",
"=",
"new",
"Document",
"(",
"string",
")",
";",
"}",
"private",
"void",
"send",
"(",
"String",
"insertionText",
")",
"throws",
"BadLocationException",
"{",
"editDoc",
".",
"replace",
"(",
"caret",
",",
"0",
",",
"insertionText",
")",
";",
"caret",
"=",
"caret",
"+",
"insertionText",
".",
"length",
"(",
")",
";",
"}",
"private",
"void",
"assertTokens",
"(",
"String",
"[",
"]",
"expected",
",",
"List",
"<",
"Token",
">",
"tokens",
")",
"{",
"assertEquals",
"(",
"expected",
".",
"length",
",",
"tokens",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expected",
".",
"length",
";",
"i",
"++",
")",
"{",
"assertEquals",
"(",
"expected",
"[",
"i",
"]",
",",
"tokens",
".",
"get",
"(",
"i",
")",
".",
"getText",
"(",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,012 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"alltests",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codeassist",
".",
"tests",
".",
"AllCompletionTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
".",
"AllBrowsingTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"AllCoreTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"tests",
".",
"AllDSLTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"junit",
".",
"test",
".",
"AllJUnitTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"AllQuickFixTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"test",
".",
"AllRefactoringTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"AllUITests",
";",
"public",
"class",
"AllGroovyTests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"\"\"",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"SanityTest",
".",
"class",
")",
";",
"suite",
".",
"addTest",
"(",
"AllUITests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllCoreTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllJUnitTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllCompletionTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllBrowsingTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllRefactoringTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllQuickFixTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllDSLTests",
".",
"suite",
"(",
")",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
6,013 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"alltests",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"frameworkadapter",
".",
"util",
".",
"CompilerLevelUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Bundle",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Version",
";",
"public",
"class",
"SanityTest",
"extends",
"TestCase",
"{",
"private",
"Version",
"getEclipseVersion",
"(",
")",
"{",
"Bundle",
"jdtcore",
"=",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"jdtcore",
")",
";",
"return",
"jdtcore",
".",
"getVersion",
"(",
")",
";",
"}",
"private",
"Version",
"getGroovyCompilerVersion",
"(",
")",
"{",
"return",
"CompilerUtils",
".",
"getActiveGroovyBundle",
"(",
")",
".",
"getVersion",
"(",
")",
";",
"}",
"public",
"void",
"testCompilerVersion",
"(",
")",
"throws",
"Exception",
"{",
"Version",
"jdtVersion",
"=",
"getEclipseVersion",
"(",
")",
";",
"Version",
"groovyVersion",
"=",
"getGroovyCompilerVersion",
"(",
")",
";",
"if",
"(",
"jdtVersion",
".",
"getMinor",
"(",
")",
"==",
"8",
")",
"{",
"assertEquals",
"(",
"2",
",",
"groovyVersion",
".",
"getMajor",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"groovyVersion",
".",
"getMinor",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"jdtVersion",
".",
"getMinor",
"(",
")",
"==",
"7",
")",
"{",
"assertEquals",
"(",
"1",
",",
"groovyVersion",
".",
"getMajor",
"(",
")",
")",
";",
"assertEquals",
"(",
"8",
",",
"groovyVersion",
".",
"getMinor",
"(",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,014 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"alltests",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
".",
"BasicGroovyBuildTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
".",
"FullProjectTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"compiler",
".",
"ScriptFolderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
".",
"ASTConverterTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
".",
"ASTNodeSourceLocationsTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
".",
"LocationSupportTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
".",
"SourceLocationsTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
".",
"AnnotationsTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
".",
"GroovyClassFileTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
".",
"GroovyCompilationUnitTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
".",
"GroovyContentTypeTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
".",
"GroovyPartialModelTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
".",
"MoveRenameCopyTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
".",
"AllSearchTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"tests",
".",
"basic",
".",
"GroovySimpleTest",
";",
"public",
"class",
"GroovyJDTTests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"\"\"",
")",
";",
"suite",
".",
"addTest",
"(",
"AnnotationsTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"GroovyCompilationUnitTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"GroovyClassFileTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"GroovyContentTypeTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"MoveRenameCopyTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"GroovyPartialModelTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"BasicGroovyBuildTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"FullProjectTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"LocationSupportTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"SourceLocationsTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ASTNodeSourceLocationsTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ASTConverterTests",
".",
"class",
")",
";",
"suite",
".",
"addTest",
"(",
"GroovySimpleTest",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"ScriptFolderTests",
".",
"suite",
"(",
")",
")",
";",
"suite",
".",
"addTest",
"(",
"AllSearchTests",
".",
"suite",
"(",
")",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
6,015 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"public",
"class",
"CodeSelectStaticImportsTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectStaticImportsTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectStaticImportsTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testStaticImport1",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toLookFor",
"=",
"\"FOO\"",
";",
"assertCodeSelect",
"(",
"contents",
",",
"new",
"SourceRange",
"(",
"contents",
".",
"indexOf",
"(",
"toLookFor",
")",
",",
"toLookFor",
".",
"length",
"(",
")",
")",
",",
"toLookFor",
")",
";",
"}",
"public",
"void",
"testStaticImport2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toLookFor",
"=",
"\"BAR\"",
";",
"assertCodeSelect",
"(",
"contents",
",",
"new",
"SourceRange",
"(",
"contents",
".",
"indexOf",
"(",
"toLookFor",
")",
",",
"toLookFor",
".",
"length",
"(",
")",
")",
",",
"toLookFor",
")",
";",
"}",
"public",
"void",
"testStaticImport3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toLookFor",
"=",
"\"FOO\"",
";",
"assertCodeSelect",
"(",
"contents",
",",
"new",
"SourceRange",
"(",
"contents",
".",
"lastIndexOf",
"(",
"toLookFor",
")",
",",
"toLookFor",
".",
"length",
"(",
")",
")",
",",
"toLookFor",
")",
";",
"}",
"public",
"void",
"testStaticImport4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toLookFor",
"=",
"\"BAR\"",
";",
"assertCodeSelect",
"(",
"contents",
",",
"new",
"SourceRange",
"(",
"contents",
".",
"lastIndexOf",
"(",
"toLookFor",
")",
",",
"toLookFor",
".",
"length",
"(",
")",
")",
",",
"toLookFor",
")",
";",
"}",
"public",
"void",
"testStaticImport5",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toLookFor",
"=",
"\"Other\"",
";",
"assertCodeSelect",
"(",
"contents",
",",
"new",
"SourceRange",
"(",
"contents",
".",
"lastIndexOf",
"(",
"toLookFor",
")",
",",
"toLookFor",
".",
"length",
"(",
")",
")",
",",
"toLookFor",
")",
";",
"}",
"}",
"</s>"
] |
6,016 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"public",
"class",
"CodeSelectFieldsPropertiesTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectFieldsPropertiesTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectFieldsPropertiesTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testGettersAndField1",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"String",
"elementName",
"=",
"toFind",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXxx\"",
";",
"String",
"elementName",
"=",
"toFind",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXxx\"",
";",
"String",
"elementName",
"=",
"\"xxx\"",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"String",
"elementName",
"=",
"\"getXxx\"",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"String",
"elementName",
"=",
"toFind",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXxx\"",
";",
"String",
"elementName",
"=",
"toFind",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"String",
"elementName",
"=",
"\"getXxx\"",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGettersAndField8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXxx\"",
";",
"String",
"elementName",
"=",
"\"xxx\"",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testIsGetter1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"isXxx\"",
";",
"String",
"elementName",
"=",
"\"xxx\"",
";",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"contents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"}",
"</s>"
] |
6,017 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ExpressionStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ReturnStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"Statement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"ASTFragmentFactory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"GroovySnippetCompiler",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"TestProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"junit",
".",
"extension",
".",
"TestCase",
";",
"public",
"class",
"AbstractCheckerTests",
"extends",
"TestCase",
"{",
"private",
"TestProject",
"testProject",
";",
"private",
"GroovySnippetCompiler",
"compiler",
";",
"public",
"AbstractCheckerTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"testProject",
"=",
"new",
"TestProject",
"(",
")",
";",
"compiler",
"=",
"new",
"GroovySnippetCompiler",
"(",
"testProject",
".",
"getGroovyProjectFacade",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"compiler",
".",
"cleanup",
"(",
")",
";",
"testProject",
".",
"dispose",
"(",
")",
";",
"}",
"protected",
"IASTFragment",
"getLastFragment",
"(",
"ModuleNode",
"module",
")",
"{",
"Expression",
"expr",
"=",
"getLastExpression",
"(",
"module",
")",
";",
"if",
"(",
"expr",
"!=",
"null",
")",
"{",
"ASTFragmentFactory",
"factory",
"=",
"new",
"ASTFragmentFactory",
"(",
")",
";",
"return",
"factory",
".",
"createFragment",
"(",
"expr",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"Expression",
"getLastExpression",
"(",
"ModuleNode",
"module",
")",
"{",
"List",
"<",
"Statement",
">",
"statements",
"=",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
";",
"Statement",
"last",
"=",
"statements",
".",
"get",
"(",
"statements",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"if",
"(",
"last",
"instanceof",
"ReturnStatement",
")",
"{",
"return",
"(",
"(",
"ReturnStatement",
")",
"last",
")",
".",
"getExpression",
"(",
")",
";",
"}",
"else",
"if",
"(",
"last",
"instanceof",
"ExpressionStatement",
")",
"{",
"return",
"(",
"(",
"ExpressionStatement",
")",
"last",
")",
".",
"getExpression",
"(",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"ModuleNode",
"createModuleFromText",
"(",
"String",
"text",
")",
"throws",
"CoreException",
"{",
"return",
"compiler",
".",
"compile",
"(",
"text",
")",
";",
"}",
"}",
"</s>"
] |
6,018 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"CodeSelectLocalTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectLocalTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectLocalTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testLocalVar1",
"(",
")",
"throws",
"Exception",
"{",
"assertSelection",
"(",
"\"\"",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testLocalVar2",
"(",
")",
"throws",
"Exception",
"{",
"assertSelection",
"(",
"\"\"",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testLocalVar3",
"(",
")",
"throws",
"Exception",
"{",
"assertSelection",
"(",
"\"\"",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testLocalVar4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertSelection",
"(",
"contents",
",",
"\"xxx\"",
")",
";",
"assertSelection",
"(",
"contents",
",",
"\"yyy\"",
")",
";",
"}",
"public",
"void",
"testLocalVar5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"in\\\"$i\\\"\"",
";",
"assertSelection",
"(",
"contents",
",",
"\"i\"",
")",
";",
"}",
"public",
"void",
"testLocalVar6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"in\\\"$i\\\"\"",
";",
"assertSelection",
"(",
"contents",
",",
"\"i\"",
",",
"\"$i\"",
")",
";",
"}",
"void",
"assertSelection",
"(",
"String",
"contents",
",",
"String",
"varName",
")",
"throws",
"Exception",
"{",
"assertSelection",
"(",
"contents",
",",
"varName",
",",
"varName",
")",
";",
"}",
"void",
"assertSelection",
"(",
"String",
"contents",
",",
"String",
"varName",
",",
"String",
"selectionText",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"selectionText",
")",
",",
"selectionText",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"varName",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"Should",
"exist\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,019 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"CodeSelectTypesTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectTypesTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectTypesTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectSuperClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contentsSuper",
"=",
"\"\"",
";",
"String",
"contentsSub",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super\"",
",",
"contentsSuper",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Sub\"",
",",
"contentsSub",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Sub.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contentsSub",
".",
"indexOf",
"(",
"\"Super\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Super\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectSuperClass2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contentsSuper",
"=",
"\"\"",
";",
"String",
"contentsSub",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super2\"",
",",
"contentsSuper",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Sub2\"",
",",
"contentsSub",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Sub2.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contentsSub",
".",
"indexOf",
"(",
"\"Super\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Super\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectThisClass",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"This\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"This\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectFieldType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"List\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectMethodType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"List\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectMethodParamType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"List\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectLocalVarType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"List\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectLocalVarTypeInClosure",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"List\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectLocalVarTypeInScript",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"List",
"y\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"List\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectTypeInAnnotation1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"ATest\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"ATest\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectTypeInAnnotation2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"javaContents",
"=",
"\"enum",
"Foo",
"{n\"",
"+",
"\"FOO1,",
"FOO2n\"",
"+",
"\"}",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"Foo\"",
",",
"javaContents",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Sub2\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Sub2.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"Foo\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Foo\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectTypeInAnnotation3",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"javaContents",
"=",
"\"enum",
"Foo",
"{n\"",
"+",
"\"FOO1,",
"FOO2n\"",
"+",
"\"}",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"Foo\"",
",",
"javaContents",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Sub2\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Sub2.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"FOO1\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"FOO1\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectThis1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"this\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"AClass\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectThis2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"this\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"AClass\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectSuper1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"super\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Super\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectSuper2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"super\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Super\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectInnerType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"Inner\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Inner\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectInnerType2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"Inner\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Inner\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectInnerType3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"Inner\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Inner\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectInnerType4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"Inner\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Inner\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectInnerType5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"InnerInner\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"InnerInner\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testSelectInnerType6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testAnnotationOnImport",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"@Deprecated\"",
"+",
"\"\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createCompilationUnit",
"(",
"contents",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"Deprecated\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Deprecated\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"private",
"GroovyCompilationUnit",
"createCompilationUnit",
"(",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Clazz\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Clazz.groovy\"",
")",
";",
"return",
"unit",
";",
"}",
"}",
"</s>"
] |
6,020 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"FindAllOccurrencesVisitor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"IsSameExpression",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"public",
"class",
"IsSameExpressionTests",
"extends",
"AbstractCheckerTests",
"{",
"public",
"IsSameExpressionTests",
"(",
")",
"{",
"super",
"(",
"IsSameExpressionTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testIsSame1",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame2",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\\\"FOO\\\"\"",
",",
"\"\\\"FOO",
"\\\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testIsSame3",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame4",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame5",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testIsSame6",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame7",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame8",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\"",
",",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame9",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\\\"$foo",
"\\\"\"",
",",
"\"\\\"$foo",
"\\\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testIsSame10",
"(",
")",
"throws",
"Exception",
"{",
"checkTwoExpressions",
"(",
"\"\\\"$foo",
"\\\"\"",
",",
"\"\\\"$foo\\\"\"",
",",
"false",
")",
";",
"}",
"private",
"void",
"checkTwoExpressions",
"(",
"String",
"first",
",",
"String",
"second",
",",
"boolean",
"isSame",
")",
"throws",
"CoreException",
"{",
"Expression",
"firstExpr",
"=",
"getLastExpression",
"(",
"createModuleFromText",
"(",
"first",
")",
")",
";",
"Expression",
"secondExpr",
"=",
"getLastExpression",
"(",
"createModuleFromText",
"(",
"second",
")",
")",
";",
"assertEquals",
"(",
"createMsg",
"(",
"first",
",",
"second",
",",
"isSame",
")",
",",
"isSame",
",",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"firstExpr",
",",
"secondExpr",
")",
")",
";",
"}",
"private",
"String",
"createMsg",
"(",
"String",
"first",
",",
"String",
"second",
",",
"boolean",
"isSame",
")",
"{",
"String",
"end",
"=",
"\"\"",
"+",
"first",
"+",
"\"\"",
"+",
"second",
";",
"return",
"(",
"isSame",
"?",
"\"\"",
":",
"\"\"",
")",
"+",
"end",
";",
"}",
"}",
"</s>"
] |
6,021 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"CodeSelectFieldsTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectFieldsTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectFieldsTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"public",
"void",
"testCodeSelectVarInScript",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectFieldInClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello1\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectFieldInOtherClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"IPath",
"hello2Path",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"hello2Path",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectFieldInSuperClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"IPath",
"hello2Path",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"hello2Path",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticFieldInClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticFieldInOtherClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"x(\\\"hello\\\")n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'t'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"t\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInClosure2Params",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"x(\\\"hello\\\")n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'t'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"t\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectLocalVarInClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello2\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'y'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"y\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectFieldInClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'y'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"y\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectFieldFromSuperInClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'y'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"y\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticFieldInClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"ndef",
"z()",
"{n\"",
"+",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"}n\"",
"+",
"\"}\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'y'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"y\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticFieldFromOtherInClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'y'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"y\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInFieldInitializer",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"'z'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"z\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInStaticFieldInitializer",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"'z'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"z\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectOfGeneratedGetter",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"getNum\"",
")",
",",
"\"getNum\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"num\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectOfGeneratedSetter",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"setNum\"",
")",
",",
"\"setNum\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"num\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInsideGString1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"foo\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInsideGString2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"foo\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInsideGString3",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"toString\"",
")",
",",
"\"toString\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"toString\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInsideGString4",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"o\"",
")",
"+",
"1",
",",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"foo\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInsideGString5",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"toString\"",
")",
",",
"\"toString\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"toString\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"elt",
"[",
"0",
"]",
".",
"exists",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,022 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"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",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"DefaultWorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedBinaryField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedBinaryMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedSourceField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedSourceMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedSourceType",
";",
"public",
"abstract",
"class",
"BrowsingTestCase",
"extends",
"BuilderTests",
"{",
"public",
"BrowsingTestCase",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"ICompilationUnit",
"[",
"]",
"wcs",
"=",
"new",
"ICompilationUnit",
"[",
"0",
"]",
";",
"int",
"i",
"=",
"0",
";",
"do",
"{",
"wcs",
"=",
"JavaCore",
".",
"getWorkingCopies",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"for",
"(",
"ICompilationUnit",
"workingCopy",
":",
"wcs",
")",
"{",
"try",
"{",
"workingCopy",
".",
"discardWorkingCopy",
"(",
")",
";",
"workingCopy",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"i",
"++",
";",
"if",
"(",
"i",
">",
"20",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"wcs",
")",
";",
"}",
"}",
"while",
"(",
"wcs",
".",
"length",
">",
"0",
")",
";",
"}",
"protected",
"IPath",
"createGenericProject",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
";",
"if",
"(",
"!",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"\"Project\"",
")",
".",
"exists",
"(",
")",
")",
"{",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"}",
"else",
"{",
"projectPath",
"=",
"env",
".",
"getJavaProject",
"(",
"\"Project\"",
")",
".",
"getPath",
"(",
")",
";",
"}",
"return",
"projectPath",
";",
"}",
"protected",
"IFile",
"getFile",
"(",
"IPath",
"projectPath",
",",
"String",
"fileName",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"projectPath",
".",
"append",
"(",
"fileName",
")",
")",
";",
"}",
"protected",
"IFile",
"getFile",
"(",
"IPath",
"filePath",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"filePath",
")",
";",
"}",
"protected",
"IFolder",
"getFolder",
"(",
"IPath",
"projectPath",
",",
"String",
"folderName",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"projectPath",
".",
"append",
"(",
"folderName",
")",
")",
";",
"}",
"protected",
"IProject",
"getProject",
"(",
"IPath",
"projectPath",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectPath",
".",
"segment",
"(",
"0",
")",
")",
";",
"}",
"public",
"ICompilationUnit",
"getJavaCompilationUnit",
"(",
"IPath",
"sourceRootPath",
",",
"String",
"qualifiedNameWithSlashesDotJava",
")",
"{",
"IFile",
"file",
"=",
"getFile",
"(",
"sourceRootPath",
",",
"qualifiedNameWithSlashesDotJava",
")",
";",
"return",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"public",
"GroovyCompilationUnit",
"getGroovyCompilationUnit",
"(",
"IPath",
"sourceRootPath",
",",
"String",
"qualifiedNameWithSlashesDotGroovy",
")",
"throws",
"Exception",
"{",
"IFile",
"file",
"=",
"getFile",
"(",
"sourceRootPath",
",",
"qualifiedNameWithSlashesDotGroovy",
")",
";",
"waitUntilIndexesReady",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"return",
"unit",
";",
"}",
"public",
"GroovyCompilationUnit",
"getGroovyCompilationUnit",
"(",
"IPath",
"pathToCU",
")",
"throws",
"Exception",
"{",
"IFile",
"file",
"=",
"getFile",
"(",
"pathToCU",
")",
";",
"waitUntilIndexesReady",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"return",
"unit",
";",
"}",
"protected",
"GroovyCompilationUnit",
"getCompilationUnitFor",
"(",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"File\"",
",",
"contents",
")",
";",
"return",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"File.groovy\"",
")",
";",
"}",
"protected",
"void",
"assertCodeSelect",
"(",
"String",
"structureContents",
",",
"String",
"groovyContents",
",",
"String",
"toFind",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertCodeSelect",
"(",
"structureContents",
",",
"null",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"protected",
"void",
"assertCodeSelect",
"(",
"String",
"structureContents",
",",
"String",
"javaContents",
",",
"String",
"groovyContents",
",",
"String",
"toFind",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
",",
"toFind",
")",
";",
"}",
"protected",
"void",
"assertCodeSelect",
"(",
"String",
"structureContents",
",",
"String",
"javaContents",
",",
"String",
"groovyContents",
",",
"String",
"toFind",
",",
"String",
"elementName",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
",",
"false",
")",
";",
"}",
"protected",
"void",
"assertGroovyCodeSelect",
"(",
"String",
"structureContents",
",",
"String",
"javaContents",
",",
"String",
"groovyContents",
",",
"String",
"toFind",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
",",
"toFind",
",",
"true",
")",
";",
"}",
"protected",
"void",
"assertCodeSelect",
"(",
"String",
"structureContents",
",",
"String",
"javaContents",
",",
"String",
"groovyContents",
",",
"String",
"toFind",
",",
"String",
"elementName",
",",
"boolean",
"isGroovy",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
",",
"new",
"SourceRange",
"(",
"groovyContents",
".",
"lastIndexOf",
"(",
"toFind",
")",
",",
"toFind",
".",
"length",
"(",
")",
")",
",",
"elementName",
",",
"isGroovy",
")",
";",
"}",
"protected",
"void",
"assertCodeSelect",
"(",
"String",
"groovyContents",
",",
"SourceRange",
"selectRange",
",",
"String",
"elementName",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertCodeSelect",
"(",
"null",
",",
"null",
",",
"groovyContents",
",",
"null",
",",
"selectRange",
",",
"elementName",
",",
"true",
")",
";",
"}",
"protected",
"void",
"assertCodeSelect",
"(",
"String",
"structureContents",
",",
"String",
"javaContents",
",",
"String",
"groovyContents",
",",
"String",
"toFind",
",",
"SourceRange",
"selectRegion",
",",
"String",
"elementName",
",",
"boolean",
"isGroovy",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"if",
"(",
"structureContents",
"!=",
"null",
")",
"{",
"if",
"(",
"javaContents",
"!=",
"null",
")",
"{",
"if",
"(",
"isGroovy",
")",
"{",
"createUnit",
"(",
"\"Structure\"",
",",
"structureContents",
")",
";",
"}",
"else",
"{",
"createJavaUnit",
"(",
"\"Structure\"",
",",
"structureContents",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"isGroovy",
")",
"{",
"createJavaUnit",
"(",
"\"XX\"",
",",
"structureContents",
")",
";",
"}",
"else",
"{",
"createJavaUnit",
"(",
"\"XX\"",
",",
"structureContents",
")",
";",
"}",
"}",
"}",
"GroovyCompilationUnit",
"groovyUnit",
"=",
"createUnit",
"(",
"groovyContents",
")",
";",
"ICompilationUnit",
"javaUnit",
"=",
"null",
";",
"if",
"(",
"javaContents",
"!=",
"null",
")",
"{",
"javaUnit",
"=",
"createJavaUnit",
"(",
"\"Java\"",
",",
"javaContents",
")",
";",
"}",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"eltFromGroovy",
"=",
"groovyUnit",
".",
"codeSelect",
"(",
"selectRegion",
".",
"getOffset",
"(",
")",
",",
"selectRegion",
".",
"getLength",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"eltFromGroovy",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"elementName",
",",
"elementName",
",",
"eltFromGroovy",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"javaUnit",
"!=",
"null",
")",
"{",
"IJavaElement",
"[",
"]",
"eltFromJava",
"=",
"javaUnit",
".",
"codeSelect",
"(",
"javaContents",
".",
"lastIndexOf",
"(",
"toFind",
")",
",",
"toFind",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"eltFromJava",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"elementName",
",",
"elementName",
",",
"eltFromJava",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"String",
"groovyUniqueKey",
"=",
"getUniqueKey",
"(",
"eltFromGroovy",
"[",
"0",
"]",
")",
";",
"String",
"javaUniqueKey",
"=",
"getUniqueKey",
"(",
"eltFromJava",
"[",
"0",
"]",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"javaUniqueKey",
",",
"groovyUniqueKey",
")",
";",
"}",
"}",
"protected",
"String",
"getUniqueKey",
"(",
"IJavaElement",
"elt",
")",
"{",
"if",
"(",
"elt",
"instanceof",
"ResolvedSourceField",
")",
"{",
"return",
"(",
"(",
"ResolvedSourceField",
")",
"elt",
")",
".",
"getKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"elt",
"instanceof",
"ResolvedSourceMethod",
")",
"{",
"return",
"(",
"(",
"ResolvedSourceMethod",
")",
"elt",
")",
".",
"getKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"elt",
"instanceof",
"ResolvedSourceType",
")",
"{",
"return",
"(",
"(",
"ResolvedSourceType",
")",
"elt",
")",
".",
"getKey",
"(",
")",
";",
"}",
"if",
"(",
"elt",
"instanceof",
"ResolvedBinaryField",
")",
"{",
"return",
"(",
"(",
"ResolvedBinaryField",
")",
"elt",
")",
".",
"getKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"elt",
"instanceof",
"ResolvedBinaryMethod",
")",
"{",
"return",
"(",
"(",
"ResolvedBinaryMethod",
")",
"elt",
")",
".",
"getKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"elt",
"instanceof",
"ResolvedBinaryType",
")",
"{",
"return",
"(",
"(",
"ResolvedBinaryType",
")",
"elt",
")",
".",
"getKey",
"(",
")",
";",
"}",
"fail",
"(",
"\"Element",
"\"",
"+",
"elt",
"+",
"\"\"",
")",
";",
"return",
"null",
";",
"}",
"protected",
"GroovyCompilationUnit",
"createUnit",
"(",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"return",
"createUnit",
"(",
"\"Hello\"",
",",
"contents",
")",
";",
"}",
"protected",
"GroovyCompilationUnit",
"createUnit",
"(",
"String",
"name",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"name",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"name",
"+",
"\".groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"return",
"unit",
";",
"}",
"protected",
"ICompilationUnit",
"createJavaUnit",
"(",
"String",
"className",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"className",
",",
"contents",
")",
";",
"ICompilationUnit",
"unit",
"=",
"getJavaCompilationUnit",
"(",
"root",
",",
"className",
"+",
"\".java\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"return",
"unit",
";",
"}",
"public",
"static",
"void",
"waitUntilIndexesReady",
"(",
")",
"{",
"SearchEngine",
"engine",
"=",
"new",
"SearchEngine",
"(",
")",
";",
"IJavaSearchScope",
"scope",
"=",
"SearchEngine",
".",
"createWorkspaceScope",
"(",
")",
";",
"try",
"{",
"engine",
".",
"searchAllTypeNames",
"(",
"null",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"\"!@$#!@\"",
".",
"toCharArray",
"(",
")",
",",
"SearchPattern",
".",
"R_PATTERN_MATCH",
"|",
"SearchPattern",
".",
"R_CASE_SENSITIVE",
",",
"IJavaSearchConstants",
".",
"CLASS",
",",
"scope",
",",
"new",
"TypeNameRequestor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"acceptType",
"(",
"int",
"modifiers",
",",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"simpleTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"enclosingTypeNames",
",",
"String",
"path",
")",
"{",
"}",
"}",
",",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"}",
"}",
"</s>"
] |
6,023 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ExpressionStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ReturnStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"Statement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"ASTFragmentFactory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"ASTFragmentKind",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"BinaryExpressionFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"FragmentVisitor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"MethodCallFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"PropertyExpressionFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"SimpleExpressionASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"public",
"class",
"ASTFragmentTests",
"extends",
"BrowsingTestCase",
"{",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"JavaCore",
".",
"getWorkingCopies",
"(",
"null",
")",
")",
";",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"private",
"class",
"TestFragmentVisitor",
"extends",
"FragmentVisitor",
"{",
"private",
"Stack",
"<",
"ASTFragmentKind",
">",
"expectedKinds",
";",
"void",
"checkExpectedKinds",
"(",
"IASTFragment",
"fragment",
",",
"ASTFragmentKind",
"...",
"expectedKindsArr",
")",
"{",
"this",
".",
"expectedKinds",
"=",
"new",
"Stack",
"<",
"ASTFragmentKind",
">",
"(",
")",
";",
"List",
"<",
"ASTFragmentKind",
">",
"list",
"=",
"Arrays",
".",
"asList",
"(",
"expectedKindsArr",
")",
";",
"Collections",
".",
"reverse",
"(",
"list",
")",
";",
"this",
".",
"expectedKinds",
".",
"addAll",
"(",
"list",
")",
";",
"fragment",
".",
"accept",
"(",
"this",
")",
";",
"if",
"(",
"!",
"expectedKinds",
".",
"isEmpty",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"BinaryExpressionFragment",
"fragment",
")",
"{",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"isEmpty",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"pop",
"(",
")",
"!=",
"fragment",
".",
"kind",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"return",
"super",
".",
"visit",
"(",
"fragment",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"MethodCallFragment",
"fragment",
")",
"{",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"isEmpty",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"pop",
"(",
")",
"!=",
"fragment",
".",
"kind",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"return",
"super",
".",
"visit",
"(",
"fragment",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"PropertyExpressionFragment",
"fragment",
")",
"{",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"isEmpty",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"pop",
"(",
")",
"!=",
"fragment",
".",
"kind",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"return",
"super",
".",
"visit",
"(",
"fragment",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"SimpleExpressionASTFragment",
"fragment",
")",
"{",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"isEmpty",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"expectedKinds",
".",
"pop",
"(",
")",
"!=",
"fragment",
".",
"kind",
"(",
")",
")",
"{",
"fail",
"(",
")",
";",
"}",
"return",
"super",
".",
"visit",
"(",
"fragment",
")",
";",
"}",
"}",
"public",
"ASTFragmentTests",
"(",
")",
"{",
"super",
"(",
"ASTFragmentTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testASTFragment1",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"a\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"1",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment2",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"a+b\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"2",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment3",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"a",
".",
"b\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"2",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment4",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.&b\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"a",
".&",
"b\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"2",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"METHOD_POINTER",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment5",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.b(f).j\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"3",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment6",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.j.b(f)\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"a.j.b(f)\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"3",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
")",
";",
"}",
"public",
"void",
"testASTFragment7",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"b(f).j.a\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"b(f).j.a\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"4",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment8",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"b(f)\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"b(f)\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"2",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
")",
";",
"}",
"public",
"void",
"testASTFragment9",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"8",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTFragment10",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"first",
",",
"8",
",",
"first",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment1a",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.b.c\"",
")",
";",
"String",
"contents",
"=",
"\"a.b.c.d\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"0",
",",
"contents",
".",
"indexOf",
"(",
"\".d\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment1b",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"JavaCore",
".",
"getWorkingCopies",
"(",
"null",
")",
")",
";",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.b.c\"",
")",
";",
"String",
"contents",
"=",
"\"z.a.b.c.d\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"2",
",",
"contents",
".",
"indexOf",
"(",
"\".d\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentDifferent",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment2a",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.b.c\"",
")",
";",
"String",
"contents",
"=",
"\"a.b.c.dddda\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"0",
",",
"contents",
".",
"indexOf",
"(",
"\"da\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment2b",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a.b.c\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"2",
",",
"contents",
".",
"indexOf",
"(",
"\"da\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentDifferent",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"first",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment3",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b",
"-",
"c\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"4",
",",
"contents",
".",
"indexOf",
"(",
"\"",
">>\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment4",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b",
"-",
"c\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"4",
",",
"contents",
".",
"indexOf",
"(",
"\"",
">>\"",
")",
"+",
"2",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testASTSubFragment5",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"0",
",",
"contents",
".",
"indexOf",
"(",
"\")\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"2",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"PROPERTY",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
")",
";",
"}",
"public",
"void",
"testASTSubFragment6",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"first",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"IASTFragment",
"second",
"=",
"createFragmentFromText",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"\"c\"",
")",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"second",
",",
"3",
",",
"second",
".",
"fragmentLength",
"(",
")",
")",
";",
"assertFragmentSame",
"(",
"first",
",",
"second",
")",
";",
"new",
"TestFragmentVisitor",
"(",
")",
".",
"checkExpectedKinds",
"(",
"second",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"BINARY",
",",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment1",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b",
"-",
"c\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment2",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b",
"-",
"c\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a",
"-",
"b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment3",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment4",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a",
"+",
"b",
"-c\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment5",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a+b\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment6",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment7",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment8",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a.b.&c\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment9",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a.b.c()\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment10",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a.b()\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a.b\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment11",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment12",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a.b(foo)\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment13",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"a.b.c.d\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"b.c.d\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment14",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"b().c().d()\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment15",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"b-nn",
"c*a\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"b",
"-c\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment16",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"a=b",
"-",
"c\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment17",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertIsEmptyFragment",
"(",
"matched",
")",
";",
"}",
"public",
"void",
"testMatchSubFragment18",
"(",
")",
"throws",
"Exception",
"{",
"IASTFragment",
"fragment",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"toMatch",
"=",
"createFragmentFromText",
"(",
"\"\"",
")",
";",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toMatch",
")",
";",
"assertFragmentSame",
"(",
"toMatch",
",",
"matched",
")",
";",
"}",
"private",
"void",
"assertIsEmptyFragment",
"(",
"IASTFragment",
"fragment",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"fragment",
",",
"ASTFragmentKind",
".",
"EMPTY",
",",
"fragment",
".",
"kind",
"(",
")",
")",
";",
"}",
"private",
"void",
"assertFragmentSame",
"(",
"IASTFragment",
"first",
",",
"IASTFragment",
"second",
")",
"{",
"if",
"(",
"!",
"first",
".",
"matches",
"(",
"second",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"first",
"+",
"\"n\"",
"+",
"second",
")",
";",
"}",
"}",
"private",
"void",
"assertFragmentDifferent",
"(",
"IASTFragment",
"first",
",",
"IASTFragment",
"second",
")",
"{",
"if",
"(",
"first",
".",
"matches",
"(",
"second",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"first",
"+",
"\"n\"",
"+",
"second",
")",
";",
"}",
"}",
"private",
"IASTFragment",
"createFragmentFromText",
"(",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"getCompilationUnitFor",
"(",
"contents",
")",
";",
"Statement",
"statement",
"=",
"(",
"Statement",
")",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"Expression",
"expr",
"=",
"statement",
"instanceof",
"ReturnStatement",
"?",
"(",
"(",
"ReturnStatement",
")",
"statement",
")",
".",
"getExpression",
"(",
")",
":",
"(",
"(",
"ExpressionStatement",
")",
"statement",
")",
".",
"getExpression",
"(",
")",
";",
"IASTFragment",
"fragment",
"=",
"new",
"ASTFragmentFactory",
"(",
")",
".",
"createFragment",
"(",
"expr",
")",
";",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"return",
"fragment",
";",
"}",
"private",
"IASTFragment",
"createFragmentFromText",
"(",
"String",
"contents",
",",
"int",
"start",
",",
"int",
"end",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"getCompilationUnitFor",
"(",
"contents",
")",
";",
"return",
"new",
"ASTFragmentFactory",
"(",
")",
".",
"createFragment",
"(",
"(",
"(",
"ReturnStatement",
")",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getExpression",
"(",
")",
",",
"start",
",",
"end",
")",
";",
"}",
"}",
"</s>"
] |
6,024 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"public",
"class",
"CodeSelectGenericsTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectGenericsTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectGenericsTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE1050a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"make\"",
";",
"String",
"elementName",
"=",
"\"make\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE1050b",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"\"",
";",
"String",
"elementName",
"=",
"\"\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericField1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"field\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericField2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"field\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericField3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"field\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericMethod1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericMethod2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericMethod3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericMethod4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericMethod5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericType1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"Structure\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndField1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"field\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndField2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"field\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndField3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"field\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndMethod1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndMethod2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndMethod3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndMethod4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectGenericTypeAndMethod5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"method\"",
";",
"assertCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"private",
"static",
"final",
"String",
"XX",
"=",
"\"\"",
";",
"public",
"void",
"testCodeSelectArray1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xx\"",
";",
"String",
"elementName",
"=",
"\"getXx\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"yy\"",
";",
"String",
"elementName",
"=",
"\"getYy\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXx\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getYy\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"setXx\"",
";",
"String",
"elementName",
"=",
"\"xx\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"setYy\"",
";",
"String",
"elementName",
"=",
"\"yy\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXx\"",
";",
"String",
"elementName",
"=",
"\"xx\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"public",
"void",
"testCodeSelectArray8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"groovyContents",
"=",
"\"\"",
"+",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getYy\"",
";",
"String",
"elementName",
"=",
"\"yy\"",
";",
"assertCodeSelect",
"(",
"XX",
",",
"null",
",",
"groovyContents",
",",
"toFind",
",",
"elementName",
")",
";",
"}",
"private",
"static",
"final",
"String",
"GENERICS_CLASS",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"private",
"int",
"find",
"(",
"int",
"toFind",
")",
"{",
"String",
"lookFor",
"=",
"\"/*\"",
"+",
"toFind",
"+",
"\"*/\"",
";",
"int",
"index",
"=",
"GENERICS_CLASS",
".",
"indexOf",
"(",
"lookFor",
")",
";",
"return",
"index",
"<",
"0",
"?",
"index",
":",
"index",
"+",
"lookFor",
".",
"length",
"(",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam0",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"0",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"1",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"SomeClass\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"2",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"3",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"SomeClass\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"4",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"SomeClass\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"5",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"6",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"SomeClass\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"7",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"8",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"SomeClass\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"9",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"10",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"SomeClass\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"11",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"public",
"void",
"testCodeSelectTypeParam12",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
"=",
"\"\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"assertCodeSelect",
"(",
"GENERICS_CLASS",
",",
"new",
"SourceRange",
"(",
"find",
"(",
"12",
")",
",",
"len",
")",
",",
"name",
")",
";",
"}",
"}",
"</s>"
] |
6,025 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"FindAllOccurrencesVisitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"public",
"class",
"FindAllOccurrencesVisitorTests",
"extends",
"AbstractCheckerTests",
"{",
"public",
"FindAllOccurrencesVisitorTests",
"(",
")",
"{",
"super",
"(",
"FindAllOccurrencesVisitorTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
",",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
",",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
",",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
",",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences12",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences13",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO",
"+",
"BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"int",
"second",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
",",
"first",
"+",
"2",
")",
";",
"int",
"third",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
",",
"second",
"+",
"2",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
",",
"second",
",",
"third",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences14",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO.BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"int",
"second",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
",",
"moduleText",
".",
"indexOf",
"(",
"'+'",
")",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
",",
"second",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences15",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO.BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"int",
"second",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
",",
"second",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences16",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO.BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences17",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO.BAZ\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"int",
"second",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
",",
"second",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences18",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"FOO.BAR\"",
";",
"String",
"exprText",
"=",
"\"FOO\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences19",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"FOO.BAR()\"",
";",
"String",
"exprText",
"=",
"\"FOO\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences20",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"FOO.BAR()\"",
";",
"String",
"exprText",
"=",
"\"FOO\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences21",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO.BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences21a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO?.BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
")",
";",
"}",
"public",
"void",
"testFindAllOccurrences22",
"(",
")",
"throws",
"Exception",
"{",
"String",
"moduleText",
"=",
"\"\"",
";",
"String",
"exprText",
"=",
"\"FOO?.BAR\"",
";",
"int",
"first",
"=",
"moduleText",
".",
"indexOf",
"(",
"exprText",
")",
";",
"int",
"second",
"=",
"moduleText",
".",
"lastIndexOf",
"(",
"exprText",
")",
";",
"assertOccurrences",
"(",
"exprText",
",",
"moduleText",
",",
"first",
",",
"second",
")",
";",
"}",
"private",
"void",
"assertOccurrences",
"(",
"String",
"exprToFindText",
",",
"String",
"moduleText",
",",
"int",
"...",
"startLocations",
")",
"throws",
"CoreException",
"{",
"IASTFragment",
"exprToFind",
"=",
"getLastFragment",
"(",
"createModuleFromText",
"(",
"exprToFindText",
")",
")",
";",
"ModuleNode",
"module",
"=",
"createModuleFromText",
"(",
"moduleText",
")",
";",
"FindAllOccurrencesVisitor",
"visitor",
"=",
"new",
"FindAllOccurrencesVisitor",
"(",
"module",
")",
";",
"List",
"<",
"IASTFragment",
">",
"foundExprs",
"=",
"visitor",
".",
"findOccurrences",
"(",
"exprToFind",
")",
";",
"assertEquals",
"(",
"createMsg",
"(",
"foundExprs",
",",
"startLocations",
",",
"exprToFindText",
",",
"moduleText",
")",
",",
"startLocations",
".",
"length",
",",
"foundExprs",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"startLocations",
".",
"length",
";",
"i",
"++",
")",
"{",
"assertEquals",
"(",
"createMsg",
"(",
"foundExprs",
",",
"startLocations",
",",
"exprToFindText",
",",
"moduleText",
")",
",",
"foundExprs",
".",
"get",
"(",
"i",
")",
".",
"getStart",
"(",
")",
",",
"startLocations",
"[",
"i",
"]",
")",
";",
"}",
"}",
"private",
"String",
"createMsg",
"(",
"List",
"<",
"IASTFragment",
">",
"foundExprs",
",",
"int",
"[",
"]",
"startLocations",
",",
"String",
"exprToFindText",
",",
"String",
"moduleText",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"moduleText",
"+",
"\"\"",
"+",
"exprToFindText",
"+",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"startLocations",
")",
"+",
"\"\"",
"+",
"getStarts",
"(",
"foundExprs",
")",
"+",
"\"",
"]\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"private",
"String",
"getStarts",
"(",
"List",
"<",
"IASTFragment",
">",
"foundExprs",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"IASTFragment",
"foundExpr",
":",
"foundExprs",
")",
"{",
"sb",
".",
"append",
"(",
"foundExpr",
".",
"getStart",
"(",
")",
")",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"sb",
".",
"replace",
"(",
"sb",
".",
"length",
"(",
")",
"-",
"2",
",",
"sb",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,026 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"public",
"class",
"AllBrowsingTests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"\"\"",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectMethodsTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectFieldsTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectTypesTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectCategoriesTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectGenericsTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"FindSurroundingNodeTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"FindAllOccurrencesVisitorTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ASTFragmentTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"IsSameExpressionTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"PartialVisitTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectFieldsPropertiesTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectLocalTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CodeSelectStaticImportsTest",
".",
"class",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
6,027 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"CodeSelectHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"CodeSelectRequestor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"Region",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
";",
"public",
"class",
"PartialVisitTest",
"extends",
"BrowsingTestCase",
"{",
"private",
"class",
"PartialCodeSelectRequestor",
"extends",
"CodeSelectRequestor",
"{",
"Set",
"<",
"String",
">",
"skippedElements",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"public",
"PartialCodeSelectRequestor",
"(",
"ASTNode",
"nodeToLookFor",
",",
"GroovyCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"nodeToLookFor",
",",
"unit",
")",
";",
"}",
"@",
"Override",
"public",
"VisitStatus",
"acceptASTNode",
"(",
"ASTNode",
"node",
",",
"TypeLookupResult",
"result",
",",
"IJavaElement",
"enclosingElement",
")",
"{",
"VisitStatus",
"status",
"=",
"super",
".",
"acceptASTNode",
"(",
"node",
",",
"result",
",",
"enclosingElement",
")",
";",
"if",
"(",
"status",
"==",
"VisitStatus",
".",
"CANCEL_MEMBER",
")",
"{",
"if",
"(",
"skippedElements",
".",
"contains",
"(",
"enclosingElement",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"enclosingElement",
")",
";",
"}",
"skippedElements",
".",
"add",
"(",
"enclosingElement",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"return",
"status",
";",
"}",
"}",
"class",
"PartialCodeSelectHelper",
"extends",
"CodeSelectHelper",
"{",
"Set",
"<",
"String",
">",
"skippedElements",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"@",
"Override",
"protected",
"CodeSelectRequestor",
"createRequestor",
"(",
"GroovyCompilationUnit",
"unit",
",",
"ASTNode",
"nodeToLookFor",
")",
"{",
"PartialCodeSelectRequestor",
"partialCodeSelectRequestor",
"=",
"new",
"PartialCodeSelectRequestor",
"(",
"nodeToLookFor",
",",
"unit",
")",
";",
"skippedElements",
"=",
"partialCodeSelectRequestor",
".",
"skippedElements",
";",
"return",
"partialCodeSelectRequestor",
";",
"}",
"@",
"Override",
"public",
"IJavaElement",
"[",
"]",
"select",
"(",
"GroovyCompilationUnit",
"unit",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"helper",
".",
"skippedElements",
".",
"clear",
"(",
")",
";",
"return",
"super",
".",
"select",
"(",
"unit",
",",
"start",
",",
"length",
")",
";",
"}",
"@",
"Override",
"public",
"ASTNode",
"selectASTNode",
"(",
"GroovyCompilationUnit",
"unit",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"helper",
".",
"skippedElements",
".",
"clear",
"(",
")",
";",
"return",
"super",
".",
"selectASTNode",
"(",
"unit",
",",
"start",
",",
"length",
")",
";",
"}",
"}",
"PartialCodeSelectHelper",
"helper",
"=",
"new",
"PartialCodeSelectHelper",
"(",
")",
";",
"public",
"PartialVisitTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testSimple",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"indexOf",
"(",
"contents",
",",
"\"x\"",
")",
",",
"\"x\"",
",",
"\"Hello\"",
",",
"\"main\"",
")",
";",
"}",
"public",
"void",
"testSimple2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"lastIndexOf",
"(",
"contents",
",",
"\"x\"",
")",
",",
"\"x\"",
",",
"\"Hello\"",
",",
"\"main\"",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testSimple3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"lastIndexOf",
"(",
"contents",
",",
"\"x\"",
")",
",",
"\"x\"",
",",
"\"x\"",
")",
";",
"}",
"public",
"void",
"testFieldInitializer",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"lastIndexOf",
"(",
"contents",
",",
"\"y\"",
")",
",",
"\"y\"",
",",
"\"Foo\"",
",",
"\"y\"",
")",
";",
"}",
"public",
"void",
"testStaticFieldInitializer",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"lastIndexOf",
"(",
"contents",
",",
"\"y\"",
")",
",",
"\"y\"",
",",
"\"Foo\"",
",",
"\"z\"",
",",
"\"y\"",
")",
";",
"}",
"public",
"void",
"testInnerClass",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"lastIndexOf",
"(",
"contents",
",",
"\"y\"",
")",
",",
"\"y\"",
",",
"\"Foo\"",
",",
"\"x\"",
",",
"\"y\"",
",",
"\"z\"",
",",
"\"blog\"",
")",
";",
"}",
"public",
"void",
"testInnerClass2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertCodeSelectWithSkippedNames",
"(",
"contents",
",",
"lastIndexOf",
"(",
"contents",
",",
"\"y\"",
")",
",",
"\"y\"",
",",
"\"Foo\"",
",",
"\"x\"",
",",
"\"y\"",
",",
"\"z\"",
",",
"\"Inner\"",
")",
";",
"}",
"private",
"Region",
"indexOf",
"(",
"String",
"contents",
",",
"String",
"string",
")",
"{",
"return",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"string",
")",
",",
"string",
".",
"length",
"(",
")",
")",
";",
"}",
"private",
"Region",
"lastIndexOf",
"(",
"String",
"contents",
",",
"String",
"string",
")",
"{",
"return",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"string",
")",
",",
"string",
".",
"length",
"(",
")",
")",
";",
"}",
"private",
"void",
"assertCodeSelectWithSkippedNames",
"(",
"String",
"contents",
",",
"Region",
"region",
",",
"String",
"expectedElementName",
",",
"String",
"...",
"skippedElementNames",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"helper",
".",
"select",
"(",
"unit",
",",
"region",
".",
"getOffset",
"(",
")",
",",
"region",
".",
"getLength",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"elt",
")",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"expectedElementName",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"for",
"(",
"String",
"skipped",
":",
"skippedElementNames",
")",
"{",
"assertTrue",
"(",
"\"Element",
"\"",
"+",
"skipped",
"+",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"skippedElementNames",
")",
"+",
"\"nWas:",
"\"",
"+",
"helper",
".",
"skippedElements",
",",
"helper",
".",
"skippedElements",
".",
"contains",
"(",
"skipped",
")",
")",
";",
"}",
"assertEquals",
"(",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"skippedElementNames",
")",
"+",
"\"nWas:",
"\"",
"+",
"helper",
".",
"skippedElements",
",",
"skippedElementNames",
".",
"length",
",",
"helper",
".",
"skippedElements",
".",
"size",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,028 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"Region",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"FindSurroundingNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"public",
"class",
"FindSurroundingNodeTests",
"extends",
"BrowsingTestCase",
"{",
"public",
"FindSurroundingNodeTests",
"(",
")",
"{",
"super",
"(",
"FindSurroundingNodeTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testFindSurrounding1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'C'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'c'",
")",
",",
"\"\"",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'A'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"\"\"",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"x\"",
")",
",",
"\"x\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"def",
"x\"",
")",
",",
"\"def",
"x\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"{",
"def",
"xn}\"",
")",
",",
"\"{",
"def",
"xn}\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
",",
"\"\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
",",
"\"\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"x\"",
")",
",",
"\"x\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"def",
"x\"",
")",
",",
"\"def",
"x\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"{",
"n",
"def",
"xn",
"}\"",
")",
",",
"\"{",
"n",
"def",
"xn",
"}\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"_testFindSurrounding5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"foo()",
".foo()\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'f'",
")",
",",
"1",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"foo()",
"\"",
")",
",",
"\"foo()",
"\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding5a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"foo()",
".foo()\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'f'",
")",
",",
"1",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo()\"",
")",
",",
"\"foo()\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'f'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"foo.bar\"",
")",
",",
"\"foo.bar\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"'7'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"7\"",
")",
",",
"\"7\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"7",
"+",
"9\"",
")",
",",
"\"7",
"+",
"9\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
",",
"\"\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
",",
"\"\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding8a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"foo()++\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'f'",
")",
",",
"1",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo()\"",
")",
",",
"\"foo()\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding8b",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"++foo()\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'f'",
")",
",",
"1",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo()\"",
")",
",",
"\"foo()\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding8c",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"!foo()\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'f'",
")",
",",
"1",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"\"foo\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"foo()\"",
")",
",",
"\"foo()\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding9a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"1..9\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'9'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"9\"",
")",
",",
"\"9\"",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding9b",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"1..9\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'1'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"1\"",
")",
",",
"\"1\"",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"_testFindSurrounding10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"x",
"=",
"a",
"?:",
"b\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'a'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"a\"",
")",
",",
"\"a\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"a",
"?:",
"b\"",
")",
",",
"\"a",
"?:",
"b\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"_testFindSurrounding10a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'a'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"a\"",
")",
",",
"\"a\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"a",
"?",
"b1",
":",
"b\"",
")",
",",
"\"a",
"?",
"b1:",
"b\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"public",
"void",
"testFindSurrounding11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"x",
"=",
"[a",
":",
"b]\"",
";",
"Region",
"initialRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'a'",
")",
",",
"0",
")",
";",
"Region",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"a\"",
")",
",",
"\"a\"",
".",
"length",
"(",
")",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"a",
":",
"b\"",
")",
",",
"\"a",
":",
"b\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"[a",
":",
"b]\"",
")",
",",
"\"[a",
":",
"b]\"",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"initialRegion",
"=",
"expectedRegion",
";",
"expectedRegion",
"=",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"unit",
"=",
"checkRegion",
"(",
"contents",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"private",
"GroovyCompilationUnit",
"checkRegion",
"(",
"String",
"contents",
",",
"Region",
"initialRegion",
",",
"Region",
"expectedRegion",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"getCompilationUnitFor",
"(",
"contents",
")",
";",
"return",
"checkRegion",
"(",
"contents",
",",
"unit",
",",
"initialRegion",
",",
"expectedRegion",
")",
";",
"}",
"private",
"GroovyCompilationUnit",
"checkRegion",
"(",
"String",
"contents",
",",
"GroovyCompilationUnit",
"unit",
",",
"Region",
"initialRegion",
",",
"Region",
"expectedRegion",
")",
"{",
"FindSurroundingNode",
"finder",
"=",
"new",
"FindSurroundingNode",
"(",
"initialRegion",
")",
";",
"IASTFragment",
"result",
"=",
"finder",
".",
"doVisitSurroundingNode",
"(",
"unit",
".",
"getModuleNode",
"(",
")",
")",
";",
"Region",
"actualRegion",
"=",
"new",
"Region",
"(",
"result",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"getRegionText",
"(",
"expectedRegion",
",",
"contents",
")",
"+",
"\"|n\"",
"+",
"\"\"",
"+",
"getRegionText",
"(",
"actualRegion",
",",
"contents",
")",
"+",
"\"|n\"",
",",
"expectedRegion",
",",
"actualRegion",
")",
";",
"return",
"unit",
";",
"}",
"private",
"String",
"getRegionText",
"(",
"Region",
"region",
",",
"String",
"sourceString",
")",
"{",
"return",
"sourceString",
".",
"substring",
"(",
"region",
".",
"getOffset",
"(",
")",
",",
"region",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,029 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"CodeSelectCategoriesTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectCategoriesTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectCategoriesTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testDGM",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"each\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"each\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testGroovyCategory",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"MyCategory\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"\"doNothing\"",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"doNothing\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,030 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"tests",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"public",
"class",
"CodeSelectMethodsTest",
"extends",
"BrowsingTestCase",
"{",
"public",
"CodeSelectMethodsTest",
"(",
")",
"{",
"super",
"(",
"CodeSelectMethodsTest",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"public",
"void",
"testCodeSelectDefaultParams1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"meth\"",
";",
"assertGroovyCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectDefaultParams2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"meth\"",
";",
"assertGroovyCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectDefaultParams3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"meth\"",
";",
"assertGroovyCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectDefaultParams4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"structureContents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"javaContents",
"=",
"\"\"",
";",
"String",
"groovyContents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"meth\"",
";",
"assertGroovyCodeSelect",
"(",
"structureContents",
",",
"javaContents",
",",
"groovyContents",
",",
"toFind",
")",
";",
"}",
"public",
"void",
"testCodeSelectClosure",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"x(\\\"hello\\\")n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectInt",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"9n\"",
"+",
"\"x++n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectReAssign",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"x(\\\"hello\\\")n\"",
"+",
"\"x",
"=",
"9n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectMethodInClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"redirect\"",
")",
",",
"\"redirect\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"redirect\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectMethodInOtherClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"\"redirect\"",
")",
",",
"\"redirect\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"redirect\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectMethodInSuperClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"\"redirect\"",
")",
",",
"\"redirect\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"redirect\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectMethodInScriptFromScript",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"def",
"x()",
"{",
"}n\"",
"+",
"\"x()n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectMethodInClassFromScript",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethodFromClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethodFromScript",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"x\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethodInOtherClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"\"redirect\"",
")",
",",
"\"redirect\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"redirect\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethodInOtherClass2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"class",
"C",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"r(List)n\"",
"+",
"\"}\"",
"+",
"\"}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"List\"",
")",
",",
"\"List\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"List\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethodInSuperClass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}n\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"String",
"contents2",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello2\"",
",",
"contents2",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents2",
".",
"lastIndexOf",
"(",
"\"redirect\"",
")",
",",
"\"redirect\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"redirect\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticInScript",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Hello\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Hello.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"doSomething\"",
")",
",",
"\"doSomething\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"doSomething\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethod1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"p()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Child\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Child.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"p\"",
")",
",",
"\"p\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Parent\"",
",",
"elt",
"[",
"0",
"]",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticMethod2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Parent\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"p()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Child\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Child.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"p\"",
")",
",",
"\"p\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Parent\"",
",",
"elt",
"[",
"0",
"]",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticProperty1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}",
"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Super.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"sql\"",
")",
",",
"\"sql\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"getSql\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticProperty2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}",
"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Super.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"sql\"",
")",
",",
"\"sql\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"getSql\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectStaticProperty3",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}",
"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Super.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"sql\"",
")",
",",
"\"sql\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"getSql\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCodeSelectOverloadedMethod1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Super.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"substring\"",
")",
",",
"\"substring\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"substring\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"(",
"(",
"IMethod",
")",
"elt",
"[",
"0",
"]",
")",
".",
"getParameterTypes",
"(",
")",
".",
"length",
")",
";",
"}",
"public",
"void",
"testCodeSelectOverloadedMethod2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Super\"",
",",
"contents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
"root",
",",
"\"Super.groovy\"",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"IJavaElement",
"[",
"]",
"elt",
"=",
"unit",
".",
"codeSelect",
"(",
"contents",
".",
"indexOf",
"(",
"\"substring\"",
")",
",",
"\"substring\"",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"elt",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"substring\"",
",",
"elt",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"2",
",",
"(",
"(",
"IMethod",
")",
"elt",
"[",
"0",
"]",
")",
".",
"getParameterTypes",
"(",
")",
".",
"length",
")",
";",
"}",
"}",
"</s>"
] |
6,031 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"AbstractGroovyCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"AssignStatementToNewLocalProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"ConvertToClosureCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"ConvertToMethodCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"ConvertToMultiLineStringCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"ConvertToSingleLineStringCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"RemoveUnnecessarySemicolonsCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"SplitAssigmentCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickassist",
".",
"SwapOperandsCompletionProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"correction",
".",
"AssistContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IInvocationContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"public",
"class",
"QuickAssistTests",
"extends",
"EclipseTestCase",
"{",
"public",
"void",
"testConvertToClosure1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"def",
"x()",
"{",
"}\"",
",",
"\"def",
"x",
"=",
"{",
"}\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure2",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure3",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure4",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure5",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure6",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure7",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure8",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure9",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure10",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToClosure11",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToClosureCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod3",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod4",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod5",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod6",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod7",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod8",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod9",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod10",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMethod11",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"x\"",
",",
"ConvertToMethodCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMultiLine1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"f\"",
",",
"ConvertToMultiLineStringCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToMultiLine2",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"f\"",
",",
"ConvertToMultiLineStringCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToSingleLine1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"f\"",
",",
"ConvertToSingleLineStringCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testConvertToSingleLine2",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"\"f\"",
",",
"ConvertToSingleLineStringCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testRemoveUnnecessarySemicolons1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"original",
"=",
"\"def",
"a",
"=",
"1;\"",
";",
"assertConversion",
"(",
"original",
",",
"\"def",
"a",
"=",
"1\"",
",",
"original",
",",
"RemoveUnnecessarySemicolonsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testRemoveUnnecessarySemicolons2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"original",
"=",
"\"\"",
";",
"String",
"expected",
"=",
"\"\"",
";",
"assertConversion",
"(",
"original",
",",
"expected",
",",
"null",
",",
"RemoveUnnecessarySemicolonsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"7",
",",
"1",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands2",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"13",
",",
"1",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands3",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"7",
",",
"1",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands4",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"7",
",",
"1",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands5",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"25",
",",
"1",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands6",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
",",
"12",
",",
"1",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands7",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"v",
"&&",
"g",
"&&",
"a\"",
",",
"\"g",
"&&",
"v",
"&&",
"a\"",
",",
"\"&&\"",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSwapOperands8",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"g",
"||",
"a",
"&&",
"v\"",
",",
"\"g",
"||",
"v",
"&&",
"a\"",
",",
"\"&&\"",
",",
"SwapOperandsCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"def",
"foon\"",
"+",
"\"foo",
"=",
"1",
"+",
"4\"",
",",
"\"=\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment2",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"def",
"foon\"",
"+",
"\"foo",
"=",
"1",
"+",
"4\"",
",",
"\"\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment3",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"String",
"foon\"",
"+",
"\"\"",
",",
"\"=\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment4",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"def",
"foon\"",
"+",
"\"\"",
",",
"\"\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment5",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"def",
"foon\"",
"+",
"\"\"",
",",
"\"=\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment6",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
"+",
"\"foo",
"=",
"1",
"+",
"4\"",
",",
"\"=\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment7",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"\"",
"+",
"\"foo",
"=",
"1",
"+",
"4\"",
",",
"\"\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment7a",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
",",
"\"def",
"zn\"",
"+",
"\"z",
"=",
"b",
"=",
"8\"",
",",
"\"\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSplitAssignment8",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"ttdef",
"barn\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
",",
"\"\"",
",",
"SplitAssigmentCompletionProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring1",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"new",
"Point\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring2",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"bar(5)n\"",
"+",
"\"}}\"",
",",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"bar(5)\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring3",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"2",
"+",
"2n\"",
"+",
"\"}}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"2",
"+",
"2\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring4",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"falsen\"",
"+",
"\"}}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"false\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring5",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"falsen\"",
"+",
"\"}}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"falsen\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring6",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"2n\"",
"+",
"\"}}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"2\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring7",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"a",
"==",
"2n\"",
"+",
"\"}}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"a",
"==",
"2\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAssignStatementToLocalRefactoring8",
"(",
")",
"throws",
"Exception",
"{",
"assertConversion",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"[1,",
"2]n\"",
"+",
"\"}}\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}}\"",
",",
"\"[1,",
"2]\"",
",",
"AssignStatementToNewLocalProposal",
".",
"class",
")",
";",
"}",
"private",
"void",
"assertConversion",
"(",
"String",
"original",
",",
"String",
"expected",
",",
"String",
"searchFor",
",",
"Class",
"<",
"?",
"extends",
"AbstractGroovyCompletionProposal",
">",
"proposalClass",
")",
"throws",
"Exception",
",",
"SecurityException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"int",
"start",
"=",
"searchFor",
"==",
"null",
"?",
"0",
":",
"original",
".",
"indexOf",
"(",
"searchFor",
")",
";",
"int",
"length",
"=",
"searchFor",
"==",
"null",
"?",
"0",
":",
"searchFor",
".",
"length",
"(",
")",
";",
"assertConversion",
"(",
"original",
",",
"expected",
",",
"start",
",",
"length",
",",
"proposalClass",
")",
";",
"}",
"private",
"void",
"assertConversion",
"(",
"String",
"original",
",",
"String",
"expected",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Class",
"<",
"?",
"extends",
"AbstractGroovyCompletionProposal",
">",
"proposalClass",
")",
"throws",
"Exception",
",",
"SecurityException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"ICompilationUnit",
"unit",
"=",
"testProject",
".",
"createUnit",
"(",
"\"\"",
",",
"\"\"",
",",
"original",
")",
";",
"IInvocationContext",
"context",
"=",
"new",
"AssistContext",
"(",
"unit",
",",
"offset",
",",
"length",
")",
";",
"AbstractGroovyCompletionProposal",
"proposal",
"=",
"proposalClass",
".",
"getConstructor",
"(",
"IInvocationContext",
".",
"class",
")",
".",
"newInstance",
"(",
"context",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"proposal",
".",
"getDisplayString",
"(",
")",
"+",
"\"'\"",
",",
"proposal",
".",
"hasProposals",
"(",
")",
")",
";",
"IDocument",
"document",
"=",
"new",
"Document",
"(",
"String",
".",
"valueOf",
"(",
"(",
"(",
"CompilationUnit",
")",
"unit",
")",
".",
"getContents",
"(",
")",
")",
")",
";",
"proposal",
".",
"apply",
"(",
"document",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"expected",
",",
"document",
".",
"get",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,032 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"plugin",
".",
"AbstractUIPlugin",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"BundleContext",
";",
"public",
"class",
"GroovyQuickFixPlugin",
"extends",
"AbstractUIPlugin",
"{",
"public",
"static",
"final",
"String",
"PLUGIN_ID",
"=",
"\"\"",
";",
"private",
"static",
"GroovyQuickFixPlugin",
"plugin",
";",
"public",
"GroovyQuickFixPlugin",
"(",
")",
"{",
"}",
"public",
"void",
"start",
"(",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"super",
".",
"start",
"(",
"context",
")",
";",
"plugin",
"=",
"this",
";",
"}",
"public",
"void",
"stop",
"(",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"plugin",
"=",
"null",
";",
"super",
".",
"stop",
"(",
"context",
")",
";",
"}",
"public",
"static",
"GroovyQuickFixPlugin",
"getDefault",
"(",
")",
"{",
"return",
"plugin",
";",
"}",
"}",
"</s>"
] |
6,033 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"AddMissingGroovyImportsResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"ConvertToGroovyFileResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"IQuickFixResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"ProblemType",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaCompletionProposal",
";",
"public",
"class",
"GroovyProjectJavaQuickFixTest",
"extends",
"GroovyProjectQuickFixHarness",
"{",
"public",
"void",
"testNoGroovyAddImportQuickFix",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"TestJavaC\"",
";",
"String",
"typeToImport",
"=",
"\"ImageBuilder\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createJavaTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".java\"",
",",
"typeToAddImportContent",
")",
";",
"AddMissingGroovyImportsResolver",
"resolver",
"=",
"getAddMissingImportsResolver",
"(",
"typeToImport",
",",
"unit",
")",
";",
"assertNull",
"(",
"\"\"",
"+",
"typeToImport",
"+",
"\"",
"in",
"\"",
"+",
"unit",
".",
"getResource",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"resolver",
")",
";",
"}",
"public",
"void",
"testConverToGroovyQuickFixMissingSemiColon",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"TestJavaC\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createJavaTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".java\"",
",",
"typeToAddImportContent",
")",
";",
"ConvertToGroovyFileResolver",
"resolver",
"=",
"getConvertToGroovyQuickFixResolver",
"(",
"unit",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"resolver",
")",
";",
"String",
"expectedDisplayString",
"=",
"\"\"",
";",
"List",
"<",
"IJavaCompletionProposal",
">",
"proposals",
"=",
"resolver",
".",
"getQuickFixProposals",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"proposals",
"!=",
"null",
"&&",
"proposals",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"IJavaCompletionProposal",
"firstProposal",
"=",
"proposals",
".",
"get",
"(",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"expectedDisplayString",
",",
"firstProposal",
".",
"getDisplayString",
"(",
")",
")",
";",
"}",
"public",
"void",
"testConverToGroovyQuickFixMissingSemiColonVariant",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"TestJavaC\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createJavaTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".java\"",
",",
"typeToAddImportContent",
")",
";",
"ConvertToGroovyFileResolver",
"resolver",
"=",
"getConvertToGroovyQuickFixResolver",
"(",
"unit",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"resolver",
")",
";",
"String",
"expectedDisplayString",
"=",
"\"\"",
";",
"List",
"<",
"IJavaCompletionProposal",
">",
"proposals",
"=",
"resolver",
".",
"getQuickFixProposals",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"proposals",
"!=",
"null",
"&&",
"proposals",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"IJavaCompletionProposal",
"firstProposal",
"=",
"proposals",
".",
"get",
"(",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"expectedDisplayString",
",",
"firstProposal",
".",
"getDisplayString",
"(",
")",
")",
";",
"}",
"protected",
"ConvertToGroovyFileResolver",
"getConvertToGroovyQuickFixResolver",
"(",
"ICompilationUnit",
"unit",
")",
"throws",
"Exception",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"getCompilationUnitJDTFailureMarkers",
"(",
"unit",
")",
";",
"List",
"<",
"IQuickFixResolver",
">",
"resolvers",
"=",
"getAllQuickFixResolversForType",
"(",
"markers",
",",
"ProblemType",
".",
"MISSING_SEMI_COLON_TYPE",
",",
"unit",
")",
";",
"assertNotNull",
"(",
"resolvers",
")",
";",
"assertTrue",
"(",
"resolvers",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"for",
"(",
"IQuickFixResolver",
"resolver",
":",
"resolvers",
")",
"{",
"if",
"(",
"resolver",
"instanceof",
"ConvertToGroovyFileResolver",
")",
"{",
"return",
"(",
"ConvertToGroovyFileResolver",
")",
"resolver",
";",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,034 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"processors",
".",
"GroovyQuickFixProcessor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"AddMissingGroovyImportsResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"AddMissingGroovyImportsResolver",
".",
"AddMissingImportProposal",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"GroovyQuickFixResolverRegistry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"IQuickFixResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"ProblemDescriptor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"ProblemType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"QuickFixProblemContext",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"GroovyProjectTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"correction",
".",
"AssistContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaCompletionProposal",
";",
"public",
"class",
"GroovyProjectQuickFixHarness",
"extends",
"GroovyProjectTestCase",
"{",
"protected",
"void",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"String",
"typeToImportSimple",
",",
"String",
"typeToImportFullyQualified",
",",
"String",
"expectedQuickFixDisplay",
",",
"String",
"typeToAddImport",
",",
"String",
"typeToAddImportContent",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"unit",
"=",
"createGroovyTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".groovy\"",
",",
"typeToAddImportContent",
")",
";",
"AddMissingGroovyImportsResolver",
"resolver",
"=",
"getAddMissingImportsResolver",
"(",
"typeToImportSimple",
",",
"unit",
")",
";",
"assertNotNull",
"(",
"\"\"",
"+",
"typeToImportSimple",
",",
"resolver",
")",
";",
"AddMissingImportProposal",
"proposal",
"=",
"getAddMissingImportsProposal",
"(",
"expectedQuickFixDisplay",
",",
"resolver",
")",
";",
"assertNotNull",
"(",
"\"\"",
"+",
"typeToImportSimple",
",",
"proposal",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"expectedQuickFixDisplay",
",",
"expectedQuickFixDisplay",
",",
"proposal",
".",
"getDisplayString",
"(",
")",
")",
";",
"IType",
"proposedJavaType",
"=",
"proposal",
".",
"getSuggestedJavaType",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"typeToImportFullyQualified",
",",
"getDotForm",
"(",
"proposedJavaType",
".",
"getFullyQualifiedName",
"(",
")",
")",
",",
"typeToImportFullyQualified",
")",
";",
"}",
"protected",
"void",
"testMultipleProposalsSameTypeName",
"(",
"String",
"typeToImportSimple",
",",
"Map",
"<",
"String",
",",
"String",
">",
"expectedQuickFixes",
",",
"String",
"typeToAddImport",
",",
"String",
"typeToAddImportContent",
")",
"throws",
"Exception",
"{",
"assertTrue",
"(",
"\"\"",
",",
"expectedQuickFixes",
"!=",
"null",
"&&",
"expectedQuickFixes",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".groovy\"",
",",
"typeToAddImportContent",
")",
";",
"AddMissingGroovyImportsResolver",
"resolver",
"=",
"getAddMissingImportsResolver",
"(",
"typeToImportSimple",
",",
"unit",
")",
";",
"assertNotNull",
"(",
"\"\"",
"+",
"typeToImportSimple",
",",
"resolver",
")",
";",
"List",
"<",
"IJavaCompletionProposal",
">",
"proposals",
"=",
"resolver",
".",
"getQuickFixProposals",
"(",
")",
";",
"Map",
"<",
"String",
",",
"IJavaCompletionProposal",
">",
"proposalsMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"IJavaCompletionProposal",
">",
"(",
")",
";",
"for",
"(",
"IJavaCompletionProposal",
"proposal",
":",
"proposals",
")",
"{",
"proposalsMap",
".",
"put",
"(",
"proposal",
".",
"getDisplayString",
"(",
")",
",",
"proposal",
")",
";",
"}",
"assertEquals",
"(",
"\"\"",
",",
"proposalsMap",
".",
"size",
"(",
")",
",",
"expectedQuickFixes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"expectedQuickFixes",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"expectedDisplay",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"expectedFullyQualifiedName",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"IJavaCompletionProposal",
"actualProposal",
"=",
"proposalsMap",
".",
"get",
"(",
"expectedDisplay",
")",
";",
"assertNotNull",
"(",
"\"\"",
"+",
"expectedFullyQualifiedName",
",",
"actualProposal",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"expectedDisplay",
",",
"expectedDisplay",
",",
"actualProposal",
".",
"getDisplayString",
"(",
")",
")",
";",
"String",
"actualFullyQualifiedType",
"=",
"(",
"(",
"AddMissingImportProposal",
")",
"actualProposal",
")",
".",
"getSuggestedJavaType",
"(",
")",
".",
"getFullyQualifiedName",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"expectedFullyQualifiedName",
",",
"expectedFullyQualifiedName",
",",
"getDotForm",
"(",
"actualFullyQualifiedType",
")",
")",
";",
"}",
"}",
"protected",
"String",
"getDotForm",
"(",
"String",
"fullyQualifiedName",
")",
"{",
"return",
"fullyQualifiedName",
".",
"replace",
"(",
"'$'",
",",
"'.'",
")",
";",
"}",
"protected",
"List",
"<",
"IQuickFixResolver",
">",
"getAllQuickFixResolversForType",
"(",
"IMarker",
"[",
"]",
"markers",
",",
"ProblemType",
"type",
",",
"ICompilationUnit",
"unit",
")",
"throws",
"Exception",
"{",
"if",
"(",
"markers",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"IQuickFixResolver",
">",
"totalResolvers",
"=",
"new",
"ArrayList",
"<",
"IQuickFixResolver",
">",
"(",
")",
";",
"for",
"(",
"IMarker",
"marker",
":",
"markers",
")",
"{",
"QuickFixProblemContext",
"context",
"=",
"getSimpleProblemContext",
"(",
"marker",
",",
"unit",
",",
"type",
")",
";",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"List",
"<",
"IQuickFixResolver",
">",
"resolvers",
"=",
"new",
"GroovyQuickFixResolverRegistry",
"(",
"context",
")",
".",
"getQuickFixResolvers",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"context",
".",
"getProblemDescriptor",
"(",
")",
".",
"getMarkerMessages",
"(",
")",
"[",
"0",
"]",
",",
"resolvers",
"!=",
"null",
"&&",
"resolvers",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"totalResolvers",
".",
"addAll",
"(",
"resolvers",
")",
";",
"}",
"}",
"return",
"!",
"totalResolvers",
".",
"isEmpty",
"(",
")",
"?",
"totalResolvers",
":",
"null",
";",
"}",
"protected",
"IJavaCompletionProposal",
"getCompletionProposal",
"(",
"String",
"quickFixDisplay",
",",
"IQuickFixResolver",
"resolver",
")",
"{",
"List",
"<",
"IJavaCompletionProposal",
">",
"proposals",
"=",
"resolver",
".",
"getQuickFixProposals",
"(",
")",
";",
"if",
"(",
"proposals",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"IJavaCompletionProposal",
"proposal",
":",
"proposals",
")",
"{",
"if",
"(",
"proposal",
".",
"getDisplayString",
"(",
")",
".",
"equals",
"(",
"quickFixDisplay",
")",
")",
"{",
"return",
"proposal",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"AddMissingImportProposal",
"getAddMissingImportsProposal",
"(",
"String",
"quickFixDisplay",
",",
"IQuickFixResolver",
"resolver",
")",
"{",
"IJavaCompletionProposal",
"proposal",
"=",
"getCompletionProposal",
"(",
"quickFixDisplay",
",",
"resolver",
")",
";",
"if",
"(",
"proposal",
"instanceof",
"AddMissingImportProposal",
")",
"{",
"return",
"(",
"AddMissingImportProposal",
")",
"proposal",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"QuickFixProblemContext",
"getSimpleProblemContext",
"(",
"IMarker",
"marker",
",",
"ICompilationUnit",
"unit",
",",
"ProblemType",
"problemType",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"marker",
".",
"getResource",
"(",
")",
".",
"equals",
"(",
"unit",
".",
"getResource",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"(",
"(",
"Integer",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"SEVERITY",
")",
")",
".",
"intValue",
"(",
")",
"==",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"{",
"String",
"[",
"]",
"markerMessages",
"=",
"getMarkerMessages",
"(",
"marker",
")",
";",
"int",
"problemID",
"=",
"(",
"(",
"Integer",
")",
"marker",
".",
"getAttribute",
"(",
"\"id\"",
")",
")",
".",
"intValue",
"(",
")",
";",
"ProblemDescriptor",
"descriptor",
"=",
"new",
"GroovyQuickFixProcessor",
"(",
")",
".",
"getProblemDescriptor",
"(",
"problemID",
",",
"marker",
".",
"getType",
"(",
")",
",",
"markerMessages",
")",
";",
"if",
"(",
"descriptor",
"!=",
"null",
"&&",
"descriptor",
".",
"getType",
"(",
")",
"==",
"problemType",
")",
"{",
"int",
"offset",
"=",
"(",
"(",
"Integer",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"CHAR_START",
")",
")",
";",
"int",
"length",
"=",
"(",
"(",
"Integer",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"CHAR_END",
")",
")",
";",
"return",
"new",
"QuickFixProblemContext",
"(",
"descriptor",
",",
"new",
"AssistContext",
"(",
"unit",
",",
"offset",
",",
"length",
")",
",",
"null",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"AddMissingGroovyImportsResolver",
"getAddMissingImportsResolver",
"(",
"String",
"unresolvedSimpleName",
",",
"ICompilationUnit",
"unit",
")",
"throws",
"Exception",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"getCompilationUnitJDTFailureMarkers",
"(",
"unit",
")",
";",
"List",
"<",
"IQuickFixResolver",
">",
"resolvers",
"=",
"getAllQuickFixResolversForType",
"(",
"markers",
",",
"ProblemType",
".",
"MISSING_IMPORTS_TYPE",
",",
"unit",
")",
";",
"if",
"(",
"resolvers",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"IQuickFixResolver",
"resolver",
":",
"resolvers",
")",
"{",
"if",
"(",
"resolver",
"instanceof",
"AddMissingGroovyImportsResolver",
")",
"{",
"AddMissingGroovyImportsResolver",
"importResolver",
"=",
"(",
"AddMissingGroovyImportsResolver",
")",
"resolver",
";",
"List",
"<",
"IJavaCompletionProposal",
">",
"proposals",
"=",
"importResolver",
".",
"getQuickFixProposals",
"(",
")",
";",
"if",
"(",
"proposals",
"!=",
"null",
")",
"{",
"for",
"(",
"IJavaCompletionProposal",
"proposal",
":",
"proposals",
")",
"{",
"if",
"(",
"proposal",
"instanceof",
"AddMissingImportProposal",
")",
"{",
"AddMissingImportProposal",
"importProposal",
"=",
"(",
"AddMissingImportProposal",
")",
"proposal",
";",
"if",
"(",
"importProposal",
".",
"getSuggestedJavaType",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"unresolvedSimpleName",
")",
")",
"{",
"return",
"importResolver",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"ProblemType",
"[",
"]",
"getGroovyProblemTypes",
"(",
")",
"{",
"return",
"ProblemType",
".",
"values",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,035 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"AddGroovyRuntimeResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"AddMissingGroovyImportsResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"IQuickFixResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"ProblemType",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IncrementalProjectBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"public",
"class",
"GroovyProjectGroovyQuickFixTest",
"extends",
"GroovyProjectQuickFixHarness",
"{",
"private",
"static",
"final",
"String",
"SUBTEST",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"SUBSUBTEST",
"=",
"\"\"",
";",
"private",
"ICompilationUnit",
"topLevelUnit",
";",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"init",
"(",
")",
";",
"}",
"protected",
"void",
"init",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"subtestPackFrag",
"=",
"testProject",
".",
"createPackage",
"(",
"SUBTEST",
")",
";",
"assertNotNull",
"(",
"subtestPackFrag",
")",
";",
"String",
"topLeveLContent",
"=",
"\"\"",
";",
"createGroovyType",
"(",
"subtestPackFrag",
",",
"\"\"",
",",
"topLeveLContent",
")",
";",
"subtestPackFrag",
"=",
"testProject",
".",
"createPackage",
"(",
"SUBSUBTEST",
")",
";",
"assertNotNull",
"(",
"subtestPackFrag",
")",
";",
"topLevelUnit",
"=",
"createGroovyType",
"(",
"subtestPackFrag",
",",
"\"\"",
",",
"topLeveLContent",
")",
";",
"}",
"public",
"void",
"testAddImportField",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"BarField\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testBasicAddImportInnerType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"InnerType\"",
";",
"String",
"innerFullyQualified",
"=",
"\"\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"innerFullyQualified",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testBasicAddImportInnerType2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"typeToImportFullyQualified",
"=",
"\"\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"typeToImportFullyQualified",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testBasicAddImportInnerInnerType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"\"",
";",
"String",
"typeToImportFullyQualified",
"=",
"\"\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"typeToImportFullyQualified",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportReturnType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportMethodParameter",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportGeneric",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"BarGeneric\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportSubclassing",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportLocalVariable",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportMultipleLocations",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportMultipleUnresolved",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"expectedQuickFixDisplay",
"=",
"\"\"",
";",
"String",
"fullQualifiedTypeToImport",
"=",
"\"\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"testSelectImportGroovyTypeFromNewPackage",
"(",
"typeToImport",
",",
"fullQualifiedTypeToImport",
",",
"expectedQuickFixDisplay",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportMultipleProposalsForSameType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToImport",
"=",
"\"TopLevelType\"",
";",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"Map",
"<",
"String",
",",
"String",
">",
"expectedQuickFixes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"expectedQuickFixes",
".",
"put",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"expectedQuickFixes",
".",
"put",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"testMultipleProposalsSameTypeName",
"(",
"typeToImport",
",",
"expectedQuickFixes",
",",
"typeToAddImport",
",",
"typeToAddImportContent",
")",
";",
"}",
"public",
"void",
"testAddImportNoProposals",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"nonExistantType",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".groovy\"",
",",
"typeToAddImportContent",
")",
";",
"AddMissingGroovyImportsResolver",
"resolver",
"=",
"getAddMissingImportsResolver",
"(",
"nonExistantType",
",",
"unit",
")",
";",
"assertNull",
"(",
"\"\"",
"+",
"nonExistantType",
",",
"resolver",
")",
";",
"}",
"public",
"void",
"testAddGroovyRuntime",
"(",
")",
"throws",
"Exception",
"{",
"GroovyRuntime",
".",
"removeGroovyClasspathContainer",
"(",
"testProject",
".",
"getJavaProject",
"(",
")",
")",
";",
"testProject",
".",
"getProject",
"(",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"testProject",
".",
"getProblems",
"(",
")",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"getCompilationUnitJDTFailureMarkers",
"(",
"topLevelUnit",
")",
";",
"List",
"<",
"IQuickFixResolver",
">",
"resolvers",
"=",
"getAllQuickFixResolversForType",
"(",
"markers",
",",
"ProblemType",
".",
"MISSING_CLASSPATH_CONTAINER_TYPE",
",",
"topLevelUnit",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"resolvers",
".",
"size",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"AddGroovyRuntimeResolver",
".",
"class",
",",
"resolvers",
".",
"get",
"(",
"0",
")",
".",
"getClass",
"(",
")",
")",
";",
"resolvers",
".",
"get",
"(",
"0",
")",
".",
"getQuickFixProposals",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"apply",
"(",
"null",
")",
";",
"testProject",
".",
"getProject",
"(",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"assertNull",
"(",
"\"\"",
",",
"testProject",
".",
"getProblems",
"(",
")",
")",
";",
"}",
"public",
"void",
"testUnrecognisedErrorNoProposals",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".groovy\"",
",",
"typeToAddImportContent",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"getCompilationUnitJDTFailureMarkers",
"(",
"unit",
")",
";",
"ProblemType",
"[",
"]",
"knownProblemTypes",
"=",
"getGroovyProblemTypes",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"knownProblemTypes",
"!=",
"null",
"&&",
"knownProblemTypes",
".",
"length",
">",
"0",
")",
";",
"for",
"(",
"ProblemType",
"type",
":",
"getGroovyProblemTypes",
"(",
")",
")",
"{",
"List",
"<",
"IQuickFixResolver",
">",
"resolvers",
"=",
"getAllQuickFixResolversForType",
"(",
"markers",
",",
"type",
",",
"unit",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"resolvers",
"==",
"null",
"||",
"resolvers",
".",
"isEmpty",
"(",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,036 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"AddMissingGroovyImportsResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"IQuickFixResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
".",
"ProblemType",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"public",
"class",
"NonGroovyProjectQuickFixTest",
"extends",
"GroovyProjectQuickFixHarness",
"{",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"removeGroovyNature",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"public",
"void",
"testIsNonGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"assertFalse",
"(",
"\"\"",
",",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
")",
";",
"}",
"public",
"void",
"testNoGroovyAddImportQuickFix",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"TestJavaC\"",
";",
"String",
"typeToImport",
"=",
"\"ImageBuilder\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createJavaTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".java\"",
",",
"typeToAddImportContent",
")",
";",
"AddMissingGroovyImportsResolver",
"resolver",
"=",
"getAddMissingImportsResolver",
"(",
"typeToImport",
",",
"unit",
")",
";",
"assertNull",
"(",
"\"\"",
"+",
"typeToImport",
"+",
"\"",
"in",
"\"",
"+",
"unit",
".",
"getResource",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"resolver",
")",
";",
"}",
"public",
"void",
"testNoGroovyQuickFixNonGroovyProject1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"TestGroovyC\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".groovy\"",
",",
"typeToAddImportContent",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"getCompilationUnitJDTFailureMarkers",
"(",
"unit",
")",
";",
"ProblemType",
"[",
"]",
"knownProblemTypes",
"=",
"getGroovyProblemTypes",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"knownProblemTypes",
"!=",
"null",
"&&",
"knownProblemTypes",
".",
"length",
">",
"0",
")",
";",
"for",
"(",
"ProblemType",
"type",
":",
"getGroovyProblemTypes",
"(",
")",
")",
"{",
"List",
"<",
"IQuickFixResolver",
">",
"resolvers",
"=",
"getAllQuickFixResolversForType",
"(",
"markers",
",",
"type",
",",
"unit",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"resolvers",
"==",
"null",
"||",
"resolvers",
".",
"isEmpty",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"testNoGroovyQuickFixNonGroovyProject2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"typeToAddImport",
"=",
"\"TestGroovyC\"",
";",
"String",
"unresolvedType",
"=",
"\"ImageBuilder\"",
";",
"String",
"typeToAddImportContent",
"=",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyTypeInTestPackage",
"(",
"typeToAddImport",
"+",
"\".groovy\"",
",",
"typeToAddImportContent",
")",
";",
"AddMissingGroovyImportsResolver",
"resolver",
"=",
"getAddMissingImportsResolver",
"(",
"unresolvedType",
",",
"unit",
")",
";",
"assertNull",
"(",
"\"\"",
",",
"resolver",
")",
";",
"}",
"}",
"</s>"
] |
6,037 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"public",
"class",
"GroovyProjectTestCase",
"extends",
"EclipseTestCase",
"{",
"public",
"static",
"final",
"String",
"PACKAGE",
"=",
"\"com.test\"",
";",
"private",
"IPackageFragment",
"packageFrag",
";",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"packageFrag",
"=",
"testProject",
".",
"createPackage",
"(",
"PACKAGE",
")",
";",
"}",
"protected",
"ICompilationUnit",
"createGroovyTypeInTestPackage",
"(",
"String",
"fileName",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"return",
"createGroovyType",
"(",
"packageFrag",
",",
"fileName",
",",
"contents",
")",
";",
"}",
"protected",
"ICompilationUnit",
"createGroovyType",
"(",
"IPackageFragment",
"pack",
",",
"String",
"fileName",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyType",
"(",
"pack",
",",
"fileName",
",",
"contents",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"waitForIndexes",
"(",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"return",
"unit",
";",
"}",
"protected",
"ICompilationUnit",
"createJavaTypeInTestPackage",
"(",
"String",
"fileName",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"unit",
"=",
"testProject",
".",
"createJavaType",
"(",
"packageFrag",
",",
"fileName",
",",
"contents",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"waitForIndexes",
"(",
")",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"unit",
".",
"getResource",
"(",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"return",
"unit",
";",
"}",
"protected",
"IProject",
"getTestProject",
"(",
")",
"{",
"return",
"testProject",
".",
"getProject",
"(",
")",
";",
"}",
"protected",
"IPackageFragment",
"getTestPackage",
"(",
")",
"{",
"return",
"packageFrag",
";",
"}",
"protected",
"IMarker",
"[",
"]",
"getProjectJDTFailureMarkers",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"getTestProject",
"(",
")",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"protected",
"String",
"[",
"]",
"getMarkerMessages",
"(",
"IMarker",
"marker",
")",
"throws",
"Exception",
"{",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"return",
"new",
"String",
"[",
"]",
"{",
"message",
"}",
";",
"}",
"protected",
"IMarker",
"[",
"]",
"getCompilationUnitJDTFailureMarkers",
"(",
"ICompilationUnit",
"unit",
")",
"throws",
"Exception",
"{",
"return",
"unit",
".",
"getResource",
"(",
")",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"}",
"</s>"
] |
6,038 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
".",
"GroovyProjectGroovyQuickFixTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
".",
"GroovyProjectJavaQuickFixTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"test",
".",
"resolvers",
".",
"NonGroovyProjectQuickFixTest",
";",
"public",
"class",
"AllQuickFixTests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"final",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"AllQuickFixTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyProjectGroovyQuickFixTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyProjectJavaQuickFixTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"NonGroovyProjectQuickFixTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"QuickAssistTests",
".",
"class",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
6,039 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"DEPRECATED",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"FIELD",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"REGEX",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"METHOD",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"STATIC_METHOD",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"STATIC_FIELD",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"UNKNOWN",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
".",
"NUMBER",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"GatherSemanticReferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"public",
"class",
"SemanticHighlightingTests",
"extends",
"EclipseTestCase",
"{",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"testProject",
".",
"addNature",
"(",
"GroovyNature",
".",
"GROOVY_NATURE",
")",
";",
"testProject",
".",
"createJavaTypeAndPackage",
"(",
"\"other\"",
",",
"\"Java.java\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticFieldRanges",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"FOO\"",
")",
",",
"\"FOO\"",
".",
"length",
"(",
")",
",",
"STATIC_FIELD",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"x\"",
")",
",",
"\"x\"",
".",
"length",
"(",
")",
",",
"METHOD",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
",",
"\"FOO\"",
".",
"length",
"(",
")",
",",
"STATIC_FIELD",
")",
")",
";",
"}",
"public",
"void",
"testStaticMethodRanges",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"FOO\"",
")",
",",
"\"FOO\"",
".",
"length",
"(",
")",
",",
"STATIC_METHOD",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
",",
"\"FOO\"",
".",
"length",
"(",
")",
",",
"STATIC_METHOD",
")",
")",
";",
"}",
"public",
"void",
"testRegex",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"/fdsfasdfas/\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"/fdsfasdfas/\"",
")",
",",
"\"/fdsfasdfas/\"",
".",
"length",
"(",
")",
",",
"REGEX",
")",
")",
";",
"}",
"public",
"void",
"testUnknown",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"unknown\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"unknown\"",
")",
",",
"\"unknown\"",
".",
"length",
"(",
")",
",",
"UNKNOWN",
")",
")",
";",
"}",
"public",
"void",
"testDeprecated",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"Java\"",
")",
",",
"\"Java\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"Java\"",
")",
",",
"\"Java\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"CONST\"",
")",
",",
"\"CONST\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
")",
";",
"}",
"public",
"void",
"testDeprecated2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"FOO\"",
")",
",",
"\"FOO\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
",",
"\"FOO\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
",",
"\"x\"",
".",
"length",
"(",
")",
",",
"FIELD",
")",
")",
";",
"}",
"public",
"void",
"testDeprecated3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"x\"",
")",
",",
"\"x\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
",",
"\"y\"",
".",
"length",
"(",
")",
",",
"METHOD",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
",",
"\"x\"",
".",
"length",
"(",
")",
",",
"DEPRECATED",
")",
")",
";",
"}",
"public",
"void",
"testNumberWithSuffix",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"11\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1I\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1i\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1L\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1l\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1G\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1g\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1D\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1d\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1F\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"contents",
"=",
"\"1f\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"}",
"public",
"void",
"testOctal",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"01\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"}",
"public",
"void",
"testHex",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"0x1fff\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"}",
"public",
"void",
"testExponent",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"1.23e-23\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"}",
"public",
"void",
"testDecimal",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"8881.23\"",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
")",
";",
"}",
"public",
"void",
"testMultipleStaticMethods",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"f(1,2)n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"int",
"first",
"=",
"contents",
".",
"indexOf",
"(",
"\"f\"",
")",
";",
"int",
"second",
"=",
"contents",
".",
"indexOf",
"(",
"\"f\"",
",",
"first",
"+",
"1",
")",
";",
"int",
"third",
"=",
"contents",
".",
"indexOf",
"(",
"\"f\"",
",",
"second",
"+",
"1",
")",
";",
"assertHighlighting",
"(",
"contents",
",",
"new",
"HighlightedTypedPosition",
"(",
"first",
",",
"\"f\"",
".",
"length",
"(",
")",
",",
"STATIC_METHOD",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"1\"",
")",
",",
"\"1\"",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"contents",
".",
"indexOf",
"(",
"\"2\"",
")",
",",
"\"2\"",
".",
"length",
"(",
")",
",",
"NUMBER",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"second",
",",
"\"f\"",
".",
"length",
"(",
")",
",",
"STATIC_METHOD",
")",
",",
"new",
"HighlightedTypedPosition",
"(",
"third",
",",
"\"f\"",
".",
"length",
"(",
")",
",",
"STATIC_METHOD",
")",
")",
";",
"}",
"private",
"void",
"assertHighlighting",
"(",
"String",
"contents",
",",
"HighlightedTypedPosition",
"...",
"expectedPositions",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"openFile",
"(",
"contents",
")",
";",
"checkStyles",
"(",
"unit",
",",
"expectedPositions",
")",
";",
"}",
"private",
"GroovyCompilationUnit",
"openFile",
"(",
"String",
"contents",
")",
"throws",
"CoreException",
",",
"PartInitException",
"{",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"\"",
",",
"\"\"",
",",
"contents",
")",
";",
"return",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"create",
"(",
"file",
")",
";",
"}",
"private",
"void",
"checkStyles",
"(",
"GroovyCompilationUnit",
"unit",
",",
"HighlightedTypedPosition",
"[",
"]",
"expectedPositions",
")",
"{",
"GatherSemanticReferences",
"references",
"=",
"new",
"GatherSemanticReferences",
"(",
"unit",
")",
";",
"HighlightedTypedPosition",
"[",
"]",
"actualPositions",
"=",
"(",
"HighlightedTypedPosition",
"[",
"]",
")",
"references",
".",
"findSemanticHighlightingReferences",
"(",
")",
".",
"toArray",
"(",
"new",
"HighlightedTypedPosition",
"[",
"0",
"]",
")",
";",
"Arrays",
".",
"sort",
"(",
"actualPositions",
",",
"new",
"Comparator",
"<",
"HighlightedTypedPosition",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"HighlightedTypedPosition",
"h1",
",",
"HighlightedTypedPosition",
"h2",
")",
"{",
"if",
"(",
"h1",
".",
"offset",
"==",
"h2",
".",
"offset",
")",
"{",
"return",
"h1",
".",
"kind",
".",
"ordinal",
"(",
")",
"-",
"h2",
".",
"kind",
".",
"ordinal",
"(",
")",
";",
"}",
"return",
"h1",
".",
"offset",
"-",
"h2",
".",
"offset",
";",
"}",
"}",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"expectedPositions",
")",
"+",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"actualPositions",
")",
",",
"expectedPositions",
".",
"length",
",",
"actualPositions",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actualPositions",
".",
"length",
";",
"i",
"++",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"expectedPositions",
")",
"+",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"actualPositions",
")",
",",
"expectedPositions",
"[",
"i",
"]",
",",
"actualPositions",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,040 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"GroovyOutlinePage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"IOJavaElement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"IOutlineExtender",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OField",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OMethod",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OType",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"public",
"class",
"OutlineExtender1",
"implements",
"IOutlineExtender",
",",
"IProjectNature",
"{",
"public",
"static",
"final",
"String",
"NATURE",
"=",
"\"\"",
";",
"public",
"void",
"configure",
"(",
")",
"throws",
"CoreException",
"{",
"}",
"public",
"void",
"deconfigure",
"(",
")",
"throws",
"CoreException",
"{",
"}",
"IProject",
"p",
";",
"public",
"IProject",
"getProject",
"(",
")",
"{",
"return",
"p",
";",
"}",
"public",
"void",
"setProject",
"(",
"IProject",
"project",
")",
"{",
"this",
".",
"p",
"=",
"project",
";",
"}",
"public",
"GroovyOutlinePage",
"getGroovyOutlinePageForEditor",
"(",
"String",
"contextMenuID",
",",
"GroovyEditor",
"editor",
")",
"{",
"TCompilationUnit",
"ounit",
"=",
"new",
"TCompilationUnit",
"(",
"this",
",",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
")",
";",
"return",
"new",
"TGroovyOutlinePage",
"(",
"null",
",",
"editor",
",",
"ounit",
")",
";",
"}",
"public",
"boolean",
"appliesTo",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"new",
"String",
"(",
"unit",
".",
"getFileName",
"(",
")",
")",
".",
"contains",
"(",
"\"X\"",
")",
";",
"}",
"public",
"static",
"class",
"TGroovyOutlinePage",
"extends",
"GroovyOutlinePage",
"{",
"public",
"TGroovyOutlinePage",
"(",
"String",
"contextMenuID",
",",
"GroovyEditor",
"editor",
",",
"OCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"contextMenuID",
",",
"editor",
",",
"unit",
")",
";",
"}",
"public",
"JavaOutlineViewer",
"getViewer",
"(",
")",
"{",
"return",
"getOutlineViewer",
"(",
")",
";",
"}",
"}",
"public",
"static",
"class",
"TCompilationUnit",
"extends",
"OCompilationUnit",
"{",
"public",
"OutlineExtender1",
"outlineExtender",
";",
"public",
"TType",
"type",
";",
"public",
"TCompilationUnit",
"(",
"OutlineExtender1",
"outlineExtender",
",",
"GroovyCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"unit",
")",
";",
"this",
".",
"outlineExtender",
"=",
"outlineExtender",
";",
"}",
"@",
"Override",
"public",
"IMember",
"[",
"]",
"refreshChildren",
"(",
")",
"{",
"type",
"=",
"new",
"TType",
"(",
"this",
",",
"getElementName",
"(",
")",
")",
";",
"return",
"new",
"IMember",
"[",
"]",
"{",
"type",
"}",
";",
"}",
"@",
"Override",
"public",
"IMember",
"getOutlineElementAt",
"(",
"int",
"caretOffset",
")",
"{",
"return",
"type",
";",
"}",
"}",
"public",
"static",
"class",
"TType",
"extends",
"OType",
"{",
"public",
"TType",
"(",
"IOJavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
",",
"new",
"ConstantExpression",
"(",
"name",
")",
",",
"name",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"@",
"Override",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"return",
"getNode",
"(",
")",
";",
"}",
"public",
"TType",
"addTestType",
"(",
"String",
"name",
")",
"{",
"TType",
"t",
"=",
"new",
"TType",
"(",
"this",
",",
"name",
")",
";",
"addChild",
"(",
"t",
")",
";",
"return",
"t",
";",
"}",
"public",
"TMethod",
"addTestMethod",
"(",
"String",
"name",
",",
"String",
"returnType",
")",
"{",
"TMethod",
"m",
"=",
"new",
"TMethod",
"(",
"this",
",",
"name",
",",
"returnType",
")",
";",
"addChild",
"(",
"m",
")",
";",
"return",
"m",
";",
"}",
"public",
"TField",
"addTestField",
"(",
"String",
"name",
",",
"String",
"typeSignature",
")",
"{",
"TField",
"f",
"=",
"new",
"TField",
"(",
"this",
",",
"name",
",",
"typeSignature",
")",
";",
"addChild",
"(",
"f",
")",
";",
"return",
"f",
";",
"}",
"}",
"public",
"static",
"class",
"TMethod",
"extends",
"OMethod",
"{",
"private",
"String",
"returnType",
";",
"public",
"TMethod",
"(",
"OType",
"parent",
",",
"String",
"name",
",",
"String",
"returnType",
")",
"{",
"super",
"(",
"parent",
",",
"new",
"ConstantExpression",
"(",
"name",
")",
",",
"name",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"returnType",
"=",
"returnType",
";",
"}",
"@",
"Override",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"return",
"getNode",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getReturnTypeName",
"(",
")",
"{",
"return",
"returnType",
";",
"}",
"}",
"public",
"static",
"class",
"TField",
"extends",
"OField",
"{",
"private",
"String",
"typeSignature",
";",
"public",
"TField",
"(",
"OType",
"parent",
",",
"String",
"name",
",",
"String",
"typeSignature",
")",
"{",
"super",
"(",
"parent",
",",
"new",
"ConstantExpression",
"(",
"name",
")",
",",
"name",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"typeSignature",
"=",
"typeSignature",
";",
"}",
"@",
"Override",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"return",
"getNode",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getTypeSignature",
"(",
")",
"{",
"return",
"typeSignature",
";",
"}",
"}",
"}",
"</s>"
] |
6,041 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyPartitionScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IToken",
";",
"public",
"class",
"GroovyPartitionScannerTests",
"extends",
"TestCase",
"{",
"GroovyPartitionScanner",
"scanner",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"super",
".",
"setUp",
"(",
")",
";",
"scanner",
"=",
"new",
"GroovyPartitionScanner",
"(",
")",
";",
"}",
"public",
"void",
"testSingleQuotes",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"''''''\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testSingleQuotes2",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"'''n'''\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testSingleQuotes3",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testDoubleQuotes",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"\\\"\\\"\\\"\\\"\\\"\\\"\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testDoubleQuotes2",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"\\\"\\\"\\\"n\\\"\\\"\\\"\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testDoubleQuotes3",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testDollarSlash1",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"$/",
"/$\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testDollarSlash2",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"$/n/$\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testDollarSlash3",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"\"",
",",
"0",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"public",
"void",
"testNone",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"\\\"n\\\"\\\"\\\"\"",
",",
"0",
",",
"IJavaPartitions",
".",
"JAVA_STRING",
")",
";",
"}",
"public",
"void",
"testNone2",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"''n'''\"",
",",
"0",
",",
"IJavaPartitions",
".",
"JAVA_STRING",
")",
";",
"}",
"public",
"void",
"testComment",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"/*",
"blahn\"",
"+",
"\"",
"*",
"blahn\"",
"+",
"\"",
"*/\"",
",",
"0",
",",
"IJavaPartitions",
".",
"JAVA_MULTI_LINE_COMMENT",
")",
";",
"}",
"public",
"void",
"testJavaDoc",
"(",
")",
"throws",
"Exception",
"{",
"tryString",
"(",
"\"/**",
"blahn\"",
"+",
"\"",
"*",
"blahn\"",
"+",
"\"",
"*/\"",
",",
"0",
",",
"IJavaPartitions",
".",
"JAVA_DOC",
")",
";",
"}",
"private",
"void",
"tryString",
"(",
"String",
"string",
",",
"int",
"start",
",",
"String",
"expectedContentType",
")",
"{",
"IDocument",
"doc",
"=",
"new",
"Document",
"(",
"string",
")",
";",
"scanner",
".",
"setRange",
"(",
"doc",
",",
"start",
",",
"string",
".",
"length",
"(",
")",
")",
";",
"IToken",
"token",
"=",
"scanner",
".",
"nextToken",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"string",
"+",
"\"'\"",
",",
"expectedContentType",
",",
"token",
".",
"getData",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,042 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyTagScanner",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyTextTools",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
".",
"PreferenceInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IColorManager",
";",
"public",
"class",
"GroovyTagScannerTests",
"extends",
"TestCase",
"{",
"GroovyTagScanner",
"scanner",
";",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"super",
".",
"setUp",
"(",
")",
";",
"new",
"PreferenceInitializer",
"(",
")",
".",
"initializeDefaultPreferences",
"(",
")",
";",
"GroovyTextTools",
"textTools",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getTextTools",
"(",
")",
";",
"IColorManager",
"colorManager",
"=",
"textTools",
".",
"getColorManager",
"(",
")",
";",
"scanner",
"=",
"new",
"GroovyTagScanner",
"(",
"colorManager",
")",
";",
"}",
"public",
"void",
"testNoColor",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGJDKColor",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testJavaTypeColor",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testJavaKeywordColor",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStringColor",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
6,043 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"IHighlightingExtender",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IWordDetector",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"WordRule",
";",
"public",
"class",
"Extender2",
"implements",
"IHighlightingExtender",
",",
"IProjectNature",
"{",
"public",
"static",
"final",
"String",
"NATURE2",
"=",
"\"\"",
";",
"public",
"static",
"final",
"IRule",
"RULE",
"=",
"new",
"WordRule",
"(",
"new",
"IWordDetector",
"(",
")",
"{",
"public",
"boolean",
"isWordStart",
"(",
"char",
"c",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isWordPart",
"(",
"char",
"c",
")",
"{",
"return",
"false",
";",
"}",
"}",
")",
";",
"public",
"List",
"<",
"String",
">",
"getAdditionalGJDKKeywords",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getAdditionalGroovyKeywords",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"List",
"<",
"IRule",
">",
"getAdditionalRules",
"(",
")",
"{",
"return",
"Arrays",
".",
"asList",
"(",
"RULE",
")",
";",
"}",
"public",
"void",
"configure",
"(",
")",
"throws",
"CoreException",
"{",
"}",
"public",
"void",
"deconfigure",
"(",
")",
"throws",
"CoreException",
"{",
"}",
"IProject",
"p",
";",
"public",
"IProject",
"getProject",
"(",
")",
"{",
"return",
"p",
";",
"}",
"public",
"void",
"setProject",
"(",
"IProject",
"project",
")",
"{",
"this",
".",
"p",
"=",
"project",
";",
"}",
"}",
"</s>"
] |
6,044 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"EditorUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyledText",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"dnd",
".",
"Clipboard",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"dnd",
".",
"TextTransfer",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"dnd",
".",
"Transfer",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Event",
";",
"public",
"abstract",
"class",
"GroovyEditorTest",
"extends",
"EclipseTestCase",
"{",
"protected",
"static",
"final",
"String",
"CARET",
"=",
"\"<***>\"",
";",
"protected",
"GroovyEditor",
"editor",
";",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"GroovyPlugin",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
".",
"closeAllEditors",
"(",
"false",
")",
";",
"editor",
"=",
"null",
";",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"protected",
"void",
"makeEditor",
"(",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"int",
"cursor",
"=",
"0",
";",
"if",
"(",
"contents",
".",
"contains",
"(",
"CARET",
")",
")",
"{",
"cursor",
"=",
"contents",
".",
"indexOf",
"(",
"CARET",
")",
";",
"contents",
"=",
"contents",
".",
"replace",
"(",
"CARET",
",",
"\"\"",
")",
";",
"}",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"\"",
",",
"\"Test.groovy\"",
",",
"contents",
")",
";",
"editor",
"=",
"(",
"GroovyEditor",
")",
"EditorUtility",
".",
"openInEditor",
"(",
"file",
")",
";",
"editor",
".",
"setHighlightRange",
"(",
"cursor",
",",
"0",
",",
"true",
")",
";",
"editor",
".",
"setFocus",
"(",
")",
";",
"}",
"protected",
"void",
"send",
"(",
"String",
"text",
")",
"{",
"for",
"(",
"char",
"c",
":",
"text",
".",
"toCharArray",
"(",
")",
")",
"{",
"send",
"(",
"c",
")",
";",
"}",
"}",
"protected",
"void",
"send",
"(",
"char",
"c",
")",
"{",
"Event",
"e",
"=",
"new",
"Event",
"(",
")",
";",
"e",
".",
"character",
"=",
"c",
";",
"e",
".",
"doit",
"=",
"true",
";",
"e",
".",
"widget",
"=",
"editor",
".",
"getViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
";",
"e",
".",
"widget",
".",
"notifyListeners",
"(",
"SWT",
".",
"KeyDown",
",",
"e",
")",
";",
"}",
"protected",
"void",
"sendBackTab",
"(",
")",
"{",
"Event",
"e",
"=",
"new",
"Event",
"(",
")",
";",
"e",
".",
"character",
"=",
"'\\t'",
";",
"e",
".",
"stateMask",
"=",
"SWT",
".",
"SHIFT",
";",
"e",
".",
"doit",
"=",
"true",
";",
"e",
".",
"widget",
"=",
"editor",
".",
"getViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
";",
"e",
".",
"widget",
".",
"notifyListeners",
"(",
"SWT",
".",
"KeyDown",
",",
"e",
")",
";",
"}",
"protected",
"void",
"sendPaste",
"(",
"String",
"pasted",
")",
"{",
"StyledText",
"widget",
"=",
"editor",
".",
"getViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
";",
"Clipboard",
"clipboard",
"=",
"new",
"Clipboard",
"(",
"editor",
".",
"getViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
".",
"getDisplay",
"(",
")",
")",
";",
"TextTransfer",
"plainTextTransfer",
"=",
"TextTransfer",
".",
"getInstance",
"(",
")",
";",
"clipboard",
".",
"setContents",
"(",
"new",
"Object",
"[",
"]",
"{",
"pasted",
"}",
",",
"new",
"Transfer",
"[",
"]",
"{",
"plainTextTransfer",
"}",
")",
";",
"widget",
".",
"paste",
"(",
")",
";",
"clipboard",
".",
"dispose",
"(",
")",
";",
"}",
"protected",
"String",
"getText",
"(",
")",
"{",
"return",
"getDocument",
"(",
")",
".",
"get",
"(",
")",
";",
"}",
"protected",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"editor",
".",
"getViewer",
"(",
")",
".",
"getDocument",
"(",
")",
";",
"}",
"protected",
"void",
"assertEditorContents",
"(",
"String",
"expected",
")",
"{",
"String",
"actual",
"=",
"getText",
"(",
")",
";",
"if",
"(",
"expected",
".",
"contains",
"(",
"CARET",
")",
")",
"{",
"int",
"cursor",
"=",
"getCaret",
"(",
")",
";",
"actual",
"=",
"actual",
".",
"substring",
"(",
"0",
",",
"cursor",
")",
"+",
"CARET",
"+",
"actual",
".",
"substring",
"(",
"cursor",
")",
";",
"}",
"assertEquals",
"(",
"expected",
",",
"actual",
")",
";",
"}",
"private",
"int",
"getCaret",
"(",
")",
"{",
"return",
"editor",
".",
"getCaretOffset",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,045 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightingExtenderRegistry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IRule",
";",
"public",
"class",
"HighlightingExtenderTests",
"extends",
"EclipseTestCase",
"{",
"private",
"HighlightingExtenderRegistry",
"registry",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"registry",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getTextTools",
"(",
")",
".",
"getHighlightingExtenderRegistry",
"(",
")",
";",
"registry",
".",
"initialize",
"(",
")",
";",
"}",
"public",
"void",
"testHighlightingExtender1",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"Extender1",
".",
"NATURE1",
")",
";",
"testProject",
".",
"addNature",
"(",
"Extender2",
".",
"NATURE2",
")",
";",
"List",
"<",
"IRule",
">",
"extraRules",
"=",
"registry",
".",
"getAdditionalRulesForProject",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"assertEquals",
"(",
"Extender2",
".",
"RULE",
",",
"extraRules",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"public",
"void",
"testHighlightingExtender2",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"Extender1",
".",
"NATURE1",
")",
";",
"testProject",
".",
"addNature",
"(",
"Extender2",
".",
"NATURE2",
")",
";",
"List",
"<",
"String",
">",
"extraKeywords",
"=",
"registry",
".",
"getExtraGJDKKeywordsForProject",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"assertEquals",
"(",
"Extender1",
".",
"GJDK_KEYWORD",
",",
"extraKeywords",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"public",
"void",
"testHighlightingExtender3",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"Extender1",
".",
"NATURE1",
")",
";",
"testProject",
".",
"addNature",
"(",
"Extender2",
".",
"NATURE2",
")",
";",
"List",
"<",
"String",
">",
"extraKeywords",
"=",
"registry",
".",
"getExtraGroovyKeywordsForProject",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"assertEquals",
"(",
"Extender1",
".",
"GROOVY_KEYWORD",
",",
"extraKeywords",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,046 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"EditorUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"VerifyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Event",
";",
"public",
"class",
"BracketInserterTests",
"extends",
"EclipseTestCase",
"{",
"public",
"void",
"testInsertDQuote1",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\"",
",",
"\"\\\"\\\"\"",
",",
"'\\\"'",
",",
"0",
")",
";",
"}",
"public",
"void",
"testInsertDQuote2",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\\\"\"",
",",
"\"\\\"\\\"\"",
",",
"'\\\"'",
",",
"1",
")",
";",
"}",
"public",
"void",
"testInsertDQuote3",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\\\"\\\"\"",
",",
"\"\\\"\\\"\\\"\\\"\\\"\\\"\"",
",",
"'\\\"'",
",",
"2",
")",
";",
"}",
"public",
"void",
"testInsertDQuote4",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\\\"\\\"\\\"\"",
",",
"\"\\\"\\\"\\\"\\\"\\\"\\\"\"",
",",
"'\\\"'",
",",
"3",
")",
";",
"}",
"public",
"void",
"testInsertDQuote5",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"assert",
"\"",
",",
"\"assert",
"\\\"\\\"\"",
",",
"'\\\"'",
",",
"7",
")",
";",
"}",
"public",
"void",
"testInsertDQuote6",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"assert",
"\\\"\"",
",",
"\"assert",
"\\\"\\\"\"",
",",
"'\\\"'",
",",
"8",
")",
";",
"}",
"public",
"void",
"testInsertDQuote7",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"''\"",
",",
"\"'\\\"'\"",
",",
"'\\\"'",
",",
"1",
")",
";",
"}",
"public",
"void",
"testInsertSQuote1",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\"",
",",
"\"''\"",
",",
"'\\''",
",",
"0",
")",
";",
"}",
"public",
"void",
"testInsertSQuote2",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"'\"",
",",
"\"''\"",
",",
"'\\''",
",",
"1",
")",
";",
"}",
"public",
"void",
"testInsertSQuote3",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"''\"",
",",
"\"''''''\"",
",",
"'\\''",
",",
"2",
")",
";",
"}",
"public",
"void",
"testInsertSQuote4",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"'''\"",
",",
"\"''''''\"",
",",
"'\\''",
",",
"3",
")",
";",
"}",
"public",
"void",
"testInsertParen",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\"",
",",
"\"()\"",
",",
"'('",
",",
"0",
")",
";",
"}",
"public",
"void",
"testInsertSquare",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\"",
",",
"\"[]\"",
",",
"'['",
",",
"0",
")",
";",
"}",
"public",
"void",
"testInsertAngle",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\"",
",",
"\"<>\"",
",",
"'<'",
",",
"0",
")",
";",
"}",
"public",
"void",
"testInsertBraces1",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\\\"$\\\"\"",
",",
"\"\\\"${}\\\"\"",
",",
"'{'",
",",
"2",
")",
";",
"}",
"public",
"void",
"testInsertBraces2",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\\\"\\\"\\\"$\\\"\\\"\\\"\"",
",",
"\"\\\"\\\"\\\"${}\\\"\\\"\\\"\"",
",",
"'{'",
",",
"4",
")",
";",
"}",
"public",
"void",
"testInsertBraces3",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"$\"",
",",
"\"${\"",
",",
"'{'",
",",
"1",
")",
";",
"}",
"public",
"void",
"testInsertBraces4",
"(",
")",
"throws",
"Exception",
"{",
"assertClosing",
"(",
"\"\\\"\\\"\\\"n$\\\"\\\"\\\"\"",
",",
"\"\\\"\\\"\\\"n${}\\\"\\\"\\\"\"",
",",
"'{'",
",",
"5",
")",
";",
"}",
"private",
"void",
"assertClosing",
"(",
"String",
"initialDoc",
",",
"String",
"expectedDoc",
",",
"char",
"inserted",
",",
"int",
"location",
")",
"throws",
"Exception",
"{",
"initialDoc",
"+=",
"\"n\"",
";",
"expectedDoc",
"+=",
"\"n",
"\"",
";",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"\"",
",",
"\"\"",
",",
"initialDoc",
"+",
"\"",
"\"",
")",
";",
"GroovyEditor",
"editor",
"=",
"(",
"GroovyEditor",
")",
"EditorUtility",
".",
"openInEditor",
"(",
"file",
")",
";",
"try",
"{",
"Event",
"e",
"=",
"new",
"Event",
"(",
")",
";",
"e",
".",
"character",
"=",
"inserted",
";",
"e",
".",
"doit",
"=",
"true",
";",
"e",
".",
"widget",
"=",
"editor",
".",
"getViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
";",
"VerifyEvent",
"ve",
"=",
"new",
"VerifyEvent",
"(",
"e",
")",
";",
"editor",
".",
"getViewer",
"(",
")",
".",
"setSelectedRange",
"(",
"location",
",",
"0",
")",
";",
"editor",
".",
"getGroovyBracketInserter",
"(",
")",
".",
"verifyKey",
"(",
"ve",
")",
";",
"if",
"(",
"ve",
".",
"doit",
")",
"{",
"editor",
".",
"getViewer",
"(",
")",
".",
"getDocument",
"(",
")",
".",
"replace",
"(",
"location",
",",
"0",
",",
"Character",
".",
"toString",
"(",
"inserted",
")",
")",
";",
"}",
"String",
"actual",
"=",
"editor",
".",
"getViewer",
"(",
")",
".",
"getDocument",
"(",
")",
".",
"get",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"inserted",
"+",
"\"\"",
"+",
"location",
",",
"expectedDoc",
",",
"actual",
")",
";",
"}",
"finally",
"{",
"GroovyPlugin",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
".",
"closeAllEditors",
"(",
"false",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,047 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"ASTNodeFinder",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"Region",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"GroovyOutlinePage",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"public",
"class",
"OutlineExtender2",
"extends",
"OutlineExtender1",
"{",
"public",
"static",
"final",
"String",
"NATURE",
"=",
"\"\"",
";",
"public",
"boolean",
"appliesTo",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"new",
"String",
"(",
"unit",
".",
"getFileName",
"(",
")",
")",
".",
"contains",
"(",
"\"Y\"",
")",
";",
"}",
"public",
"GroovyOutlinePage",
"getGroovyOutlinePageForEditor",
"(",
"String",
"contextMenuID",
",",
"GroovyEditor",
"editor",
")",
"{",
"TCompilationUnit2",
"ounit",
"=",
"new",
"TCompilationUnit2",
"(",
"this",
",",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
")",
";",
"return",
"new",
"TGroovyOutlinePage",
"(",
"null",
",",
"editor",
",",
"ounit",
")",
";",
"}",
"public",
"static",
"class",
"TCompilationUnit2",
"extends",
"TCompilationUnit",
"{",
"public",
"TCompilationUnit2",
"(",
"OutlineExtender2",
"outlineExtender",
",",
"GroovyCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"outlineExtender",
",",
"unit",
")",
";",
"}",
"@",
"Override",
"public",
"IMember",
"[",
"]",
"refreshChildren",
"(",
")",
"{",
"type",
"=",
"new",
"TType",
"(",
"this",
",",
"getElementName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"getElementName",
"(",
")",
".",
"indexOf",
"(",
"'.'",
")",
")",
")",
";",
"ModuleNode",
"moduleNode",
"=",
"(",
"ModuleNode",
")",
"getNode",
"(",
")",
";",
"if",
"(",
"moduleNode",
"!=",
"null",
")",
"{",
"new",
"Finder",
"(",
"moduleNode",
",",
"type",
")",
".",
"execute",
"(",
")",
";",
"}",
"return",
"new",
"IMember",
"[",
"]",
"{",
"type",
"}",
";",
"}",
"@",
"Override",
"public",
"void",
"refresh",
"(",
")",
"{",
"super",
".",
"refresh",
"(",
")",
";",
"}",
"}",
"public",
"static",
"class",
"Finder",
"extends",
"ASTNodeFinder",
"{",
"private",
"ModuleNode",
"moduleNode",
";",
"private",
"Stack",
"<",
"TType",
">",
"methodStack",
"=",
"new",
"Stack",
"<",
"TType",
">",
"(",
")",
";",
"public",
"Finder",
"(",
"ModuleNode",
"moduleNode",
",",
"TType",
"rootType",
")",
"{",
"super",
"(",
"new",
"Region",
"(",
"moduleNode",
")",
")",
";",
"this",
".",
"moduleNode",
"=",
"moduleNode",
";",
"methodStack",
".",
"push",
"(",
"rootType",
")",
";",
"}",
"public",
"void",
"execute",
"(",
")",
"{",
"doVisit",
"(",
"moduleNode",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethodCallExpression",
"(",
"MethodCallExpression",
"methodCall",
")",
"{",
"if",
"(",
"methodCall",
".",
"getLineNumber",
"(",
")",
"<",
"0",
")",
"{",
"super",
".",
"visitMethodCallExpression",
"(",
"methodCall",
")",
";",
"return",
";",
"}",
"TType",
"parentType",
"=",
"methodStack",
".",
"peek",
"(",
")",
";",
"TType",
"t",
"=",
"parentType",
".",
"addTestType",
"(",
"methodCall",
".",
"getMethodAsString",
"(",
")",
")",
";",
"methodStack",
".",
"push",
"(",
"t",
")",
";",
"super",
".",
"visitMethodCallExpression",
"(",
"methodCall",
")",
";",
"methodStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethod",
"(",
"MethodNode",
"method",
")",
"{",
"if",
"(",
"method",
".",
"getLineNumber",
"(",
")",
"<=",
"1",
")",
"{",
"super",
".",
"visitMethod",
"(",
"method",
")",
";",
"return",
";",
"}",
"TType",
"parentType",
"=",
"methodStack",
".",
"peek",
"(",
")",
";",
"parentType",
".",
"addTestMethod",
"(",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getReturnType",
"(",
")",
".",
"getNameWithoutPackage",
"(",
")",
")",
";",
"super",
".",
"visitMethod",
"(",
"method",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitVariableExpression",
"(",
"VariableExpression",
"variable",
")",
"{",
"if",
"(",
"variable",
".",
"getLineNumber",
"(",
")",
"<",
"0",
")",
"{",
"super",
".",
"visitVariableExpression",
"(",
"variable",
")",
";",
"return",
";",
"}",
"TType",
"parentType",
"=",
"methodStack",
".",
"peek",
"(",
")",
";",
"parentType",
".",
"addTestField",
"(",
"variable",
".",
"getName",
"(",
")",
",",
"variable",
".",
"getType",
"(",
")",
".",
"getNameWithoutPackage",
"(",
")",
")",
";",
"super",
".",
"visitVariableExpression",
"(",
"variable",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,048 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"GroovyOutlinePage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"GroovyScriptOutlineExtender",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OField",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OMethod",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OutlineExtenderRegistry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"OutlineExtender1",
".",
"TCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"OutlineExtender1",
".",
"TGroovyOutlinePage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"OutlineExtender1",
".",
"TType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"OutlineExtender2",
".",
"TCompilationUnit2",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"EditorUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaSourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"public",
"class",
"OutlineExtenderTests",
"extends",
"EclipseTestCase",
"{",
"private",
"OutlineExtenderRegistry",
"registry",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyNature",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"registry",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getOutlineTools",
"(",
")",
".",
"getOutlineExtenderRegistry",
"(",
")",
";",
"registry",
".",
"initialize",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
".",
"closeAllEditors",
"(",
"false",
")",
";",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"public",
"void",
"testStandardOutlineIfNoExtender",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"X",
"{",
"}\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"X\"",
",",
"contents",
")",
";",
"assertNull",
"(",
"outline",
")",
";",
"}",
"public",
"void",
"testStandardOutlineIfUnitNotApplyToExtender",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender1",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"class",
"Z",
"{",
"}\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"Z\"",
",",
"contents",
")",
";",
"assertNull",
"(",
"outline",
")",
";",
"}",
"public",
"void",
"testOutlineActivated",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender1",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"class",
"X",
"{",
"}\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"X\"",
",",
"contents",
")",
";",
"assertNotNull",
"(",
"outline",
")",
";",
"}",
"public",
"void",
"testFirstDeclaredWins1",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender1",
".",
"NATURE",
")",
";",
"testProject",
".",
"addNature",
"(",
"OutlineExtender2",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"class",
"XY",
"{",
"}\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"XY\"",
",",
"contents",
")",
";",
"TCompilationUnit",
"tu",
"=",
"(",
"TCompilationUnit",
")",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"assertTrue",
"(",
"tu",
".",
"outlineExtender",
".",
"getClass",
"(",
")",
"==",
"OutlineExtender1",
".",
"class",
")",
";",
"}",
"public",
"void",
"testFirstDeclaredWins2",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender2",
".",
"NATURE",
")",
";",
"testProject",
".",
"addNature",
"(",
"OutlineExtender1",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"class",
"XY",
"{",
"}\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"XY\"",
",",
"contents",
")",
";",
"TCompilationUnit",
"tu",
"=",
"(",
"TCompilationUnit",
")",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"assertTrue",
"(",
"tu",
".",
"outlineExtender",
".",
"getClass",
"(",
")",
"==",
"OutlineExtender2",
".",
"class",
")",
";",
"}",
"public",
"void",
"testOutlineTreeConsistency1",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender2",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"return",
"0",
"n\"",
"+",
"\"}\"",
";",
"TGroovyOutlinePage",
"outline",
"=",
"(",
"TGroovyOutlinePage",
")",
"openFile",
"(",
"\"YTest\"",
",",
"contents",
")",
";",
"TCompilationUnit2",
"tu",
"=",
"(",
"TCompilationUnit2",
")",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"TType",
"tx",
"=",
"(",
"TType",
")",
"tu",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"4",
",",
"tx",
".",
"getChildren",
"(",
")",
".",
"length",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
",",
"\"field1\"",
",",
"\"Integer\"",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"1",
"]",
",",
"\"field2\"",
",",
"\"String\"",
")",
";",
"assertIsMethod",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"2",
"]",
",",
"\"method1\"",
",",
"\"Long\"",
")",
";",
"assertIsMethod",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"3",
"]",
",",
"\"method2\"",
",",
"\"Integer\"",
")",
";",
"}",
"public",
"void",
"testOutlineTreeConsistency2",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender2",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"inline1",
"{",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"YTest\"",
",",
"contents",
")",
";",
"TCompilationUnit2",
"tu",
"=",
"(",
"TCompilationUnit2",
")",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"TType",
"yTest",
"=",
"(",
"TType",
")",
"tu",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"TType",
"inline1",
"=",
"(",
"TType",
")",
"yTest",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"1",
",",
"inline1",
".",
"getChildren",
"(",
")",
".",
"length",
")",
";",
"assertIsType",
"(",
"inline1",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
",",
"\"inline2\"",
")",
";",
"TType",
"inline2",
"=",
"(",
"TType",
")",
"inline1",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"1",
",",
"inline2",
".",
"getChildren",
"(",
")",
".",
"length",
")",
";",
"assertIsField",
"(",
"inline2",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
",",
"\"fieldA\"",
",",
"\"Integer\"",
")",
";",
"}",
"public",
"void",
"testOutlineTreeSynchronized",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender2",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"YTest\"",
",",
"contents",
")",
";",
"TCompilationUnit2",
"tu",
"=",
"(",
"TCompilationUnit2",
")",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"TType",
"tx",
"=",
"(",
"TType",
")",
"tu",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"2",
",",
"tx",
".",
"getChildren",
"(",
")",
".",
"length",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
",",
"\"field1\"",
",",
"\"Integer\"",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"1",
"]",
",",
"\"field2\"",
",",
"\"String\"",
")",
";",
"GroovyEditor",
"editor",
"=",
"getGroovyEditor",
"(",
"tu",
")",
";",
"JavaSourceViewer",
"viewer",
"=",
"(",
"JavaSourceViewer",
")",
"editor",
".",
"getViewer",
"(",
")",
";",
"viewer",
".",
"getTextWidget",
"(",
")",
".",
"setSelection",
"(",
"0",
")",
";",
"viewer",
".",
"getTextWidget",
"(",
")",
".",
"insert",
"(",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"waitForIndexes",
"(",
")",
";",
"tu",
".",
"refresh",
"(",
")",
";",
"tx",
"=",
"(",
"TType",
")",
"tu",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"3",
",",
"tx",
".",
"getChildren",
"(",
")",
".",
"length",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
",",
"\"field3\"",
",",
"\"Long\"",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"1",
"]",
",",
"\"field1\"",
",",
"\"Integer\"",
")",
";",
"assertIsField",
"(",
"tx",
".",
"getChildren",
"(",
")",
"[",
"2",
"]",
",",
"\"field2\"",
",",
"\"String\"",
")",
";",
"editor",
".",
"close",
"(",
"false",
")",
";",
"}",
"public",
"void",
"testUseGroovyScriptOutline",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"OutlineExtender1",
".",
"NATURE",
")",
";",
"String",
"contents",
"=",
"\"int",
"yyy\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"Z\"",
",",
"contents",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testGroovyScriptOutline1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"int[]",
"xxx",
"n\"",
"+",
"\"def",
"ttt",
"=",
"8n\"",
"+",
"\"\"",
"+",
"\"class",
"Y",
"{",
"}n\"",
"+",
"\"\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"Script\"",
",",
"contents",
")",
";",
"OCompilationUnit",
"unit",
"=",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"unit",
".",
"getChildren",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"6",
",",
"children",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"children",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"xxx\"",
",",
"children",
"[",
"1",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"ttt\"",
",",
"children",
"[",
"2",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"hhh\"",
",",
"children",
"[",
"3",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"Y\"",
",",
"children",
"[",
"4",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"blah\"",
",",
"children",
"[",
"5",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"IJavaElement",
".",
"IMPORT_CONTAINER",
",",
"children",
"[",
"0",
"]",
".",
"getElementType",
"(",
")",
")",
";",
"assertEquals",
"(",
"IJavaElement",
".",
"FIELD",
",",
"children",
"[",
"1",
"]",
".",
"getElementType",
"(",
")",
")",
";",
"assertEquals",
"(",
"IJavaElement",
".",
"FIELD",
",",
"children",
"[",
"2",
"]",
".",
"getElementType",
"(",
")",
")",
";",
"assertEquals",
"(",
"IJavaElement",
".",
"FIELD",
",",
"children",
"[",
"3",
"]",
".",
"getElementType",
"(",
")",
")",
";",
"assertEquals",
"(",
"IJavaElement",
".",
"TYPE",
",",
"children",
"[",
"4",
"]",
".",
"getElementType",
"(",
")",
")",
";",
"assertEquals",
"(",
"IJavaElement",
".",
"METHOD",
",",
"children",
"[",
"5",
"]",
".",
"getElementType",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"[I\"",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"1",
"]",
")",
".",
"getTypeSignature",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"Qdef;\"",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"2",
"]",
")",
".",
"getTypeSignature",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"QObject;\"",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"3",
"]",
")",
".",
"getTypeSignature",
"(",
")",
")",
";",
"assertEquals",
"(",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
")",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"1",
"]",
")",
".",
"getNameRange",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"contents",
".",
"indexOf",
"(",
"\"ttt\"",
")",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"2",
"]",
")",
".",
"getNameRange",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"contents",
".",
"indexOf",
"(",
"\"hhh\"",
")",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"3",
"]",
")",
".",
"getNameRange",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"3",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"1",
"]",
")",
".",
"getNameRange",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"assertEquals",
"(",
"3",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"2",
"]",
")",
".",
"getNameRange",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"assertEquals",
"(",
"3",
",",
"(",
"(",
"IField",
")",
"children",
"[",
"3",
"]",
")",
".",
"getNameRange",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"}",
"public",
"void",
"testStructureUnknown",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"GroovyOutlinePage",
"outline",
"=",
"openFile",
"(",
"\"Problem\"",
",",
"contents",
")",
";",
"OCompilationUnit",
"unit",
"=",
"outline",
".",
"getOutlineCompilationUnit",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"unit",
".",
"getChildren",
"(",
")",
";",
"assertEquals",
"(",
"1",
",",
"children",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"Problem\"",
"+",
"GroovyScriptOutlineExtender",
".",
"NO_STRUCTURE_FOUND",
",",
"children",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"private",
"GroovyOutlinePage",
"openFile",
"(",
"String",
"className",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"\"",
",",
"className",
"+",
"\".groovy\"",
",",
"contents",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"unit",
".",
"reconcile",
"(",
"true",
",",
"null",
")",
";",
"GroovyEditor",
"editor",
"=",
"getGroovyEditor",
"(",
"unit",
")",
";",
"GroovyOutlinePage",
"outline",
"=",
"editor",
".",
"getOutlinePage",
"(",
")",
";",
"if",
"(",
"!",
"unit",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"unit",
".",
"getModuleNode",
"(",
")",
"==",
"null",
")",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"outline",
"!=",
"null",
")",
"{",
"outline",
".",
"refresh",
"(",
")",
";",
"return",
"outline",
";",
"}",
"return",
"null",
";",
"}",
"private",
"GroovyEditor",
"getGroovyEditor",
"(",
"GroovyCompilationUnit",
"unit",
")",
"throws",
"PartInitException",
"{",
"return",
"(",
"GroovyEditor",
")",
"EditorUtility",
".",
"openInEditor",
"(",
"unit",
")",
";",
"}",
"private",
"void",
"assertIsField",
"(",
"IJavaElement",
"element",
",",
"String",
"name",
",",
"String",
"typeSignature",
")",
"throws",
"JavaModelException",
"{",
"assertTrue",
"(",
"\"Element\"",
"+",
"element",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"element",
"instanceof",
"OField",
")",
";",
"OField",
"field",
"=",
"(",
"OField",
")",
"element",
";",
"assertTrue",
"(",
"\"\"",
"+",
"field",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
"+",
"name",
"+",
"\"'\"",
",",
"name",
".",
"equals",
"(",
"field",
".",
"getElementName",
"(",
")",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"field",
".",
"getTypeSignature",
"(",
")",
"+",
"\"\"",
"+",
"name",
"+",
"\"'\"",
",",
"typeSignature",
".",
"equals",
"(",
"field",
".",
"getTypeSignature",
"(",
")",
")",
")",
";",
"}",
"private",
"void",
"assertIsMethod",
"(",
"IJavaElement",
"element",
",",
"String",
"name",
",",
"String",
"returnType",
")",
"throws",
"JavaModelException",
"{",
"assertTrue",
"(",
"\"Element",
"\"",
"+",
"element",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"element",
"instanceof",
"OMethod",
")",
";",
"OMethod",
"method",
"=",
"(",
"OMethod",
")",
"element",
";",
"assertTrue",
"(",
"\"\"",
"+",
"method",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
"+",
"name",
"+",
"\"'\"",
",",
"name",
".",
"equals",
"(",
"method",
".",
"getElementName",
"(",
")",
")",
")",
";",
"if",
"(",
"returnType",
"!=",
"null",
")",
"{",
"assertTrue",
"(",
"\"\"",
"+",
"method",
".",
"getReturnTypeName",
"(",
")",
"+",
"\"\"",
"+",
"returnType",
"+",
"\"'\"",
",",
"returnType",
".",
"equals",
"(",
"method",
".",
"getReturnTypeName",
"(",
")",
")",
")",
";",
"}",
"}",
"private",
"void",
"assertIsType",
"(",
"IJavaElement",
"element",
",",
"String",
"name",
")",
"throws",
"JavaModelException",
"{",
"assertTrue",
"(",
"\"Element",
"\"",
"+",
"element",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"element",
"instanceof",
"OType",
")",
";",
"OType",
"type",
"=",
"(",
"OType",
")",
"element",
";",
"assertTrue",
"(",
"\"\"",
"+",
"type",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
"+",
"name",
"+",
"\"'\"",
",",
"name",
".",
"equals",
"(",
"type",
".",
"getElementName",
"(",
")",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,049 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"IHighlightingExtender",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IRule",
";",
"public",
"class",
"Extender1",
"implements",
"IHighlightingExtender",
",",
"IProjectNature",
"{",
"public",
"static",
"final",
"String",
"NATURE1",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"GJDK_KEYWORD",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"GROOVY_KEYWORD",
"=",
"\"\"",
";",
"public",
"List",
"<",
"String",
">",
"getAdditionalGJDKKeywords",
"(",
")",
"{",
"return",
"Arrays",
".",
"asList",
"(",
"GJDK_KEYWORD",
")",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getAdditionalGroovyKeywords",
"(",
")",
"{",
"return",
"Arrays",
".",
"asList",
"(",
"GROOVY_KEYWORD",
")",
";",
"}",
"public",
"List",
"<",
"IRule",
">",
"getAdditionalRules",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"void",
"configure",
"(",
")",
"throws",
"CoreException",
"{",
"}",
"public",
"void",
"deconfigure",
"(",
")",
"throws",
"CoreException",
"{",
"}",
"IProject",
"p",
";",
"public",
"IProject",
"getProject",
"(",
")",
"{",
"return",
"p",
";",
"}",
"public",
"void",
"setProject",
"(",
"IProject",
"project",
")",
"{",
"this",
".",
"p",
"=",
"project",
";",
"}",
"}",
"</s>"
] |
6,050 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"formatter",
".",
"DefaultCodeFormatterConstants",
";",
"public",
"class",
"GroovyAutoIndenterTests",
"extends",
"GroovyEditorTest",
"{",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
",",
"JavaCore",
".",
"TAB",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_SIZE",
",",
"\"4\"",
")",
";",
"ProjectScope",
"projectPrefScope",
"=",
"new",
"ProjectScope",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"projectPrefScope",
".",
"getNode",
"(",
"JavaCore",
".",
"PLUGIN_ID",
")",
".",
"clear",
"(",
")",
";",
"}",
"public",
"void",
"testScaffolding",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"<***>\"",
")",
";",
"send",
"(",
"'a'",
")",
";",
"assertEquals",
"(",
"\"a\"",
",",
"getText",
"(",
")",
")",
";",
"assertEditorContents",
"(",
"\"a<***>\"",
")",
";",
"}",
"public",
"void",
"test1",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"<***>\"",
")",
";",
"send",
"(",
"\"class",
"Foo",
"{n\"",
")",
";",
"assertEditorContents",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"test2",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}nn\"",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"tt<***>n\"",
"+",
"\"t}n\"",
"+",
"\"}nn\"",
")",
";",
"}",
"public",
"void",
"test3",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tttblah()n\"",
"+",
"\"tt}<***>n\"",
"+",
"\"t}n\"",
"+",
"\"}nn\"",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tttblah()n\"",
"+",
"\"tt}n\"",
"+",
"\"tt<***>n\"",
"+",
"\"t}n\"",
"+",
"\"}nn\"",
")",
";",
"}",
"public",
"void",
"testGRE631",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt<***>n\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"send",
"(",
"\"return",
"[]n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"ttreturn",
"[]n\"",
"+",
"\"tt<***>n\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testSpaces",
"(",
")",
"throws",
"Exception",
"{",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
",",
"JavaCore",
".",
"SPACE",
")",
";",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}nn\"",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}nn\"",
")",
";",
"}",
"public",
"void",
"testPasteInMultiLineString",
"(",
")",
"throws",
"Exception",
"{",
"String",
"initial",
"=",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}nn\"",
";",
"makeEditor",
"(",
"initial",
")",
";",
"String",
"pasteString",
"=",
"\"\"",
";",
"sendPaste",
"(",
"pasteString",
")",
";",
"assertEditorContents",
"(",
"initial",
".",
"replace",
"(",
"CARET",
",",
"pasteString",
"+",
"CARET",
")",
")",
";",
"}",
"public",
"void",
"testSpacesOptionSetAfterOpen",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}nn\"",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
",",
"JavaCore",
".",
"SPACE",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}nn\"",
")",
";",
"}",
"public",
"void",
"testMixedTabsAndSpaces",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}nn\"",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
",",
"DefaultCodeFormatterConstants",
".",
"MIXED",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_SIZE",
",",
"\"8\"",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INDENTATION_SIZE",
",",
"\"4\"",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t",
"<***>n\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}nn\"",
")",
";",
"}",
"public",
"void",
"testMixedTabsAndSpaces2",
"(",
")",
"throws",
"Exception",
"{",
"makeEditor",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}nn\"",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
",",
"DefaultCodeFormatterConstants",
".",
"MIXED",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_SIZE",
",",
"\"8\"",
")",
";",
"setJavaPreference",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INDENTATION_SIZE",
",",
"\"4\"",
")",
";",
"send",
"(",
"\"n\"",
")",
";",
"assertEditorContents",
"(",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"tdef",
"bar",
"{n\"",
"+",
"\"t",
"<***>n\"",
"+",
"\"t}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}nn\"",
")",
";",
"}",
"protected",
"void",
"setJavaPreference",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"}",
"</s>"
] |
6,051 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IViewPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"views",
".",
"log",
".",
"AbstractEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"views",
".",
"log",
".",
"LogEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"views",
".",
"log",
".",
"LogView",
";",
"public",
"class",
"ErrorLogTest",
"extends",
"TestCase",
"{",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"private",
"static",
"final",
"String",
"[",
"]",
"KNOWN_MSGS",
"=",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"}",
";",
"private",
"boolean",
"canIgnoreMessage",
"(",
"String",
"msg",
")",
"{",
"for",
"(",
"String",
"ignore",
":",
"KNOWN_MSGS",
")",
"{",
"if",
"(",
"msg",
".",
"contains",
"(",
"ignore",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"void",
"testNoWarningsOnStartup",
"(",
")",
"throws",
"Exception",
"{",
"IViewPart",
"view",
"=",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
".",
"getActivePart",
"(",
")",
".",
"getSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"showView",
"(",
"\"\"",
")",
";",
"if",
"(",
"view",
"instanceof",
"LogView",
")",
"{",
"LogView",
"logView",
"=",
"(",
"LogView",
")",
"view",
";",
"AbstractEntry",
"[",
"]",
"logs",
"=",
"logView",
".",
"getElements",
"(",
")",
";",
"List",
"<",
"AbstractEntry",
">",
"errorsAndWarnings",
"=",
"new",
"ArrayList",
"<",
"AbstractEntry",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"logs",
".",
"length",
";",
"i",
"++",
")",
"{",
"LogEntry",
"entry",
"=",
"(",
"LogEntry",
")",
"logs",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
"||",
"entry",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"WARNING",
")",
"{",
"String",
"msg",
"=",
"entry",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"!",
"canIgnoreMessage",
"(",
"msg",
")",
")",
"{",
"errorsAndWarnings",
".",
"add",
"(",
"logs",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"if",
"(",
"errorsAndWarnings",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"StringBuffer",
"errors",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"boolean",
"ignore",
"=",
"false",
";",
"for",
"(",
"AbstractEntry",
"element",
":",
"errorsAndWarnings",
")",
"{",
"LogEntry",
"log",
"=",
"(",
"LogEntry",
")",
"element",
";",
"errors",
".",
"append",
"(",
"log",
".",
"getMessage",
"(",
")",
")",
";",
"errors",
".",
"append",
"(",
"\"",
"(\"",
"+",
"log",
".",
"getPluginId",
"(",
")",
"+",
"\")n\"",
")",
";",
"if",
"(",
"element",
".",
"hasChildren",
"(",
")",
")",
"{",
"Object",
"[",
"]",
"sub",
"=",
"element",
".",
"getChildren",
"(",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sub",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"sub",
"[",
"i",
"]",
"instanceof",
"LogEntry",
")",
"{",
"LogEntry",
"s",
"=",
"(",
"LogEntry",
")",
"sub",
"[",
"i",
"]",
";",
"String",
"msg",
"=",
"s",
".",
"getMessage",
"(",
")",
";",
"errors",
".",
"append",
"(",
"\"",
"\"",
"+",
"msg",
")",
";",
"errors",
".",
"append",
"(",
"\"",
"(\"",
"+",
"s",
".",
"getPluginId",
"(",
")",
"+",
"\")n\"",
")",
";",
"errors",
".",
"append",
"(",
"\"\"",
"+",
"s",
".",
"getStack",
"(",
")",
"+",
"\"nnn\"",
")",
";",
"ignore",
"=",
"false",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"!",
"ignore",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"errors",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,052 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"IConsole",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"IConsoleLineTrackerExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"public",
"class",
"ConsoleLineTracker",
"implements",
"IConsoleLineTrackerExtension",
"{",
"private",
"static",
"IConsoleLineTrackerExtension",
"fDelegate",
";",
"private",
"static",
"IConsole",
"fConsole",
";",
"public",
"static",
"void",
"setDelegate",
"(",
"IConsoleLineTrackerExtension",
"tracker",
")",
"{",
"fDelegate",
"=",
"tracker",
";",
"fConsole",
"=",
"null",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"fDelegate",
"!=",
"null",
")",
"{",
"fDelegate",
".",
"dispose",
"(",
")",
";",
"}",
"fConsole",
"=",
"null",
";",
"}",
"public",
"synchronized",
"void",
"init",
"(",
"IConsole",
"console",
")",
"{",
"fConsole",
"=",
"console",
";",
"if",
"(",
"fDelegate",
"!=",
"null",
")",
"{",
"fDelegate",
".",
"init",
"(",
"console",
")",
";",
"}",
"}",
"public",
"static",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"fConsole",
".",
"getDocument",
"(",
")",
";",
"}",
"public",
"void",
"lineAppended",
"(",
"IRegion",
"line",
")",
"{",
"if",
"(",
"fDelegate",
"!=",
"null",
")",
"{",
"fDelegate",
".",
"lineAppended",
"(",
"line",
")",
";",
"}",
"}",
"public",
"void",
"consoleClosed",
"(",
")",
"{",
"if",
"(",
"fDelegate",
"!=",
"null",
"&&",
"fConsole",
"!=",
"null",
")",
"{",
"fDelegate",
".",
"consoleClosed",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,053 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
".",
"GroovyConsoleLineTracker",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
".",
"GroovyConsoleLineTracker",
".",
"AmbiguousFileLink",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IProcess",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IStreamMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IStreamsProxy",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"FileLink",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"IConsole",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"IConsoleHyperlink",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Region",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IHyperlink",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IOConsoleOutputStream",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IPatternMatchListener",
";",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"class",
"ConsoleLineTrackerTests",
"extends",
"EclipseTestCase",
"{",
"MockConsole",
"console",
";",
"GroovyConsoleLineTracker",
"lineTracker",
";",
"IDocument",
"doc",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"doc",
"=",
"new",
"Document",
"(",
")",
";",
"console",
"=",
"new",
"MockConsole",
"(",
"doc",
")",
";",
"lineTracker",
"=",
"new",
"GroovyConsoleLineTracker",
"(",
")",
";",
"lineTracker",
".",
"init",
"(",
"console",
")",
";",
"testProject",
".",
"addNature",
"(",
"GroovyNature",
".",
"GROOVY_NATURE",
")",
";",
"}",
"public",
"void",
"testNoLink",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"f\"",
",",
"\"Bar.groovy\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"ahdhjkfsfds\"",
";",
"doc",
".",
"set",
"(",
"contents",
")",
";",
"lineTracker",
".",
"lineAppended",
"(",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
")",
";",
"assertNull",
"(",
"\"\"",
",",
"console",
".",
"getLastLink",
"(",
")",
")",
";",
"}",
"public",
"void",
"testLink",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"f\"",
",",
"\"Bar.groovy\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"doc",
".",
"set",
"(",
"contents",
")",
";",
"lineTracker",
".",
"lineAppended",
"(",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"console",
".",
"getLastLink",
"(",
")",
")",
";",
"FileLink",
"link",
"=",
"(",
"FileLink",
")",
"console",
".",
"getLastLink",
"(",
")",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"FileLink",
".",
"class",
",",
"\"fFile\"",
",",
"link",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"file",
".",
"isAccessible",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Bar.groovy\"",
",",
"file",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testAmbiguousLink",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"f\"",
",",
"\"Bar.groovy\"",
",",
"\"\"",
")",
";",
"testProject",
".",
"createOtherSourceFolder",
"(",
")",
";",
"testProject",
".",
"getProject",
"(",
")",
".",
"getFolder",
"(",
"\"other/f\"",
")",
".",
"create",
"(",
"true",
",",
"true",
",",
"null",
")",
";",
"testProject",
".",
"getProject",
"(",
")",
".",
"getFile",
"(",
"\"\"",
")",
".",
"create",
"(",
"new",
"ByteArrayInputStream",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
",",
"true",
",",
"null",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"doc",
".",
"set",
"(",
"contents",
")",
";",
"lineTracker",
".",
"lineAppended",
"(",
"new",
"Region",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"console",
".",
"getLastLink",
"(",
")",
")",
";",
"FileLink",
"link",
"=",
"(",
"FileLink",
")",
"console",
".",
"getLastLink",
"(",
")",
";",
"Object",
"file",
"=",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"FileLink",
".",
"class",
",",
"\"fFile\"",
",",
"link",
")",
";",
"assertNull",
"(",
"\"\"",
",",
"file",
")",
";",
"IFile",
"[",
"]",
"files",
"=",
"(",
"IFile",
"[",
"]",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"AmbiguousFileLink",
".",
"class",
",",
"\"files\"",
",",
"link",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"2",
",",
"files",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Bar.groovy\"",
",",
"files",
"[",
"0",
"]",
".",
"getName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Bar.groovy\"",
",",
"files",
"[",
"1",
"]",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"class",
"MockConsole",
"implements",
"IConsole",
"{",
"private",
"Map",
"<",
"IHyperlink",
",",
"IRegion",
">",
"regionLinkMap",
"=",
"new",
"HashMap",
"<",
"IHyperlink",
",",
"IRegion",
">",
"(",
")",
";",
"private",
"IHyperlink",
"lastLink",
"=",
"null",
";",
"private",
"IDocument",
"doc",
";",
"public",
"MockConsole",
"(",
"IDocument",
"doc",
")",
"{",
"this",
".",
"doc",
"=",
"doc",
";",
"}",
"public",
"void",
"addLink",
"(",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"IConsoleHyperlink",
"link",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"}",
"public",
"void",
"connect",
"(",
"IStreamsProxy",
"streamsProxy",
")",
"{",
"}",
"public",
"void",
"connect",
"(",
"IStreamMonitor",
"streamMonitor",
",",
"String",
"streamIdentifer",
")",
"{",
"}",
"public",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"doc",
";",
"}",
"public",
"IProcess",
"getProcess",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"IRegion",
"getRegion",
"(",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"IConsoleHyperlink",
"link",
")",
"{",
"return",
"null",
";",
"}",
"public",
"void",
"addLink",
"(",
"IHyperlink",
"link",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"regionLinkMap",
".",
"put",
"(",
"link",
",",
"new",
"Region",
"(",
"offset",
",",
"length",
")",
")",
";",
"lastLink",
"=",
"link",
";",
"}",
"public",
"void",
"addPatternMatchListener",
"(",
"IPatternMatchListener",
"matchListener",
")",
"{",
"}",
"public",
"IRegion",
"getRegion",
"(",
"IHyperlink",
"link",
")",
"{",
"return",
"regionLinkMap",
".",
"get",
"(",
"link",
")",
";",
"}",
"public",
"IHyperlink",
"getLastLink",
"(",
")",
"{",
"return",
"lastLink",
";",
"}",
"public",
"IOConsoleOutputStream",
"getStream",
"(",
"String",
"streamIdentifier",
")",
"{",
"return",
"null",
";",
"}",
"public",
"void",
"removePatternMatchListener",
"(",
"IPatternMatchListener",
"matchListener",
")",
"{",
"}",
"}",
"</s>"
] |
6,054 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"junit",
".",
"framework",
".",
"AssertionFailedError",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
".",
"GroovyScriptLaunchShortcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"TestProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunch",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfiguration",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"internal",
".",
"ui",
".",
"DebugUIPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"internal",
".",
"ui",
".",
"IInternalDebugUIConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"internal",
".",
"ui",
".",
"preferences",
".",
"IDebugPreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaApplicationLaunchShortcut",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialogWithToggle",
";",
"public",
"class",
"GroovyLauncherShortcutTests",
"extends",
"EclipseTestCase",
"{",
"class",
"MockGroovyScriptLaunchShortcut",
"extends",
"GroovyScriptLaunchShortcut",
"{",
"@",
"Override",
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"createLaunchProperties",
"(",
"IType",
"runType",
",",
"IJavaProject",
"javaProject",
")",
"{",
"return",
"super",
".",
"createLaunchProperties",
"(",
"runType",
",",
"javaProject",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"generateClasspath",
"(",
"IJavaProject",
"javaProject",
")",
"{",
"return",
"super",
".",
"generateClasspath",
"(",
"javaProject",
")",
";",
"}",
"}",
"class",
"MockJavaApplicationLaunchShortcut",
"extends",
"JavaApplicationLaunchShortcut",
"{",
"@",
"Override",
"protected",
"ILaunchConfiguration",
"createConfiguration",
"(",
"IType",
"type",
")",
"{",
"return",
"super",
".",
"createConfiguration",
"(",
"type",
")",
";",
"}",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"DebugUIPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"setValue",
"(",
"IInternalDebugUIConstants",
".",
"PREF_WAIT_FOR_BUILD",
",",
"MessageDialogWithToggle",
".",
"NEVER",
")",
";",
"DebugUIPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"setValue",
"(",
"IDebugPreferenceConstants",
".",
"CONSOLE_OPEN_ON_OUT",
",",
"false",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"public",
"GroovyLauncherShortcutTests",
"(",
")",
"{",
"super",
"(",
"GroovyLauncherShortcutTests",
".",
"class",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testScriptLaunch1",
"(",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch2",
"(",
")",
"throws",
"Exception",
"{",
"createGroovyCompilationUnit",
"(",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch3",
"(",
")",
"throws",
"Exception",
"{",
"createJavaCompilationUnit",
"(",
"\"Other.java\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch4",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragmentRoot",
"newRoot",
"=",
"createSourceFolder",
"(",
")",
";",
"IPackageFragment",
"newFrag",
"=",
"createFragment",
"(",
"newRoot",
")",
";",
"createGroovyCompilationUnit",
"(",
"newFrag",
",",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch5",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragmentRoot",
"newRoot",
"=",
"createSourceFolder",
"(",
")",
";",
"IPackageFragment",
"newFrag",
"=",
"createFragment",
"(",
"newRoot",
")",
";",
"createJavaCompilationUnit",
"(",
"newFrag",
",",
"\"Other.java\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch6",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragmentRoot",
"newRoot",
"=",
"createSourceFolder",
"(",
")",
";",
"IPackageFragment",
"newFrag",
"=",
"createFragment",
"(",
"newRoot",
")",
";",
"createGroovyCompilationUnit",
"(",
"\"otherOther\"",
",",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"newFrag",
",",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch7",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragmentRoot",
"newRoot",
"=",
"createSourceFolder",
"(",
"\"otherOut\"",
")",
";",
"IPackageFragment",
"newFrag",
"=",
"createFragment",
"(",
"newRoot",
")",
";",
"createGroovyCompilationUnit",
"(",
"newFrag",
",",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch8",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragmentRoot",
"newRoot",
"=",
"createSourceFolder",
"(",
"\"otherOut\"",
")",
";",
"IPackageFragment",
"newFrag",
"=",
"createFragment",
"(",
"newRoot",
")",
";",
"createJavaCompilationUnit",
"(",
"newFrag",
",",
"\"Other.java\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"public",
"void",
"testScriptLaunch9",
"(",
")",
"throws",
"Exception",
"{",
"TestProject",
"otherProject",
"=",
"new",
"TestProject",
"(",
"\"OtherProject\"",
")",
";",
"try",
"{",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"otherProject",
".",
"getProject",
"(",
")",
")",
";",
"testProject",
".",
"addProjectReference",
"(",
"otherProject",
".",
"getJavaProject",
"(",
")",
")",
";",
"otherProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack\"",
",",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"thisPack\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"finally",
"{",
"otherProject",
".",
"dispose",
"(",
")",
";",
"}",
"}",
"public",
"void",
"testScriptLaunch10",
"(",
")",
"throws",
"Exception",
"{",
"TestProject",
"otherProject",
"=",
"new",
"TestProject",
"(",
"\"OtherProject\"",
")",
";",
"try",
"{",
"testProject",
".",
"addProjectReference",
"(",
"otherProject",
".",
"getJavaProject",
"(",
")",
")",
";",
"otherProject",
".",
"createJavaTypeAndPackage",
"(",
"\"pack\"",
",",
"\"Other.java\"",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"createGroovyCompilationUnit",
"(",
"\"thisPack\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"IType",
"launchType",
"=",
"unit",
".",
"getType",
"(",
"\"Launch\"",
")",
";",
"launchScriptAndAssertExitValue",
"(",
"launchType",
")",
";",
"}",
"finally",
"{",
"otherProject",
".",
"dispose",
"(",
")",
";",
"}",
"}",
"public",
"void",
"testClasspathGeneration1",
"(",
")",
"throws",
"Exception",
"{",
"TestProject",
"p4",
"=",
"new",
"TestProject",
"(",
"\"P4\"",
")",
";",
"p4",
".",
"createSourceFolder",
"(",
"\"src2\"",
",",
"\"bin2\"",
")",
";",
"TestProject",
"p3",
"=",
"new",
"TestProject",
"(",
"\"P3\"",
")",
";",
"p3",
".",
"addProjectReference",
"(",
"p4",
".",
"getJavaProject",
"(",
")",
")",
";",
"p3",
".",
"createSourceFolder",
"(",
"\"src2\"",
",",
"\"bin2\"",
")",
";",
"TestProject",
"p2",
"=",
"new",
"TestProject",
"(",
"\"P2\"",
")",
";",
"p2",
".",
"addProjectReference",
"(",
"p4",
".",
"getJavaProject",
"(",
")",
")",
";",
"p2",
".",
"addProjectReference",
"(",
"p3",
".",
"getJavaProject",
"(",
")",
")",
";",
"TestProject",
"p1",
"=",
"new",
"TestProject",
"(",
"\"P1\"",
")",
";",
"p1",
".",
"addProjectReference",
"(",
"p4",
".",
"getJavaProject",
"(",
")",
")",
";",
"p1",
".",
"addProjectReference",
"(",
"p3",
".",
"getJavaProject",
"(",
")",
")",
";",
"p1",
".",
"addProjectReference",
"(",
"p2",
".",
"getJavaProject",
"(",
")",
")",
";",
"String",
"classpath",
"=",
"new",
"MockGroovyScriptLaunchShortcut",
"(",
")",
".",
"generateClasspath",
"(",
"p1",
".",
"getJavaProject",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"createClassPathString1",
"(",
")",
",",
"classpath",
")",
";",
"p1",
".",
"dispose",
"(",
")",
";",
"p2",
".",
"dispose",
"(",
")",
";",
"p3",
".",
"dispose",
"(",
")",
";",
"p4",
".",
"dispose",
"(",
")",
";",
"}",
"public",
"void",
"testClasspathGeneration2",
"(",
")",
"throws",
"Exception",
"{",
"TestProject",
"p1",
"=",
"new",
"TestProject",
"(",
"\"P1a\"",
")",
";",
"URL",
"groovyURL",
"=",
"CompilerUtils",
".",
"getExportedGroovyAllJar",
"(",
")",
";",
"IPath",
"runtimeJarPath",
"=",
"new",
"Path",
"(",
"groovyURL",
".",
"getPath",
"(",
")",
")",
";",
"p1",
".",
"addJarFileToClasspath",
"(",
"runtimeJarPath",
")",
";",
"IFile",
"f1",
"=",
"p1",
".",
"createFile",
"(",
"\"empty.jar\"",
",",
"\"\"",
")",
";",
"p1",
".",
"addJarFileToClasspath",
"(",
"f1",
".",
"getFullPath",
"(",
")",
")",
";",
"TestProject",
"p2",
"=",
"new",
"TestProject",
"(",
"\"P2a\"",
")",
";",
"IFile",
"f2",
"=",
"p2",
".",
"createFile",
"(",
"\"empty2.jar\"",
",",
"\"\"",
")",
";",
"p1",
".",
"addJarFileToClasspath",
"(",
"f2",
".",
"getFullPath",
"(",
")",
")",
";",
"String",
"classpath",
"=",
"new",
"MockGroovyScriptLaunchShortcut",
"(",
")",
".",
"generateClasspath",
"(",
"p1",
".",
"getJavaProject",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"createClassPathString2",
"(",
"runtimeJarPath",
".",
"toPortableString",
"(",
")",
")",
",",
"classpath",
")",
";",
"p1",
".",
"dispose",
"(",
")",
";",
"p2",
".",
"dispose",
"(",
")",
";",
"}",
"private",
"String",
"createClassPathString1",
"(",
")",
"{",
"String",
"classpath",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"if",
"(",
"File",
".",
"separatorChar",
"==",
"'/'",
")",
"{",
"classpath",
"=",
"classpath",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
";",
"}",
"return",
"classpath",
";",
"}",
"private",
"String",
"createClassPathString2",
"(",
"String",
"groovyRuntimePath",
")",
"{",
"String",
"classpath",
"=",
"\"\"",
"+",
"\"\"",
"+",
"groovyRuntimePath",
"+",
"\":\"",
"+",
"\"\"",
";",
"if",
"(",
"File",
".",
"separatorChar",
"==",
"'/'",
")",
"{",
"classpath",
"=",
"classpath",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
";",
"}",
"return",
"classpath",
";",
"}",
"private",
"IPackageFragment",
"createFragment",
"(",
"IPackageFragmentRoot",
"newRoot",
")",
"throws",
"Exception",
"{",
"return",
"newRoot",
".",
"createPackageFragment",
"(",
"\"other\"",
",",
"true",
",",
"null",
")",
";",
"}",
"private",
"IPackageFragmentRoot",
"createSourceFolder",
"(",
")",
"throws",
"Exception",
"{",
"return",
"testProject",
".",
"createOtherSourceFolder",
"(",
")",
";",
"}",
"private",
"IPackageFragmentRoot",
"createSourceFolder",
"(",
"String",
"outFolder",
")",
"throws",
"Exception",
"{",
"return",
"testProject",
".",
"createOtherSourceFolder",
"(",
"outFolder",
")",
";",
"}",
"private",
"ICompilationUnit",
"createGroovyCompilationUnit",
"(",
"IPackageFragment",
"frag",
",",
"String",
"unitName",
",",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyType",
"(",
"frag",
",",
"unitName",
",",
"contents",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"return",
"unit",
";",
"}",
"private",
"ICompilationUnit",
"createGroovyCompilationUnit",
"(",
"String",
"unitName",
",",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"return",
"createGroovyCompilationUnit",
"(",
"\"\"",
",",
"unitName",
",",
"contents",
")",
";",
"}",
"private",
"ICompilationUnit",
"createGroovyCompilationUnit",
"(",
"String",
"packageName",
",",
"String",
"unitName",
",",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"packageName",
",",
"unitName",
",",
"contents",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"return",
"unit",
";",
"}",
"private",
"IType",
"createJavaCompilationUnit",
"(",
"String",
"unitName",
",",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"return",
"testProject",
".",
"createJavaTypeAndPackage",
"(",
"\"\"",
",",
"unitName",
",",
"contents",
")",
";",
"}",
"private",
"IType",
"createJavaCompilationUnit",
"(",
"IPackageFragment",
"frag",
",",
"String",
"unitName",
",",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"return",
"testProject",
".",
"createJavaType",
"(",
"frag",
",",
"unitName",
",",
"contents",
")",
";",
"}",
"protected",
"void",
"launchScriptAndAssertExitValue",
"(",
"IType",
"launchType",
")",
"throws",
"InterruptedException",
",",
"CoreException",
"{",
"launchScriptAndAssertExitValue",
"(",
"launchType",
",",
"20",
")",
";",
"}",
"protected",
"void",
"launchScriptAndAssertExitValue",
"(",
"final",
"IType",
"launchType",
",",
"final",
"int",
"timeoutSeconds",
")",
"throws",
"InterruptedException",
",",
"CoreException",
"{",
"String",
"problems",
"=",
"testProject",
".",
"getProblems",
"(",
")",
";",
"if",
"(",
"problems",
"!=",
"null",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"problems",
")",
";",
"}",
"Runnable",
"runner",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"MockGroovyScriptLaunchShortcut",
"shortcut",
"=",
"new",
"MockGroovyScriptLaunchShortcut",
"(",
")",
";",
"ILaunchConfiguration",
"config",
"=",
"shortcut",
".",
"findOrCreateLaunchConfig",
"(",
"shortcut",
".",
"createLaunchProperties",
"(",
"launchType",
",",
"launchType",
".",
"getJavaProject",
"(",
")",
")",
",",
"launchType",
".",
"getFullyQualifiedName",
"(",
")",
")",
";",
"assertTrue",
"(",
"launchType",
".",
"exists",
"(",
")",
")",
";",
"ILaunch",
"launch",
"=",
"config",
".",
"launch",
"(",
"\"run\"",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"synchronized",
"(",
"launch",
")",
"{",
"int",
"i",
"=",
"0",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"i",
"+",
"\"",
"sec...\"",
")",
";",
"while",
"(",
"!",
"launch",
".",
"isTerminated",
"(",
")",
"&&",
"i",
"<",
"timeoutSeconds",
")",
"{",
"i",
"++",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"i",
"+",
"\"",
"sec...\"",
")",
";",
"launch",
".",
"wait",
"(",
"1000",
")",
";",
"}",
"}",
"if",
"(",
"launch",
".",
"isTerminated",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"launch",
".",
"getProcesses",
"(",
")",
"[",
"0",
"]",
".",
"getStreamsProxy",
"(",
")",
".",
"getOutputStreamMonitor",
"(",
")",
".",
"getContents",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Process",
"err:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"launch",
".",
"getProcesses",
"(",
")",
"[",
"0",
"]",
".",
"getStreamsProxy",
"(",
")",
".",
"getErrorStreamMonitor",
"(",
")",
".",
"getContents",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"assertTrue",
"(",
"\"\"",
",",
"launch",
".",
"isTerminated",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"0",
",",
"launch",
".",
"getProcesses",
"(",
")",
"[",
"0",
"]",
".",
"getExitValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"AssertionFailedError",
"currentException",
"=",
"null",
";",
"for",
"(",
"int",
"attempt",
"=",
"0",
";",
"attempt",
"<",
"4",
";",
"attempt",
"++",
")",
"{",
"try",
"{",
"runner",
".",
"run",
"(",
")",
";",
"return",
";",
"}",
"catch",
"(",
"AssertionFailedError",
"e",
")",
"{",
"currentException",
"=",
"e",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"attempt",
"+",
"\"",
"retrying.\"",
")",
";",
"}",
"}",
"if",
"(",
"currentException",
"!=",
"null",
")",
"{",
"throw",
"currentException",
";",
"}",
"}",
"}",
"</s>"
] |
6,055 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"junit",
".",
"framework",
".",
"AssertionFailedError",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"IOUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ToggleBreakpointAdapter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"Activator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"SynchronizationUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"IBreakpointManager",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"ActionDelegateHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"EditorUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"public",
"class",
"DebugBreakpointsTests",
"extends",
"EclipseTestCase",
"{",
"private",
"static",
"final",
"String",
"BREAKPOINT_SCRIPT_NAME",
"=",
"\"\"",
";",
"private",
"ToggleBreakpointAdapter",
"adapter",
";",
"private",
"ICompilationUnit",
"unit",
";",
"private",
"GroovyEditor",
"editor",
";",
"private",
"String",
"text",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"InputStream",
"input",
"=",
"null",
";",
"final",
"URL",
"url",
"=",
"Activator",
".",
"bundle",
"(",
")",
".",
"getEntry",
"(",
"\"\"",
"+",
"BREAKPOINT_SCRIPT_NAME",
")",
";",
"try",
"{",
"input",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"\"",
",",
"BREAKPOINT_SCRIPT_NAME",
",",
"input",
")",
";",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"input",
")",
";",
"}",
"try",
"{",
"input",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"text",
"=",
"IOUtils",
".",
"toString",
"(",
"input",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"input",
")",
";",
"}",
"adapter",
"=",
"new",
"ToggleBreakpointAdapter",
"(",
")",
";",
"editor",
"=",
"(",
"GroovyEditor",
")",
"EditorUtility",
".",
"openInEditor",
"(",
"unit",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"ActionDelegateHelper",
".",
"class",
",",
"\"fTextEditor\"",
",",
"ActionDelegateHelper",
".",
"getDefault",
"(",
")",
",",
"editor",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"unit",
".",
"makeConsistent",
"(",
"null",
")",
";",
"SynchronizationUtils",
".",
"joinBackgroudActivities",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"editor",
".",
"close",
"(",
"false",
")",
";",
"SynchronizationUtils",
".",
"joinBackgroudActivities",
"(",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript1",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"1",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript2",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"2",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript3",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"3",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript4",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"4",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript5",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"5",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript6",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"6",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript7",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"7",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript8",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"8",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript9",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"9",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript10",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"10",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript11",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"11",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript12",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"12",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript13",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"13",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript14",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"14",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript15",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"15",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript16",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"16",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript17",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"17",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript18",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"18",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript19",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"19",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript20",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"20",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript21",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"21",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript22",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"22",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript23",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"23",
")",
";",
"}",
"private",
"void",
"doBreakpointTest",
"(",
"int",
"i",
")",
"throws",
"Exception",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"maxCount",
"=",
"5",
";",
"while",
"(",
"count",
"<=",
"maxCount",
")",
"{",
"count",
"++",
";",
"try",
"{",
"innerDoBreakpointTest",
"(",
"i",
")",
";",
"}",
"catch",
"(",
"AssertionFailedError",
"err",
")",
"{",
"if",
"(",
"count",
">=",
"maxCount",
")",
"{",
"throw",
"err",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"innerDoBreakpointTest",
"(",
"int",
"i",
")",
"throws",
"CoreException",
"{",
"ITextSelection",
"selection",
"=",
"new",
"TextSelection",
"(",
"new",
"Document",
"(",
"text",
")",
",",
"text",
".",
"indexOf",
"(",
"\"//",
"\"",
"+",
"i",
")",
"-",
"3",
",",
"3",
")",
";",
"boolean",
"canToggle",
"=",
"adapter",
".",
"canToggleLineBreakpoints",
"(",
"editor",
",",
"selection",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"i",
",",
"canToggle",
")",
";",
"int",
"initialNumBreakpoints",
";",
"IBreakpointManager",
"breakpointManager",
"=",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
";",
"IBreakpoint",
"[",
"]",
"breakpoints",
"=",
"breakpointManager",
".",
"getBreakpoints",
"(",
")",
";",
"initialNumBreakpoints",
"=",
"breakpoints",
".",
"length",
";",
"try",
"{",
"adapter",
".",
"toggleLineBreakpoints",
"(",
"editor",
",",
"selection",
")",
";",
"SynchronizationUtils",
".",
"joinBackgroudActivities",
"(",
")",
";",
"}",
"finally",
"{",
"IBreakpoint",
"[",
"]",
"newBreakpoints",
"=",
"breakpointManager",
".",
"getBreakpoints",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"initialNumBreakpoints",
"+",
"1",
",",
"newBreakpoints",
".",
"length",
")",
";",
"for",
"(",
"IBreakpoint",
"breakpoint",
":",
"newBreakpoints",
")",
"{",
"breakpointManager",
".",
"removeBreakpoint",
"(",
"breakpoint",
",",
"true",
")",
";",
"}",
"assertEquals",
"(",
"\"\"",
",",
"0",
",",
"breakpointManager",
".",
"getBreakpoints",
"(",
")",
".",
"length",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,056 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"IOUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ValidBreakpointLocationFinder",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"Activator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"public",
"class",
"BreakpointLocationTests",
"extends",
"EclipseTestCase",
"{",
"private",
"static",
"final",
"String",
"BREAKPOINT_SCRIPT_NAME",
"=",
"\"\"",
";",
"private",
"GroovyCompilationUnit",
"unit",
";",
"private",
"IDocument",
"document",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"InputStream",
"input",
"=",
"null",
";",
"final",
"URL",
"url",
"=",
"Activator",
".",
"bundle",
"(",
")",
".",
"getEntry",
"(",
"\"\"",
"+",
"BREAKPOINT_SCRIPT_NAME",
")",
";",
"try",
"{",
"input",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"\"",
",",
"BREAKPOINT_SCRIPT_NAME",
",",
"input",
")",
";",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"input",
")",
";",
"}",
"String",
"text",
";",
"try",
"{",
"input",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"text",
"=",
"IOUtils",
".",
"toString",
"(",
"input",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"input",
")",
";",
"}",
"document",
"=",
"new",
"Document",
"(",
"text",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"unit",
".",
"makeConsistent",
"(",
"null",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript1",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"1",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript2",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"2",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript3",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"3",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript4",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"4",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript5",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"5",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript6",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"6",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript7",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"7",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript8",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"8",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript9",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"9",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript10",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"10",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript11",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"11",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript12",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"12",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript13",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"13",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript14",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"14",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript15",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"15",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript16",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"16",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript17",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"17",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript18",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"18",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript19",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"19",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript20",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"20",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript21",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"21",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript22",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"22",
")",
";",
"}",
"public",
"void",
"testBreakpointInScript23",
"(",
")",
"throws",
"Exception",
"{",
"doBreakpointTest",
"(",
"23",
")",
";",
"}",
"private",
"void",
"doBreakpointTest",
"(",
"int",
"i",
")",
"throws",
"Exception",
"{",
"int",
"location",
"=",
"document",
".",
"get",
"(",
")",
".",
"indexOf",
"(",
"\"//",
"\"",
"+",
"i",
")",
"-",
"3",
";",
"int",
"line",
"=",
"document",
".",
"getLineOfOffset",
"(",
"location",
")",
"+",
"1",
";",
"ValidBreakpointLocationFinder",
"finder",
"=",
"new",
"ValidBreakpointLocationFinder",
"(",
"line",
")",
";",
"ASTNode",
"node",
"=",
"finder",
".",
"findValidBreakpointLocation",
"(",
"unit",
".",
"getModuleNode",
"(",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
"+",
"line",
",",
"node",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"line",
",",
"node",
".",
"getLineNumber",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,057 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"core",
".",
"util",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"ISourceBuffer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"impl",
".",
"StringSourceBuffer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"util",
".",
"ExpressionFinder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"public",
"class",
"ExpressionFinderTestCase",
"extends",
"TestCase",
"{",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"public",
"void",
"test_identifierExpression",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"bbbb.\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_parenExpression",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"(bbbb).\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_arrayElementExpressionInParen",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"(bbbb[10]).\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_arrayElementExpression",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"bbbb[10].\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_parenInParenExpression",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"(([10])).\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_parenInParenExpression2",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_stringExpression",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\\\"13\\\".\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_stringExpressionAfterOtherExpressionAndNewLine",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\\\"13\\\".\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_stringExpressionAfterOtherExpressionAndSemi",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\\\"13\\\".\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionInGString",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"a.\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionInParenAfterNewLine",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionAfterNewLine",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_noExpression1",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Disabled\"",
")",
";",
"}",
"public",
"void",
"test_noExpression2",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_noExpression3",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionAfterNumber",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"100\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionAfterStringLiteral",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"null",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionInParenAfterSemi",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"public",
"void",
"test_expressionForNewGenericType",
"(",
")",
"throws",
"Exception",
"{",
"ExpressionFinder",
"finder",
"=",
"new",
"ExpressionFinder",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"String",
"completionLocation",
"=",
"\"\"",
";",
"ISourceBuffer",
"sourceBuffer",
"=",
"new",
"StringSourceBuffer",
"(",
"source",
")",
";",
"String",
"expression",
"=",
"finder",
".",
"findForCompletions",
"(",
"sourceBuffer",
",",
"completionLocation",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"\"",
",",
"expression",
")",
";",
"}",
"}",
"</s>"
] |
6,058 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"RenameToGroovyAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"RenameToGroovyOrJavaAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"RenameToJavaAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"StructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IActionDelegate",
";",
"public",
"class",
"ConvertToJavaOrGroovyActionTest",
"extends",
"EclipseTestCase",
"{",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"testProject",
".",
"addNature",
"(",
"GroovyNature",
".",
"GROOVY_NATURE",
")",
";",
"}",
"public",
"void",
"testRenameToGroovy",
"(",
")",
"throws",
"Exception",
"{",
"IType",
"type",
"=",
"testProject",
".",
"createJavaTypeAndPackage",
"(",
"\"foo\"",
",",
"\"Bar.java\"",
",",
"\"\"",
")",
";",
"IResource",
"file",
"=",
"type",
".",
"getCompilationUnit",
"(",
")",
".",
"getResource",
"(",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"StructuredSelection",
"ss",
"=",
"new",
"StructuredSelection",
"(",
"file",
")",
";",
"IActionDelegate",
"action",
"=",
"new",
"RenameToGroovyAction",
"(",
")",
";",
"action",
".",
"selectionChanged",
"(",
"null",
",",
"ss",
")",
";",
"action",
".",
"run",
"(",
"null",
")",
";",
"waitForJobAndRefresh",
"(",
"file",
")",
";",
"assertFalse",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"file",
"=",
"file",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"Bar.groovy\"",
")",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testRenameToJava",
"(",
")",
"throws",
"Exception",
"{",
"IResource",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"foo\"",
",",
"\"Bar.groovy\"",
",",
"\"\"",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"StructuredSelection",
"ss",
"=",
"new",
"StructuredSelection",
"(",
"file",
")",
";",
"IActionDelegate",
"action",
"=",
"new",
"RenameToJavaAction",
"(",
")",
";",
"action",
".",
"selectionChanged",
"(",
"null",
",",
"ss",
")",
";",
"action",
".",
"run",
"(",
"null",
")",
";",
"waitForJobAndRefresh",
"(",
"file",
")",
";",
"assertFalse",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"file",
"=",
"file",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"Bar.java\"",
")",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testRenameToGroovyAndBack",
"(",
")",
"throws",
"Exception",
"{",
"IType",
"type",
"=",
"testProject",
".",
"createJavaTypeAndPackage",
"(",
"\"foo\"",
",",
"\"Bar.java\"",
",",
"\"\"",
")",
";",
"IResource",
"file",
"=",
"type",
".",
"getCompilationUnit",
"(",
")",
".",
"getResource",
"(",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"StructuredSelection",
"ss",
"=",
"new",
"StructuredSelection",
"(",
"file",
")",
";",
"IActionDelegate",
"action",
"=",
"new",
"RenameToGroovyAction",
"(",
")",
";",
"action",
".",
"selectionChanged",
"(",
"null",
",",
"ss",
")",
";",
"action",
".",
"run",
"(",
"null",
")",
";",
"waitForJobAndRefresh",
"(",
"file",
")",
";",
"assertFalse",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"file",
"=",
"file",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"Bar.groovy\"",
")",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"ss",
"=",
"new",
"StructuredSelection",
"(",
"file",
")",
";",
"action",
"=",
"new",
"RenameToJavaAction",
"(",
")",
";",
"action",
".",
"selectionChanged",
"(",
"null",
",",
"ss",
")",
";",
"action",
".",
"run",
"(",
"null",
")",
";",
"waitForJobAndRefresh",
"(",
"file",
")",
";",
"assertFalse",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"file",
"=",
"file",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"Bar.java\"",
")",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testRenameToJavaAndBack",
"(",
")",
"throws",
"Exception",
"{",
"IResource",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"foo\"",
",",
"\"Bar.roovy\"",
",",
"\"\"",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"StructuredSelection",
"ss",
"=",
"new",
"StructuredSelection",
"(",
"file",
")",
";",
"IActionDelegate",
"action",
"=",
"new",
"RenameToJavaAction",
"(",
")",
";",
"action",
".",
"selectionChanged",
"(",
"null",
",",
"ss",
")",
";",
"action",
".",
"run",
"(",
"null",
")",
";",
"waitForJobAndRefresh",
"(",
"file",
")",
";",
"assertFalse",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"file",
"=",
"file",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"Bar.java\"",
")",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"ss",
"=",
"new",
"StructuredSelection",
"(",
"file",
")",
";",
"action",
"=",
"new",
"RenameToGroovyAction",
"(",
")",
";",
"action",
".",
"selectionChanged",
"(",
"null",
",",
"ss",
")",
";",
"action",
".",
"run",
"(",
"null",
")",
";",
"waitForJobAndRefresh",
"(",
"file",
")",
";",
"assertFalse",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"file",
"=",
"file",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"Bar.groovy\"",
")",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"}",
"private",
"void",
"waitForJobAndRefresh",
"(",
"IResource",
"file",
")",
"throws",
"InterruptedException",
",",
"CoreException",
"{",
"Job",
".",
"getJobManager",
"(",
")",
".",
"join",
"(",
"RenameToGroovyOrJavaAction",
".",
"class",
",",
"null",
")",
";",
"file",
".",
"getParent",
"(",
")",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"null",
")",
";",
"}",
"}",
"</s>"
] |
6,059 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"DelegatingCleanUpPostSaveListener",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPostSaveListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"IPostSaveListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"SaveParticipantRegistry",
";",
"public",
"class",
"SaveParticipantRegistryTest",
"extends",
"EclipseTestCase",
"{",
"public",
"void",
"testInstallUninstallPostSaveCleanUp",
"(",
")",
"throws",
"Exception",
"{",
"SaveParticipantRegistry",
"registry",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getSaveParticipantRegistry",
"(",
")",
";",
"IPostSaveListener",
"listener",
"=",
"registry",
".",
"getSaveParticipantDescriptor",
"(",
"CleanUpPostSaveListener",
".",
"POSTSAVELISTENER_ID",
")",
".",
"getPostSaveListener",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"listener",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
"+",
"\"\"",
",",
"listener",
"instanceof",
"DelegatingCleanUpPostSaveListener",
")",
";",
"try",
"{",
"DelegatingCleanUpPostSaveListener",
".",
"installCleanUp",
"(",
")",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"DelegatingCleanUpPostSaveListener",
".",
"uninstallCleanUp",
"(",
")",
";",
"listener",
"=",
"registry",
".",
"getSaveParticipantDescriptor",
"(",
"CleanUpPostSaveListener",
".",
"POSTSAVELISTENER_ID",
")",
".",
"getPostSaveListener",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"listener",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
"+",
"\"\"",
",",
"listener",
"instanceof",
"CleanUpPostSaveListener",
")",
";",
"DelegatingCleanUpPostSaveListener",
".",
"installCleanUp",
"(",
")",
";",
"listener",
"=",
"registry",
".",
"getSaveParticipantDescriptor",
"(",
"CleanUpPostSaveListener",
".",
"POSTSAVELISTENER_ID",
")",
".",
"getPostSaveListener",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"listener",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
"+",
"\"\"",
",",
"listener",
"instanceof",
"DelegatingCleanUpPostSaveListener",
")",
";",
"}",
"}",
"</s>"
] |
6,060 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
".",
"AddGroovyNatureAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
".",
"RemoveGroovyNatureAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"ConvertLegacyProject",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ICommand",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"StructuredSelection",
";",
"public",
"class",
"GroovyNatureActionTestCase",
"extends",
"EclipseTestCase",
"{",
"private",
"AddGroovyNatureAction",
"addGroovyAction",
";",
"private",
"RemoveGroovyNatureAction",
"removeGroovyAction",
";",
"private",
"ConvertLegacyProject",
"convert",
";",
"@",
"Override",
"public",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"GroovyRuntime",
".",
"removeGroovyNature",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"addGroovyAction",
"=",
"new",
"AddGroovyNatureAction",
"(",
")",
";",
"removeGroovyAction",
"=",
"new",
"RemoveGroovyNatureAction",
"(",
")",
";",
"removeGroovyAction",
".",
"doNotAskToRemoveJars",
"(",
")",
";",
"convert",
"=",
"new",
"ConvertLegacyProject",
"(",
")",
";",
"}",
"public",
"void",
"testAddGroovyNature",
"(",
")",
"throws",
"Exception",
"{",
"assertTrue",
"(",
"\"\"",
",",
"testProject",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
")",
";",
"IStructuredSelection",
"selection",
"=",
"new",
"StructuredSelection",
"(",
"new",
"Object",
"[",
"]",
"{",
"testProject",
".",
"getJavaProject",
"(",
")",
"}",
")",
";",
"addGroovyAction",
".",
"selectionChanged",
"(",
"null",
",",
"selection",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"addGroovyAction",
".",
"run",
"(",
"null",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyJars",
"(",
")",
")",
";",
"addGroovyAction",
".",
"run",
"(",
"null",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyJars",
"(",
")",
")",
";",
"}",
"public",
"void",
"testGroovyNatureNotJavaProject",
"(",
")",
"throws",
"CoreException",
"{",
"testProject",
".",
"removeNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
";",
"assertFalse",
"(",
"testProject",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
")",
";",
"IStructuredSelection",
"selection",
"=",
"new",
"StructuredSelection",
"(",
"new",
"Object",
"[",
"]",
"{",
"testProject",
".",
"getProject",
"(",
")",
"}",
")",
";",
"addGroovyAction",
".",
"selectionChanged",
"(",
"null",
",",
"selection",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"try",
"{",
"addGroovyAction",
".",
"run",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"}",
"public",
"void",
"testRemoveGroovyNature",
"(",
")",
"throws",
"Exception",
"{",
"assertTrue",
"(",
"\"\"",
",",
"testProject",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
")",
";",
"IStructuredSelection",
"selection",
"=",
"new",
"StructuredSelection",
"(",
"new",
"Object",
"[",
"]",
"{",
"testProject",
".",
"getJavaProject",
"(",
")",
"}",
")",
";",
"addGroovyAction",
".",
"selectionChanged",
"(",
"null",
",",
"selection",
")",
";",
"removeGroovyAction",
".",
"selectionChanged",
"(",
"null",
",",
"selection",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyJars",
"(",
")",
")",
";",
"removeGroovyAction",
".",
"run",
"(",
"null",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyJars",
"(",
")",
")",
";",
"addGroovyAction",
".",
"run",
"(",
"null",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyJars",
"(",
")",
")",
";",
"removeGroovyAction",
".",
"run",
"(",
"null",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasGroovyJars",
"(",
")",
")",
";",
"}",
"public",
"void",
"testConvertLegacyAction",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addBuilder",
"(",
"ConvertLegacyProject",
".",
"OLD_BUILDER",
")",
";",
"convert",
".",
"convertProject",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasGroovyNature",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasOldGroovyNature",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hasBuilder",
"(",
"JavaCore",
".",
"BUILDER_ID",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"hasBuilder",
"(",
"ConvertLegacyProject",
".",
"OLD_BUILDER",
")",
")",
";",
"}",
"protected",
"boolean",
"hasOldGroovyNature",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"testProject",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"ConvertLegacyProject",
".",
"OLD_NATURE",
")",
";",
"}",
"protected",
"boolean",
"hasBuilder",
"(",
"String",
"builderId",
")",
"throws",
"CoreException",
"{",
"IProjectDescription",
"desc",
"=",
"testProject",
".",
"getProject",
"(",
")",
".",
"getDescription",
"(",
")",
";",
"ICommand",
"[",
"]",
"commands",
"=",
"desc",
".",
"getBuildSpec",
"(",
")",
";",
"for",
"(",
"ICommand",
"command",
":",
"commands",
")",
"{",
"if",
"(",
"command",
".",
"getBuilderName",
"(",
")",
".",
"equals",
"(",
"builderId",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasGroovyJars",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"GroovyRuntime",
".",
"hasGroovyClasspathContainer",
"(",
"testProject",
".",
"getJavaProject",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,061 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"IJobManager",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWTException",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindow",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"public",
"class",
"SynchronizationUtils",
"{",
"public",
"static",
"void",
"joinBackgroudActivities",
"(",
")",
"{",
"boolean",
"interrupted",
"=",
"true",
";",
"while",
"(",
"interrupted",
")",
"{",
"try",
"{",
"Job",
".",
"getJobManager",
"(",
")",
".",
"join",
"(",
"ResourcesPlugin",
".",
"FAMILY_AUTO_BUILD",
",",
"null",
")",
";",
"interrupted",
"=",
"false",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"interrupted",
"=",
"true",
";",
"}",
"}",
"boolean",
"wasInterrupted",
"=",
"false",
";",
"do",
"{",
"try",
"{",
"Job",
".",
"getJobManager",
"(",
")",
".",
"join",
"(",
"ResourcesPlugin",
".",
"FAMILY_MANUAL_BUILD",
",",
"null",
")",
";",
"wasInterrupted",
"=",
"false",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"while",
"(",
"wasInterrupted",
")",
";",
"joinJobs",
"(",
"100",
",",
"500",
",",
"500",
")",
";",
"}",
"private",
"static",
"boolean",
"joinJobs",
"(",
"long",
"minTime",
",",
"long",
"maxTime",
",",
"long",
"intervalTime",
")",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"minTime",
";",
"runEventQueue",
"(",
")",
";",
"while",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"<",
"startTime",
")",
"runEventQueue",
"(",
"intervalTime",
")",
";",
"long",
"endTime",
"=",
"maxTime",
">",
"0",
"&&",
"maxTime",
"<",
"Long",
".",
"MAX_VALUE",
"?",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"maxTime",
":",
"Long",
".",
"MAX_VALUE",
";",
"boolean",
"calm",
"=",
"allJobsQuiet",
"(",
")",
";",
"while",
"(",
"!",
"calm",
"&&",
"System",
".",
"currentTimeMillis",
"(",
")",
"<",
"endTime",
")",
"{",
"runEventQueue",
"(",
"intervalTime",
")",
";",
"calm",
"=",
"allJobsQuiet",
"(",
")",
";",
"}",
"return",
"calm",
";",
"}",
"private",
"static",
"void",
"sleep",
"(",
"int",
"intervalTime",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"intervalTime",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"private",
"static",
"boolean",
"allJobsQuiet",
"(",
")",
"{",
"IJobManager",
"jobManager",
"=",
"Job",
".",
"getJobManager",
"(",
")",
";",
"Job",
"[",
"]",
"jobs",
"=",
"jobManager",
".",
"find",
"(",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jobs",
".",
"length",
";",
"i",
"++",
")",
"{",
"Job",
"job",
"=",
"jobs",
"[",
"i",
"]",
";",
"int",
"state",
"=",
"job",
".",
"getState",
"(",
")",
";",
"if",
"(",
"!",
"job",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"!",
"job",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"(",
"state",
"==",
"Job",
".",
"RUNNING",
"||",
"state",
"==",
"Job",
".",
"WAITING",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"private",
"static",
"void",
"runEventQueue",
"(",
")",
"{",
"IWorkbenchWindow",
"window",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
";",
"if",
"(",
"window",
"!=",
"null",
")",
"runEventQueue",
"(",
"window",
".",
"getShell",
"(",
")",
")",
";",
"}",
"private",
"static",
"void",
"runEventQueue",
"(",
"Shell",
"shell",
")",
"{",
"try",
"{",
"while",
"(",
"shell",
".",
"getDisplay",
"(",
")",
".",
"readAndDispatch",
"(",
")",
")",
"{",
"}",
"}",
"catch",
"(",
"SWTException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"e",
")",
";",
"}",
"}",
"private",
"static",
"void",
"runEventQueue",
"(",
"long",
"minTime",
")",
"{",
"long",
"nextCheck",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"minTime",
";",
"while",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"<",
"nextCheck",
")",
"{",
"runEventQueue",
"(",
")",
";",
"sleep",
"(",
"1",
")",
";",
"}",
"}",
"public",
"static",
"void",
"printJobs",
"(",
")",
"{",
"IJobManager",
"jobManager",
"=",
"Job",
".",
"getJobManager",
"(",
")",
";",
"Job",
"[",
"]",
"jobs",
"=",
"jobManager",
".",
"find",
"(",
"null",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jobs",
".",
"length",
";",
"i",
"++",
")",
"{",
"Job",
"job",
"=",
"jobs",
"[",
"i",
"]",
";",
"int",
"state",
"=",
"job",
".",
"getState",
"(",
")",
";",
"if",
"(",
"!",
"job",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"!",
"job",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"(",
"state",
"==",
"Job",
".",
"RUNNING",
"||",
"state",
"==",
"Job",
".",
"WAITING",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"job",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"static",
"void",
"waitForIndexingToComplete",
"(",
")",
"{",
"try",
"{",
"performDummySearch",
"(",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e1",
")",
"{",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"}",
"SynchronizationUtils",
".",
"joinBackgroudActivities",
"(",
")",
";",
"Job",
"[",
"]",
"jobs",
"=",
"Job",
".",
"getJobManager",
"(",
")",
".",
"find",
"(",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jobs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"jobs",
"[",
"i",
"]",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"\"",
")",
")",
"{",
"boolean",
"wasInterrupted",
"=",
"true",
";",
"while",
"(",
"wasInterrupted",
")",
"{",
"try",
"{",
"wasInterrupted",
"=",
"false",
";",
"jobs",
"[",
"i",
"]",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"protected",
"static",
"class",
"Requestor",
"extends",
"TypeNameRequestor",
"{",
"}",
"private",
"static",
"void",
"performDummySearch",
"(",
"IJavaElement",
"element",
")",
"throws",
"CoreException",
"{",
"new",
"SearchEngine",
"(",
")",
".",
"searchAllTypeNames",
"(",
"null",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"\"XXXXXXXXX\"",
".",
"toCharArray",
"(",
")",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"IJavaSearchConstants",
".",
"CLASS",
",",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
")",
",",
"new",
"Requestor",
"(",
")",
",",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"null",
")",
";",
"}",
"public",
"static",
"void",
"waitForRefactoringToComplete",
"(",
")",
"{",
"SynchronizationUtils",
".",
"joinBackgroudActivities",
"(",
")",
";",
"Job",
"[",
"]",
"jobs",
"=",
"Job",
".",
"getJobManager",
"(",
")",
".",
"find",
"(",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jobs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"jobs",
"[",
"i",
"]",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"\"",
")",
")",
"{",
"boolean",
"wasInterrupted",
"=",
"true",
";",
"while",
"(",
"wasInterrupted",
")",
"{",
"try",
"{",
"wasInterrupted",
"=",
"false",
";",
"jobs",
"[",
"i",
"]",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"public",
"static",
"void",
"waitForDSLDProcessingToComplete",
"(",
")",
"{",
"SynchronizationUtils",
".",
"joinBackgroudActivities",
"(",
")",
";",
"Job",
"[",
"]",
"jobs",
"=",
"Job",
".",
"getJobManager",
"(",
")",
".",
"find",
"(",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jobs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"jobs",
"[",
"i",
"]",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"\"",
")",
")",
"{",
"boolean",
"wasInterrupted",
"=",
"true",
";",
"while",
"(",
"wasInterrupted",
")",
"{",
"try",
"{",
"wasInterrupted",
"=",
"false",
";",
"jobs",
"[",
"i",
"]",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"</s>"
] |
6,062 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"plugin",
".",
"AbstractUIPlugin",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Bundle",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"BundleContext",
";",
"public",
"class",
"Activator",
"extends",
"AbstractUIPlugin",
"{",
"public",
"static",
"final",
"String",
"PLUGIN_ID",
"=",
"\"\"",
";",
"private",
"static",
"Activator",
"plugin",
";",
"public",
"Activator",
"(",
")",
"{",
"plugin",
"=",
"this",
";",
"}",
"@",
"Override",
"public",
"void",
"start",
"(",
"final",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"plugin",
"=",
"this",
";",
"super",
".",
"start",
"(",
"context",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"stop",
"(",
"final",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"plugin",
"=",
"null",
";",
"super",
".",
"stop",
"(",
"context",
")",
";",
"}",
"public",
"static",
"Activator",
"getDefault",
"(",
")",
"{",
"return",
"plugin",
";",
"}",
"public",
"static",
"Bundle",
"bundle",
"(",
")",
"{",
"return",
"getDefault",
"(",
")",
".",
"getBundle",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,063 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IncrementalProjectBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"public",
"abstract",
"class",
"EclipseTestCase",
"extends",
"TestCase",
"{",
"protected",
"TestProject",
"testProject",
";",
"protected",
"IPackageFragment",
"pack",
";",
"protected",
"GroovyCoreActivator",
"plugin",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"testProject",
"=",
"new",
"TestProject",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"dispose",
"(",
")",
";",
"}",
"public",
"EclipseTestCase",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"public",
"EclipseTestCase",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"protected",
"boolean",
"hasGroovyNature",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"testProject",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"GroovyNature",
".",
"GROOVY_NATURE",
")",
";",
"}",
"protected",
"void",
"fullProjectBuild",
"(",
")",
"throws",
"Exception",
"{",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"}",
"protected",
"void",
"waitForIndexes",
"(",
")",
"{",
"SynchronizationUtils",
".",
"waitForIndexingToComplete",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,064 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
".",
"AliasingOrganizeImportsTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
".",
"ConvertToJavaOrGroovyActionTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
".",
"GroovyNatureActionTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
".",
"OrganizeImportsTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"actions",
".",
"SaveParticipantRegistryTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"adapters",
".",
"GroovyFileAdapterFactoryTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"adapters",
".",
"GroovyIFileEditorInputAdapterFactoryTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"adapters",
".",
"IsMainTesterTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"core",
".",
"util",
".",
"ExpressionFinderTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
".",
"BreakpointLocationTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
".",
"ConsoleLineTrackerTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
".",
"DebugBreakpointsTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"debug",
".",
"GroovyLauncherShortcutTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"BracketInserterTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"ErrorLogTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"GroovyAutoIndenterTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"GroovyAutoIndenterTests2",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"GroovyTagScannerTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"ui",
".",
"HighlightingExtenderTests",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"wizards",
".",
"NewGroovyTestCaseWizardTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"wizards",
".",
"NewGroovyTypeWizardTest",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"search",
".",
"FindOccurrencesTests",
";",
"public",
"class",
"AllUITests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"final",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"AllUITests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyAutoIndenterTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyAutoIndenterTests2",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ErrorLogTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyLauncherShortcutTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyNatureActionTestCase",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyFileAdapterFactoryTestCase",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyIFileEditorInputAdapterFactoryTestCase",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"IsMainTesterTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ExpressionFinderTestCase",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GroovyTagScannerTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"DebugBreakpointsTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"BreakpointLocationTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"OrganizeImportsTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"AliasingOrganizeImportsTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"SaveParticipantRegistryTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ConvertToJavaOrGroovyActionTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"ConsoleLineTrackerTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"HighlightingExtenderTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"BracketInserterTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"NewGroovyTypeWizardTest",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"NewGroovyTestCaseWizardTest",
".",
"class",
")",
";",
"suite",
".",
"addTest",
"(",
"FindOccurrencesTests",
".",
"suite",
"(",
")",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
6,065 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
".",
"CLASS",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
".",
"createJavaSearchScope",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
".",
"R_CASE_SENSITIVE",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
".",
"R_EXACT_MATCH",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
";",
"import",
"junit",
".",
"framework",
".",
"Assert",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"IOUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"GroovyClasspathContainer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyProjectFacade",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"internal",
".",
"events",
".",
"BuildCommand",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ICommand",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"DefaultWorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"launching",
".",
"JavaRuntime",
";",
"public",
"class",
"TestProject",
"{",
"public",
"static",
"final",
"String",
"TEST_PROJECT_NAME",
"=",
"\"TestProject\"",
";",
"private",
"final",
"IProject",
"project",
";",
"private",
"final",
"IJavaProject",
"javaProject",
";",
"private",
"IPackageFragmentRoot",
"sourceFolder",
";",
"public",
"TestProject",
"(",
"String",
"name",
")",
"throws",
"CoreException",
"{",
"IWorkspaceRoot",
"root",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"project",
"=",
"root",
".",
"getProject",
"(",
"name",
")",
";",
"if",
"(",
"!",
"project",
".",
"exists",
"(",
")",
")",
"{",
"project",
".",
"create",
"(",
"null",
")",
";",
"project",
".",
"open",
"(",
"null",
")",
";",
"}",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"IFolder",
"binFolder",
"=",
"createBinFolder",
"(",
")",
";",
"setJavaNature",
"(",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"new",
"IClasspathEntry",
"[",
"0",
"]",
",",
"null",
")",
";",
"createOutputFolder",
"(",
"binFolder",
")",
";",
"sourceFolder",
"=",
"createSourceFolder",
"(",
")",
";",
"addSystemLibraries",
"(",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_Compliance",
",",
"\"1.5\"",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_Source",
",",
"\"1.5\"",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_TargetPlatform",
",",
"\"1.5\"",
")",
";",
"}",
"public",
"TestProject",
"(",
")",
"throws",
"CoreException",
"{",
"this",
"(",
"TEST_PROJECT_NAME",
")",
";",
"}",
"public",
"IProject",
"getProject",
"(",
")",
"{",
"return",
"project",
";",
"}",
"public",
"IJavaProject",
"getJavaProject",
"(",
")",
"{",
"return",
"javaProject",
";",
"}",
"public",
"GroovyProjectFacade",
"getGroovyProjectFacade",
"(",
")",
"{",
"return",
"new",
"GroovyProjectFacade",
"(",
"javaProject",
")",
";",
"}",
"public",
"boolean",
"hasGroovyContainer",
"(",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"entries",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"entries",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_CONTAINER",
"&&",
"entries",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"GroovyClasspathContainer",
".",
"CONTAINER_ID",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"IPackageFragment",
"createPackage",
"(",
"String",
"name",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"sourceFolder",
"==",
"null",
")",
"sourceFolder",
"=",
"createSourceFolder",
"(",
")",
";",
"return",
"sourceFolder",
".",
"createPackageFragment",
"(",
"name",
",",
"false",
",",
"null",
")",
";",
"}",
"public",
"void",
"deletePackage",
"(",
"String",
"name",
")",
"throws",
"CoreException",
"{",
"sourceFolder",
".",
"getPackageFragment",
"(",
"name",
")",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"public",
"IType",
"createJavaType",
"(",
"IPackageFragment",
"pack",
",",
"String",
"cuName",
",",
"String",
"source",
")",
"throws",
"JavaModelException",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"!",
"pack",
".",
"isDefaultPackage",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"package",
"\"",
"+",
"pack",
".",
"getElementName",
"(",
")",
"+",
"\";\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
";",
"}",
"buf",
".",
"append",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
";",
"buf",
".",
"append",
"(",
"source",
")",
";",
"ICompilationUnit",
"cu",
"=",
"pack",
".",
"createCompilationUnit",
"(",
"cuName",
",",
"buf",
".",
"toString",
"(",
")",
",",
"false",
",",
"null",
")",
";",
"return",
"cu",
".",
"getTypes",
"(",
")",
"[",
"0",
"]",
";",
"}",
"public",
"IType",
"createJavaTypeAndPackage",
"(",
"String",
"packageName",
",",
"String",
"fileName",
",",
"String",
"source",
")",
"throws",
"CoreException",
"{",
"return",
"createJavaType",
"(",
"createPackage",
"(",
"packageName",
")",
",",
"fileName",
",",
"source",
")",
";",
"}",
"public",
"IFile",
"createGroovyTypeAndPackage",
"(",
"String",
"packageName",
",",
"String",
"fileName",
",",
"InputStream",
"source",
")",
"throws",
"CoreException",
",",
"IOException",
"{",
"return",
"createGroovyType",
"(",
"createPackage",
"(",
"packageName",
")",
",",
"fileName",
",",
"IOUtils",
".",
"toString",
"(",
"source",
")",
")",
";",
"}",
"public",
"IFile",
"createGroovyTypeAndPackage",
"(",
"String",
"packageName",
",",
"String",
"fileName",
",",
"String",
"source",
")",
"throws",
"CoreException",
"{",
"return",
"createGroovyType",
"(",
"createPackage",
"(",
"packageName",
")",
",",
"fileName",
",",
"source",
")",
";",
"}",
"public",
"IFile",
"createGroovyType",
"(",
"IPackageFragment",
"pack",
",",
"String",
"cuName",
",",
"String",
"source",
")",
"throws",
"CoreException",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"!",
"pack",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"package",
"\"",
"+",
"pack",
".",
"getElementName",
"(",
")",
"+",
"\";\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
";",
"buf",
".",
"append",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
";",
"}",
"buf",
".",
"append",
"(",
"source",
")",
";",
"IContainer",
"folder",
"=",
"(",
"IContainer",
")",
"pack",
".",
"getResource",
"(",
")",
";",
"String",
"encoding",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_ENCODING",
",",
"true",
")",
";",
"InputStream",
"stream",
";",
"try",
"{",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"encoding",
"==",
"null",
"?",
"buf",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
":",
"buf",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
"encoding",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"\"\"",
",",
"IStatus",
".",
"ERROR",
",",
"\"\"",
",",
"e",
")",
")",
";",
"}",
"return",
"createFile",
"(",
"folder",
",",
"cuName",
",",
"stream",
")",
";",
"}",
"public",
"void",
"removeNature",
"(",
"String",
"natureId",
")",
"throws",
"CoreException",
"{",
"final",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"final",
"String",
"[",
"]",
"ids",
"=",
"description",
".",
"getNatureIds",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ids",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"ids",
"[",
"i",
"]",
".",
"equals",
"(",
"natureId",
")",
")",
"{",
"final",
"String",
"[",
"]",
"newIds",
"=",
"remove",
"(",
"ids",
",",
"i",
")",
";",
"description",
".",
"setNatureIds",
"(",
"newIds",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"return",
";",
"}",
"}",
"}",
"private",
"String",
"[",
"]",
"remove",
"(",
"String",
"[",
"]",
"ids",
",",
"int",
"index",
")",
"{",
"String",
"[",
"]",
"newIds",
"=",
"new",
"String",
"[",
"ids",
".",
"length",
"-",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"i",
"<",
"ids",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"index",
")",
"{",
"newIds",
"[",
"j",
"]",
"=",
"ids",
"[",
"i",
"]",
";",
"j",
"++",
";",
"}",
"}",
"return",
"newIds",
";",
"}",
"public",
"void",
"addBuilder",
"(",
"String",
"newBuilder",
")",
"throws",
"CoreException",
"{",
"final",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"ICommand",
"[",
"]",
"commands",
"=",
"description",
".",
"getBuildSpec",
"(",
")",
";",
"ICommand",
"newCommand",
"=",
"new",
"BuildCommand",
"(",
")",
";",
"newCommand",
".",
"setBuilderName",
"(",
"newBuilder",
")",
";",
"ICommand",
"[",
"]",
"newCommands",
"=",
"new",
"ICommand",
"[",
"commands",
".",
"length",
"+",
"1",
"]",
";",
"newCommands",
"[",
"0",
"]",
"=",
"newCommand",
";",
"System",
".",
"arraycopy",
"(",
"commands",
",",
"0",
",",
"newCommands",
",",
"1",
",",
"commands",
".",
"length",
")",
";",
"description",
".",
"setBuildSpec",
"(",
"newCommands",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"public",
"void",
"addNature",
"(",
"String",
"natureId",
")",
"throws",
"CoreException",
"{",
"final",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"final",
"String",
"[",
"]",
"ids",
"=",
"description",
".",
"getNatureIds",
"(",
")",
";",
"final",
"String",
"[",
"]",
"newIds",
"=",
"new",
"String",
"[",
"ids",
".",
"length",
"+",
"1",
"]",
";",
"newIds",
"[",
"0",
"]",
"=",
"natureId",
";",
"System",
".",
"arraycopy",
"(",
"ids",
",",
"0",
",",
"newIds",
",",
"1",
",",
"ids",
".",
"length",
")",
";",
"description",
".",
"setNatureIds",
"(",
"newIds",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"private",
"IFile",
"createFile",
"(",
"IContainer",
"folder",
",",
"String",
"name",
",",
"InputStream",
"contents",
")",
"throws",
"JavaModelException",
"{",
"IFile",
"file",
"=",
"folder",
".",
"getFile",
"(",
"new",
"Path",
"(",
"name",
")",
")",
";",
"try",
"{",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"file",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"file",
".",
"create",
"(",
"contents",
",",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"return",
"file",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"throws",
"CoreException",
"{",
"deleteWorkingCopies",
"(",
")",
";",
"project",
".",
"delete",
"(",
"true",
",",
"true",
",",
"null",
")",
";",
"}",
"public",
"void",
"deleteContents",
"(",
")",
"throws",
"CoreException",
"{",
"deleteWorkingCopies",
"(",
")",
";",
"IPackageFragment",
"[",
"]",
"frags",
"=",
"javaProject",
".",
"getPackageFragments",
"(",
")",
";",
"for",
"(",
"IPackageFragment",
"frag",
":",
"frags",
")",
"{",
"if",
"(",
"!",
"frag",
".",
"isReadOnly",
"(",
")",
")",
"{",
"frag",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"}",
"}",
"private",
"void",
"deleteWorkingCopies",
"(",
")",
"throws",
"JavaModelException",
"{",
"waitForIndexer",
"(",
")",
";",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"true",
")",
";",
"if",
"(",
"workingCopies",
"!=",
"null",
")",
"{",
"for",
"(",
"ICompilationUnit",
"workingCopy",
":",
"workingCopies",
")",
"{",
"if",
"(",
"workingCopy",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"workingCopy",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"}",
"}",
"System",
".",
"gc",
"(",
")",
";",
"}",
"private",
"IFolder",
"createBinFolder",
"(",
")",
"throws",
"CoreException",
"{",
"final",
"IFolder",
"binFolder",
"=",
"project",
".",
"getFolder",
"(",
"\"bin\"",
")",
";",
"if",
"(",
"!",
"binFolder",
".",
"exists",
"(",
")",
")",
"ensureExists",
"(",
"binFolder",
")",
";",
"return",
"binFolder",
";",
"}",
"private",
"void",
"setJavaNature",
"(",
")",
"throws",
"CoreException",
"{",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"description",
".",
"setNatureIds",
"(",
"new",
"String",
"[",
"]",
"{",
"JavaCore",
".",
"NATURE_ID",
"}",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"private",
"void",
"createOutputFolder",
"(",
"IFolder",
"binFolder",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"outputLocation",
"=",
"binFolder",
".",
"getFullPath",
"(",
")",
";",
"javaProject",
".",
"setOutputLocation",
"(",
"outputLocation",
",",
"null",
")",
";",
"}",
"private",
"IPackageFragmentRoot",
"createSourceFolder",
"(",
")",
"throws",
"CoreException",
"{",
"IFolder",
"folder",
"=",
"project",
".",
"getFolder",
"(",
"\"src\"",
")",
";",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"ensureExists",
"(",
"folder",
")",
";",
"final",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"javaProject",
".",
"getResolvedClasspath",
"(",
"false",
")",
";",
"final",
"IPackageFragmentRoot",
"root",
"=",
"javaProject",
".",
"getPackageFragmentRoot",
"(",
"folder",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"entries",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"IClasspathEntry",
"entry",
"=",
"entries",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"folder",
".",
"getFullPath",
"(",
")",
")",
")",
"return",
"root",
";",
"}",
"IClasspathEntry",
"[",
"]",
"oldEntries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newEntries",
"=",
"new",
"IClasspathEntry",
"[",
"oldEntries",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"0",
",",
"newEntries",
",",
"0",
",",
"oldEntries",
".",
"length",
")",
";",
"newEntries",
"[",
"oldEntries",
".",
"length",
"]",
"=",
"JavaCore",
".",
"newSourceEntry",
"(",
"root",
".",
"getPath",
"(",
")",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"newEntries",
",",
"null",
")",
";",
"return",
"root",
";",
"}",
"public",
"IPackageFragmentRoot",
"createOtherSourceFolder",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"createOtherSourceFolder",
"(",
"null",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"createOtherSourceFolder",
"(",
"String",
"outPath",
")",
"throws",
"CoreException",
"{",
"return",
"createSourceFolder",
"(",
"\"other\"",
",",
"outPath",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"createSourceFolder",
"(",
"String",
"path",
",",
"String",
"outPath",
")",
"throws",
"CoreException",
"{",
"return",
"createSourceFolder",
"(",
"path",
",",
"outPath",
",",
"null",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"createSourceFolder",
"(",
"String",
"path",
",",
"String",
"outPath",
",",
"IPath",
"[",
"]",
"exclusionPattern",
")",
"throws",
"CoreException",
"{",
"IFolder",
"folder",
"=",
"project",
".",
"getFolder",
"(",
"path",
")",
";",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"ensureExists",
"(",
"folder",
")",
";",
"}",
"final",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"javaProject",
".",
"getResolvedClasspath",
"(",
"false",
")",
";",
"final",
"IPackageFragmentRoot",
"root",
"=",
"javaProject",
".",
"getPackageFragmentRoot",
"(",
"folder",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"entries",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"IClasspathEntry",
"entry",
"=",
"entries",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"folder",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"return",
"root",
";",
"}",
"}",
"IClasspathEntry",
"[",
"]",
"oldEntries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newEntries",
"=",
"new",
"IClasspathEntry",
"[",
"oldEntries",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"0",
",",
"newEntries",
",",
"0",
",",
"oldEntries",
".",
"length",
")",
";",
"IPath",
"outPathPath",
"=",
"outPath",
"==",
"null",
"?",
"null",
":",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"outPath",
")",
".",
"makeAbsolute",
"(",
")",
";",
"newEntries",
"[",
"oldEntries",
".",
"length",
"]",
"=",
"JavaCore",
".",
"newSourceEntry",
"(",
"root",
".",
"getPath",
"(",
")",
",",
"exclusionPattern",
",",
"outPathPath",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"newEntries",
",",
"null",
")",
";",
"return",
"root",
";",
"}",
"private",
"void",
"ensureExists",
"(",
"IFolder",
"folder",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"folder",
".",
"getParent",
"(",
")",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
"&&",
"!",
"folder",
".",
"getParent",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"ensureExists",
"(",
"(",
"IFolder",
")",
"folder",
".",
"getParent",
"(",
")",
")",
";",
"}",
"folder",
".",
"create",
"(",
"false",
",",
"true",
",",
"null",
")",
";",
"}",
"public",
"void",
"addProjectReference",
"(",
"IJavaProject",
"referent",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"oldEntries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newEntries",
"=",
"new",
"IClasspathEntry",
"[",
"oldEntries",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"0",
",",
"newEntries",
",",
"0",
",",
"oldEntries",
".",
"length",
")",
";",
"newEntries",
"[",
"oldEntries",
".",
"length",
"]",
"=",
"JavaCore",
".",
"newProjectEntry",
"(",
"referent",
".",
"getPath",
"(",
")",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"newEntries",
",",
"null",
")",
";",
"}",
"public",
"void",
"addJarFileToClasspath",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"oldEntries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newEntries",
"=",
"new",
"IClasspathEntry",
"[",
"oldEntries",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"0",
",",
"newEntries",
",",
"0",
",",
"oldEntries",
".",
"length",
")",
";",
"newEntries",
"[",
"oldEntries",
".",
"length",
"]",
"=",
"JavaCore",
".",
"newLibraryEntry",
"(",
"path",
",",
"null",
",",
"null",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"newEntries",
",",
"null",
")",
";",
"}",
"private",
"void",
"addSystemLibraries",
"(",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"oldEntries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newEntries",
"=",
"new",
"IClasspathEntry",
"[",
"oldEntries",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"0",
",",
"newEntries",
",",
"0",
",",
"oldEntries",
".",
"length",
")",
";",
"newEntries",
"[",
"oldEntries",
".",
"length",
"]",
"=",
"JavaRuntime",
".",
"getDefaultJREContainerEntry",
"(",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"newEntries",
",",
"null",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"waitForIndexer",
"(",
")",
"throws",
"JavaModelException",
"{",
"final",
"TypeNameRequestor",
"requestor",
"=",
"new",
"TypeNameRequestor",
"(",
")",
"{",
"}",
";",
"new",
"SearchEngine",
"(",
")",
".",
"searchAllTypeNames",
"(",
"null",
",",
"null",
",",
"R_EXACT_MATCH",
"|",
"R_CASE_SENSITIVE",
",",
"CLASS",
",",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"0",
"]",
")",
",",
"requestor",
",",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"null",
")",
";",
"}",
"protected",
"void",
"fullBuild",
"(",
")",
"throws",
"CoreException",
"{",
"this",
".",
"getProject",
"(",
")",
".",
"build",
"(",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"}",
"public",
"String",
"getProblems",
"(",
")",
"throws",
"CoreException",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"getProject",
"(",
")",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"markers",
"==",
"null",
"||",
"markers",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"boolean",
"errorFound",
"=",
"false",
";",
"sb",
".",
"append",
"(",
"\"Problems:n\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"(",
"Integer",
")",
"markers",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"IMarker",
".",
"SEVERITY",
")",
")",
".",
"intValue",
"(",
")",
"==",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"{",
"sb",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"sb",
".",
"append",
"(",
"markers",
"[",
"i",
"]",
".",
"getResource",
"(",
")",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\"",
":",
"\"",
")",
";",
"sb",
".",
"append",
"(",
"markers",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"IMarker",
".",
"LOCATION",
")",
")",
".",
"append",
"(",
"\"",
":",
"\"",
")",
";",
"sb",
".",
"append",
"(",
"markers",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
")",
".",
"append",
"(",
"\"n\"",
")",
";",
"errorFound",
"=",
"true",
";",
"}",
"}",
"return",
"errorFound",
"?",
"sb",
".",
"toString",
"(",
")",
":",
"null",
";",
"}",
"public",
"IFile",
"createFile",
"(",
"String",
"name",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"String",
"encoding",
"=",
"null",
";",
"try",
"{",
"encoding",
"=",
"project",
".",
"getDefaultCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"InputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"encoding",
"==",
"null",
"?",
"contents",
".",
"getBytes",
"(",
")",
":",
"contents",
".",
"getBytes",
"(",
"encoding",
")",
")",
";",
"IFile",
"file",
"=",
"project",
".",
"getFile",
"(",
"new",
"Path",
"(",
"name",
")",
")",
";",
"if",
"(",
"!",
"file",
".",
"getParent",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"createFolder",
"(",
"file",
".",
"getParent",
"(",
")",
")",
";",
"}",
"file",
".",
"create",
"(",
"stream",
",",
"true",
",",
"null",
")",
";",
"return",
"file",
";",
"}",
"private",
"void",
"createFolder",
"(",
"IContainer",
"parent",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"!",
"parent",
".",
"getParent",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"parent",
".",
"getParent",
"(",
")",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FOLDER",
")",
"{",
"Assert",
".",
"fail",
"(",
"\"\"",
"+",
"parent",
".",
"getParent",
"(",
")",
")",
";",
"}",
"createFolder",
"(",
"parent",
".",
"getParent",
"(",
")",
")",
";",
"}",
"(",
"(",
"IFolder",
")",
"parent",
")",
".",
"create",
"(",
"true",
",",
"true",
",",
"null",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"getSourceFolder",
"(",
")",
"{",
"return",
"sourceFolder",
";",
"}",
"public",
"ICompilationUnit",
"createUnit",
"(",
"String",
"pkg",
",",
"String",
"cuName",
",",
"String",
"cuContents",
")",
"throws",
"CoreException",
"{",
"IPackageFragment",
"frag",
"=",
"createPackage",
"(",
"pkg",
")",
";",
"ICompilationUnit",
"cu",
"=",
"frag",
".",
"createCompilationUnit",
"(",
"cuName",
",",
"cuContents",
",",
"false",
",",
"null",
")",
";",
"return",
"cu",
";",
"}",
"public",
"ICompilationUnit",
"[",
"]",
"createUnits",
"(",
"String",
"[",
"]",
"packages",
",",
"String",
"[",
"]",
"cuNames",
",",
"String",
"[",
"]",
"cuContents",
")",
"throws",
"CoreException",
"{",
"ICompilationUnit",
"[",
"]",
"units",
"=",
"new",
"ICompilationUnit",
"[",
"packages",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cuContents",
".",
"length",
";",
"i",
"++",
")",
"{",
"units",
"[",
"i",
"]",
"=",
"createUnit",
"(",
"packages",
"[",
"i",
"]",
",",
"cuNames",
"[",
"i",
"]",
",",
"cuContents",
"[",
"i",
"]",
")",
";",
"}",
"return",
"units",
";",
"}",
"public",
"static",
"void",
"addEntry",
"(",
"IProject",
"project",
",",
"IClasspathEntry",
"entryPath",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"getClasspath",
"(",
"project",
")",
";",
"IClasspathEntry",
"[",
"]",
"newClaspath",
"=",
"new",
"IClasspathEntry",
"[",
"classpath",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClaspath",
",",
"0",
",",
"classpath",
".",
"length",
")",
";",
"newClaspath",
"[",
"classpath",
".",
"length",
"]",
"=",
"entryPath",
";",
"setClasspath",
"(",
"project",
",",
"newClaspath",
")",
";",
"}",
"public",
"static",
"IClasspathEntry",
"[",
"]",
"getClasspath",
"(",
"IProject",
"project",
")",
"{",
"try",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"return",
"javaProject",
".",
"getExpandedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"static",
"void",
"addExternalLibrary",
"(",
"IProject",
"project",
",",
"String",
"jar",
")",
"throws",
"JavaModelException",
"{",
"addExternalLibrary",
"(",
"project",
",",
"jar",
",",
"false",
")",
";",
"}",
"public",
"static",
"void",
"addExternalLibrary",
"(",
"IProject",
"project",
",",
"String",
"jar",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"addEntry",
"(",
"project",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"new",
"Path",
"(",
"jar",
")",
",",
"null",
",",
"null",
",",
"isExported",
")",
")",
";",
"}",
"public",
"static",
"void",
"setClasspath",
"(",
"IProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"entries",
")",
"throws",
"JavaModelException",
"{",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"entries",
",",
"null",
")",
";",
"}",
"public",
"static",
"void",
"setAutoBuilding",
"(",
"boolean",
"value",
")",
"{",
"try",
"{",
"IWorkspace",
"w",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
";",
"IWorkspaceDescription",
"d",
"=",
"w",
".",
"getDescription",
"(",
")",
";",
"d",
".",
"setAutoBuilding",
"(",
"value",
")",
";",
"w",
".",
"setDescription",
"(",
"d",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"static",
"boolean",
"isAutoBuilding",
"(",
")",
"{",
"IWorkspace",
"w",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
";",
"IWorkspaceDescription",
"d",
"=",
"w",
".",
"getDescription",
"(",
")",
";",
"return",
"d",
".",
"isAutoBuilding",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,066 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"wizards",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
".",
"NewClassWizardPage",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"codemanipulation",
".",
"StubUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"template",
".",
"java",
".",
"CodeTemplateContextType",
";",
"public",
"class",
"NewGroovyTypeWizardTest",
"extends",
"AbstractNewGroovyWizardTest",
"{",
"private",
"static",
"final",
"Class",
"<",
"NewGroovyTypeWizardTest",
">",
"THIS",
"=",
"NewGroovyTypeWizardTest",
".",
"class",
";",
"public",
"NewGroovyTypeWizardTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"allTests",
"(",
")",
"{",
"return",
"new",
"TestSuite",
"(",
"THIS",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"allTests",
"(",
")",
";",
"}",
"private",
"void",
"assertEqualLines",
"(",
"String",
"expected",
",",
"String",
"actual",
")",
"{",
"assertEquals",
"(",
"expected",
".",
"replace",
"(",
"\"n\"",
",",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
",",
"actual",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"String",
"newFileTemplate",
"=",
"\"\"",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"NEWTYPE_ID",
",",
"newFileTemplate",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"TYPECOMMENT_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"FILECOMMENT_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"CONSTRUCTORCOMMENT_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"METHODCOMMENT_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"OVERRIDECOMMENT_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"METHODSTUB_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"CONSTRUCTORSTUB_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"CLASSBODY_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"INTERFACEBODY_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"ENUMBODY_ID",
",",
"\"\"",
",",
"null",
")",
";",
"StubUtility",
".",
"setCodeTemplate",
"(",
"CodeTemplateContextType",
".",
"ANNOTATIONBODY_ID",
",",
"\"\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testNotGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"GroovyRuntime",
".",
"removeGroovyNature",
"(",
"fJProject",
".",
"getProject",
"(",
")",
")",
";",
"IPackageFragment",
"frag",
"=",
"fProject",
".",
"createPackage",
"(",
"\"test1\"",
")",
";",
"NewClassWizardPage",
"wizardPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"fSourceFolder",
",",
"true",
")",
";",
"wizardPage",
".",
"setPackageFragment",
"(",
"frag",
",",
"true",
")",
";",
"assertStatus",
"(",
"IStatus",
".",
"WARNING",
",",
"\"\"",
",",
"wizardPage",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"public",
"void",
"testExclusionFilters",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragmentRoot",
"root",
"=",
"fProject",
".",
"createSourceFolder",
"(",
"\"other\"",
",",
"null",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/*.groovy\"",
")",
"}",
")",
";",
"IPackageFragment",
"frag",
"=",
"root",
".",
"createPackageFragment",
"(",
"\"p\"",
",",
"true",
",",
"null",
")",
";",
"NewClassWizardPage",
"wizardPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"root",
",",
"true",
")",
";",
"wizardPage",
".",
"setPackageFragment",
"(",
"frag",
",",
"true",
")",
";",
"wizardPage",
".",
"setTypeName",
"(",
"\"Nuthin\"",
",",
"true",
")",
";",
"assertStatus",
"(",
"IStatus",
".",
"ERROR",
",",
"\"\"",
",",
"wizardPage",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"public",
"void",
"testDiscouraedDefaultPackage",
"(",
")",
"throws",
"Exception",
"{",
"GroovyRuntime",
".",
"removeGroovyNature",
"(",
"fJProject",
".",
"getProject",
"(",
")",
")",
";",
"NewClassWizardPage",
"wizardPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"fSourceFolder",
",",
"true",
")",
";",
"assertStatus",
"(",
"IStatus",
".",
"WARNING",
",",
"\"\"",
",",
"wizardPage",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"protected",
"void",
"assertStatus",
"(",
"int",
"severity",
",",
"String",
"msgFragment",
",",
"IStatus",
"status",
")",
"{",
"assertEquals",
"(",
"severity",
",",
"status",
".",
"getSeverity",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"status",
".",
"getMessage",
"(",
")",
",",
"status",
".",
"getMessage",
"(",
")",
".",
"contains",
"(",
"msgFragment",
")",
")",
";",
"}",
"public",
"void",
"testCreateGroovyClass1",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"pack1",
"=",
"fSourceFolder",
".",
"createPackageFragment",
"(",
"\"test1\"",
",",
"false",
",",
"null",
")",
";",
"NewClassWizardPage",
"wizardPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"fSourceFolder",
",",
"true",
")",
";",
"wizardPage",
".",
"setPackageFragment",
"(",
"pack1",
",",
"true",
")",
";",
"wizardPage",
".",
"setEnclosingTypeSelection",
"(",
"false",
",",
"true",
")",
";",
"wizardPage",
".",
"setTypeName",
"(",
"\"E\"",
",",
"true",
")",
";",
"wizardPage",
".",
"setSuperClass",
"(",
"\"\"",
",",
"true",
")",
";",
"List",
"<",
"String",
">",
"interfaces",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"wizardPage",
".",
"setSuperInterfaces",
"(",
"interfaces",
",",
"true",
")",
";",
"wizardPage",
".",
"setMethodStubSelection",
"(",
"false",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"wizardPage",
".",
"setAddComments",
"(",
"true",
",",
"true",
")",
";",
"wizardPage",
".",
"enableCommentControl",
"(",
"true",
")",
";",
"wizardPage",
".",
"createType",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"String",
"actual",
"=",
"wizardPage",
".",
"getCreatedType",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
".",
"getSource",
"(",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"/**n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*",
"Filen\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*/n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"/**n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*",
"Typen\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*/n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"class",
"E",
"{n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"}n\"",
")",
";",
"String",
"expected",
"=",
"buf",
".",
"toString",
"(",
")",
";",
"assertEqualLines",
"(",
"expected",
",",
"actual",
")",
";",
"}",
"public",
"void",
"_testCreateGroovyClass2GenericSuper",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"pack1",
"=",
"fSourceFolder",
".",
"createPackageFragment",
"(",
"\"test1\"",
",",
"false",
",",
"null",
")",
";",
"NewClassWizardPage",
"wizardPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"fSourceFolder",
",",
"true",
")",
";",
"wizardPage",
".",
"setPackageFragment",
"(",
"pack1",
",",
"true",
")",
";",
"wizardPage",
".",
"setEnclosingTypeSelection",
"(",
"false",
",",
"true",
")",
";",
"wizardPage",
".",
"setTypeName",
"(",
"\"E\"",
",",
"true",
")",
";",
"wizardPage",
".",
"setSuperClass",
"(",
"\"\"",
",",
"true",
")",
";",
"List",
"<",
"String",
">",
"interfaces",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"wizardPage",
".",
"setSuperInterfaces",
"(",
"interfaces",
",",
"true",
")",
";",
"wizardPage",
".",
"setMethodStubSelection",
"(",
"false",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"wizardPage",
".",
"setAddComments",
"(",
"true",
",",
"true",
")",
";",
"wizardPage",
".",
"enableCommentControl",
"(",
"true",
")",
";",
"wizardPage",
".",
"createType",
"(",
"null",
")",
";",
"String",
"actual",
"=",
"wizardPage",
".",
"getCreatedType",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
".",
"getSource",
"(",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"/**n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*",
"Filen\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*/n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"/**n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*",
"Typen\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*/n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"}n\"",
")",
";",
"String",
"expected",
"=",
"buf",
".",
"toString",
"(",
")",
";",
"assertEqualLines",
"(",
"expected",
",",
"actual",
")",
";",
"}",
"public",
"void",
"testCreateGroovyClass2",
"(",
")",
"throws",
"Exception",
"{",
"IPackageFragment",
"pack1",
"=",
"fSourceFolder",
".",
"createPackageFragment",
"(",
"\"test1\"",
",",
"false",
",",
"null",
")",
";",
"NewClassWizardPage",
"wizardPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"fSourceFolder",
",",
"true",
")",
";",
"wizardPage",
".",
"setPackageFragment",
"(",
"pack1",
",",
"true",
")",
";",
"wizardPage",
".",
"setEnclosingTypeSelection",
"(",
"false",
",",
"true",
")",
";",
"wizardPage",
".",
"setTypeName",
"(",
"\"E\"",
",",
"true",
")",
";",
"wizardPage",
".",
"setSuperClass",
"(",
"\"ArrayList\"",
",",
"true",
")",
";",
"List",
"<",
"String",
">",
"interfaces",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"wizardPage",
".",
"setSuperInterfaces",
"(",
"interfaces",
",",
"true",
")",
";",
"wizardPage",
".",
"setMethodStubSelection",
"(",
"false",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"wizardPage",
".",
"setAddComments",
"(",
"true",
",",
"true",
")",
";",
"wizardPage",
".",
"enableCommentControl",
"(",
"true",
")",
";",
"wizardPage",
".",
"createType",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"String",
"actual",
"=",
"wizardPage",
".",
"getCreatedType",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
".",
"getSource",
"(",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"/**n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*",
"Filen\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*/n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"/**n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*",
"Typen\"",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"*/n\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"\"",
")",
";",
"buf",
".",
"append",
"(",
"\"}n\"",
")",
";",
"String",
"expected",
"=",
"buf",
".",
"toString",
"(",
")",
";",
"assertEqualLines",
"(",
"expected",
",",
"actual",
")",
";",
"}",
"}",
"</s>"
] |
6,067 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"wizards",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
".",
"NewGroovyTestTypeWizardPage",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageTwo",
";",
"public",
"class",
"NewGroovyTestCaseWizardTest",
"extends",
"AbstractNewGroovyWizardTest",
"{",
"private",
"static",
"final",
"String",
"PACKAGE_NAME",
"=",
"\"testPackage\"",
";",
"protected",
"IPackageFragment",
"frag",
"=",
"null",
";",
"public",
"NewGroovyTestCaseWizardTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"frag",
"=",
"fSourceFolder",
".",
"getPackageFragment",
"(",
"PACKAGE_NAME",
")",
";",
"if",
"(",
"frag",
"==",
"null",
")",
"{",
"frag",
"=",
"fSourceFolder",
".",
"createPackageFragment",
"(",
"PACKAGE_NAME",
",",
"false",
",",
"null",
")",
";",
"}",
"}",
"public",
"void",
"testAddGroovyTestCaseNonGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"GroovyRuntime",
".",
"removeGroovyNature",
"(",
"fJProject",
".",
"getProject",
"(",
")",
")",
";",
"NewGroovyTestTypeWizardPage",
"page",
"=",
"createdGroovyTestTypeWizardPage",
"(",
")",
";",
"String",
"testCaseName",
"=",
"\"\"",
";",
"page",
".",
"setEnclosingTypeSelection",
"(",
"false",
",",
"true",
")",
";",
"page",
".",
"setTypeName",
"(",
"testCaseName",
",",
"true",
")",
";",
"page",
".",
"createType",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"IType",
"type",
"=",
"page",
".",
"getCreatedType",
"(",
")",
";",
"assertNull",
"(",
"type",
")",
";",
"}",
"public",
"void",
"testAddGroovyTestCaseGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"GroovyRuntime",
".",
"addGroovyNature",
"(",
"fJProject",
".",
"getProject",
"(",
")",
")",
";",
"NewGroovyTestTypeWizardPage",
"page",
"=",
"createdGroovyTestTypeWizardPage",
"(",
")",
";",
"String",
"testCaseName",
"=",
"\"\"",
";",
"page",
".",
"setEnclosingTypeSelection",
"(",
"false",
",",
"true",
")",
";",
"page",
".",
"setTypeName",
"(",
"testCaseName",
",",
"true",
")",
";",
"page",
".",
"createType",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"IType",
"type",
"=",
"page",
".",
"getCreatedType",
"(",
")",
";",
"assertEquals",
"(",
"testCaseName",
",",
"type",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"protected",
"NewGroovyTestTypeWizardPage",
"createdGroovyTestTypeWizardPage",
"(",
")",
"{",
"NewTestCaseWizardPageTwo",
"pageTwo",
"=",
"new",
"NewTestCaseWizardPageTwo",
"(",
")",
";",
"NewGroovyTestTypeWizardPage",
"wizardPage",
"=",
"new",
"NewGroovyTestTypeWizardPage",
"(",
"pageTwo",
")",
";",
"wizardPage",
".",
"setPackageFragmentRoot",
"(",
"fSourceFolder",
",",
"true",
")",
";",
"wizardPage",
".",
"setPackageFragment",
"(",
"frag",
",",
"true",
")",
";",
"return",
"wizardPage",
";",
"}",
"}",
"</s>"
] |
6,068 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"wizards",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"TestProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"formatter",
".",
"DefaultCodeFormatterConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"public",
"abstract",
"class",
"AbstractNewGroovyWizardTest",
"extends",
"TestCase",
"{",
"protected",
"TestProject",
"fProject",
";",
"protected",
"IJavaProject",
"fJProject",
";",
"protected",
"IPackageFragmentRoot",
"fSourceFolder",
";",
"protected",
"AbstractNewGroovyWizardTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"<",
"String",
",",
"String",
">",
"options",
"=",
"JavaCore",
".",
"getDefaultOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_CHAR",
",",
"JavaCore",
".",
"SPACE",
")",
";",
"options",
".",
"put",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_TAB_SIZE",
",",
"\"4\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"IPreferenceStore",
"store",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"CODEGEN_ADD_COMMENTS",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"CODEGEN_USE_OVERRIDE_ANNOTATION",
",",
"true",
")",
";",
"fProject",
"=",
"new",
"TestProject",
"(",
"\"testWizards\"",
")",
";",
"fJProject",
"=",
"fProject",
".",
"getJavaProject",
"(",
")",
";",
"fSourceFolder",
"=",
"fProject",
".",
"getSourceFolder",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"fJProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"fProject",
".",
"dispose",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,069 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"adapters",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IFileEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"FileEditorInput",
";",
"public",
"class",
"GroovyIFileEditorInputAdapterFactoryTestCase",
"extends",
"EclipseTestCase",
"{",
"public",
"void",
"testIFileEditorInputAdapter",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"script",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"script",
")",
";",
"IFileEditorInput",
"editor",
"=",
"new",
"FileEditorInput",
"(",
"script",
")",
";",
"ClassNode",
"node",
"=",
"(",
"ClassNode",
")",
"editor",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"node",
".",
"getName",
"(",
")",
")",
";",
"assertFalse",
"(",
"node",
".",
"isInterface",
"(",
")",
")",
";",
"assertNotNull",
"(",
"node",
".",
"getMethods",
"(",
"\"main\"",
")",
")",
";",
"}",
"public",
"void",
"testIFileEditorInputAdapterCompileError",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"18",
")",
"{",
"return",
";",
"}",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"script",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"script",
")",
";",
"IFileEditorInput",
"editor",
"=",
"new",
"FileEditorInput",
"(",
"script",
")",
";",
"ClassNode",
"node",
"=",
"(",
"ClassNode",
")",
"editor",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"node",
".",
"getName",
"(",
")",
")",
";",
"assertFalse",
"(",
"node",
".",
"isInterface",
"(",
")",
")",
";",
"assertNotNull",
"(",
"node",
".",
"getMethods",
"(",
"\"main\"",
")",
")",
";",
"}",
"public",
"void",
"testIFileEditorInputAdapterHorendousCompileError",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"class",
"C",
"{n\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"notScript",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"notScript",
")",
";",
"IFileEditorInput",
"editor",
"=",
"new",
"FileEditorInput",
"(",
"notScript",
")",
";",
"assertNull",
"(",
"editor",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
")",
";",
"}",
"public",
"void",
"testIFileEditorInputAdapterNotGroovyFile",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"notScript",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"notScript",
")",
";",
"IFileEditorInput",
"editor",
"=",
"new",
"FileEditorInput",
"(",
"notScript",
")",
";",
"assertNull",
"(",
"editor",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,070 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"adapters",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"public",
"class",
"GroovyFileAdapterFactoryTestCase",
"extends",
"EclipseTestCase",
"{",
"public",
"void",
"testFileAdapter",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"script",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"script",
")",
";",
"ClassNode",
"node",
"=",
"(",
"ClassNode",
")",
"script",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"node",
".",
"getName",
"(",
")",
")",
";",
"assertFalse",
"(",
"node",
".",
"isInterface",
"(",
")",
")",
";",
"assertNotNull",
"(",
"node",
".",
"getMethods",
"(",
"\"main\"",
")",
")",
";",
"}",
"public",
"void",
"testFileAdapterCompileError",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"18",
")",
"{",
"return",
";",
"}",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"script",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"ClassNode",
"node",
"=",
"(",
"ClassNode",
")",
"script",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"node",
".",
"getName",
"(",
")",
")",
";",
"assertFalse",
"(",
"node",
".",
"isInterface",
"(",
")",
")",
";",
"assertNotNull",
"(",
"node",
".",
"getMethods",
"(",
"\"main\"",
")",
")",
";",
"}",
"public",
"void",
"testFileAdapterHorendousCompileError",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"class",
"C",
"{n\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"script",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"ClassNode",
"node",
"=",
"(",
"ClassNode",
")",
"script",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
";",
"assertNull",
"(",
"node",
")",
";",
"}",
"public",
"void",
"testFileAdapterNotGroovyFile",
"(",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"fullProjectBuild",
"(",
")",
";",
"final",
"IFile",
"notScript",
"=",
"(",
"IFile",
")",
"testProject",
".",
"getProject",
"(",
")",
".",
"findMember",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"notScript",
")",
";",
"assertNull",
"(",
"notScript",
".",
"getAdapter",
"(",
"ClassNode",
".",
"class",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"testProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,071 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"adapters",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"test",
".",
"EclipseTestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"GroovyResourcePropertyTester",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"public",
"class",
"IsMainTesterTests",
"extends",
"EclipseTestCase",
"{",
"public",
"void",
"testHasMain1",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testHasMain2",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testHasMain2a",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testHasMain3",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testHasMain3a",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testHasMain4",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testHasMain5",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testHasMain5a",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testHasMain6",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"public",
"void",
"testHasMain7",
"(",
")",
"throws",
"Exception",
"{",
"doTest",
"(",
"\"\"",
",",
"true",
")",
";",
"}",
"private",
"void",
"doTest",
"(",
"String",
"text",
",",
"boolean",
"expected",
")",
"throws",
"Exception",
"{",
"testProject",
".",
"addNature",
"(",
"GroovyNature",
".",
"GROOVY_NATURE",
")",
";",
"IFile",
"file",
"=",
"testProject",
".",
"createGroovyTypeAndPackage",
"(",
"\"pack1\"",
",",
"\"\"",
",",
"text",
")",
";",
"GroovyResourcePropertyTester",
"tester",
"=",
"new",
"GroovyResourcePropertyTester",
"(",
")",
";",
"boolean",
"result",
"=",
"tester",
".",
"test",
"(",
"file",
",",
"\"hasMain\"",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"result",
"!=",
"expected",
")",
"{",
"fail",
"(",
"\"Should",
"have",
"\"",
"+",
"(",
"expected",
"?",
"\"\"",
":",
"\"*not*\"",
")",
"+",
"\"\"",
"+",
"text",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,072 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"search",
".",
"GroovyOccurrencesFinder",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
".",
"AbstractGroovySearchTest",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"IOccurrencesFinder",
".",
"OccurrenceLocation",
";",
"public",
"class",
"FindOccurrencesTests",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"FindOccurrencesTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"FindOccurrencesTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testFindLocalOccurrences1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"xnx\"",
";",
"doTest",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"}",
"public",
"void",
"testFindLocalOccurrences2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"doTest",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"indexOf",
"(",
"\"(x\"",
")",
"+",
"1",
",",
"1",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"}",
"public",
"void",
"testFindLocalOccurrences3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"afterParen",
"=",
"contents",
".",
"indexOf",
"(",
"'('",
")",
";",
"doTest",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"indexOf",
"(",
"\"x\"",
",",
"afterParen",
")",
",",
"1",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"}",
"public",
"void",
"testFindLocalOccurrences4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"doTest",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"}",
"public",
"void",
"testFindForLoopOccurrences",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"x",
"}\"",
";",
"doTest",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"indexOf",
"(",
"'x'",
")",
",",
"1",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"1",
")",
";",
"}",
"public",
"void",
"_testFindPrimitive",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"length",
"=",
"\"int\"",
".",
"length",
"(",
")",
";",
"int",
"first",
"=",
"contents",
".",
"indexOf",
"(",
"\"int\"",
")",
";",
"int",
"second",
"=",
"contents",
".",
"indexOf",
"(",
"\"int\"",
",",
"first",
"+",
"1",
")",
";",
"int",
"third",
"=",
"contents",
".",
"indexOf",
"(",
"\"int\"",
",",
"second",
"+",
"1",
")",
";",
"int",
"fourth",
"=",
"contents",
".",
"indexOf",
"(",
"\"int\"",
",",
"third",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"second",
",",
"length",
",",
"first",
",",
"length",
",",
"second",
",",
"length",
",",
"third",
",",
"length",
",",
"fourth",
",",
"length",
")",
";",
"}",
"public",
"void",
"testFindProperty",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"X",
"{n\"",
"+",
"\"def",
"foon\"",
"+",
"\"}n\"",
"+",
"\"new",
"X().foon\"",
"+",
"\"\"",
";",
"int",
"length",
"=",
"\"foo\"",
".",
"length",
"(",
")",
";",
"int",
"first",
"=",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
")",
";",
"int",
"second",
"=",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
",",
"first",
"+",
"1",
")",
";",
"int",
"third",
"=",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
",",
"second",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"second",
",",
"length",
",",
"first",
",",
"length",
",",
"second",
",",
"length",
",",
"third",
",",
"length",
")",
";",
"}",
"public",
"void",
"testFindField",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"X",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"new",
"X().foon\"",
"+",
"\"\"",
";",
"int",
"length",
"=",
"\"foo\"",
".",
"length",
"(",
")",
";",
"int",
"first",
"=",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
")",
";",
"int",
"second",
"=",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
",",
"first",
"+",
"1",
")",
";",
"int",
"third",
"=",
"contents",
".",
"indexOf",
"(",
"\"foo\"",
",",
"second",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"second",
",",
"length",
",",
"first",
",",
"length",
",",
"second",
",",
"length",
",",
"third",
",",
"length",
")",
";",
"}",
"public",
"void",
"testFindGStringOccurrences1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"length",
"=",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"int",
"def",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"first",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
",",
"def",
"+",
"1",
")",
";",
"int",
"second",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
",",
"first",
"+",
"1",
")",
";",
"int",
"third",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
",",
"second",
"+",
"1",
")",
";",
"int",
"fourth",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
",",
"third",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"def",
",",
"1",
",",
"def",
",",
"length",
",",
"first",
",",
"length",
",",
"second",
",",
"length",
",",
"third",
",",
"length",
",",
"fourth",
",",
"length",
")",
";",
"}",
"public",
"void",
"testFindGStringOccurrences2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"length",
"=",
"\"i\"",
".",
"length",
"(",
")",
";",
"int",
"def",
"=",
"contents",
".",
"indexOf",
"(",
"\"i\"",
")",
";",
"int",
"first",
"=",
"contents",
".",
"indexOf",
"(",
"\"i\"",
",",
"def",
"+",
"1",
")",
";",
"int",
"second",
"=",
"contents",
".",
"indexOf",
"(",
"\"i\"",
",",
"first",
"+",
"1",
")",
";",
"int",
"third",
"=",
"contents",
".",
"indexOf",
"(",
"\"i\"",
",",
"second",
"+",
"1",
")",
";",
"int",
"fourth",
"=",
"contents",
".",
"indexOf",
"(",
"\"i\"",
",",
"third",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"def",
",",
"1",
",",
"def",
",",
"length",
",",
"first",
",",
"length",
",",
"second",
",",
"length",
",",
"third",
",",
"length",
",",
"fourth",
",",
"length",
")",
";",
"}",
"public",
"void",
"testFindStaticMethods",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"def",
"x()",
"{",
"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"String",
"methName",
"=",
"\"staticMethod\"",
";",
"int",
"len",
"=",
"methName",
".",
"length",
"(",
")",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start5",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start4",
"+",
"1",
")",
";",
"int",
"start6",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start5",
"+",
"1",
")",
";",
"int",
"start7",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start6",
"+",
"1",
")",
";",
"int",
"start8",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start7",
"+",
"1",
")",
";",
"int",
"start9",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start8",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
",",
"start5",
",",
"len",
",",
"start6",
",",
"len",
",",
"start7",
",",
"len",
",",
"start8",
",",
"len",
",",
"start9",
",",
"len",
")",
";",
"}",
"public",
"void",
"testFindStaticMethods18",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">",
"17",
")",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"def",
"x()",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"String",
"methName",
"=",
"\"staticMethod\"",
";",
"int",
"len",
"=",
"methName",
".",
"length",
"(",
")",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start5",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start4",
"+",
"1",
")",
";",
"int",
"start6",
"=",
"contents",
".",
"indexOf",
"(",
"methName",
",",
"start5",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
",",
"start5",
",",
"len",
",",
"start6",
",",
"len",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testInnerClass",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"className",
"=",
"\"Inner\"",
";",
"int",
"len",
"=",
"className",
".",
"length",
"(",
")",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"className",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"className",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start2",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
")",
";",
"}",
"public",
"void",
"testInnerClass2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"className",
"=",
"\"Inner\"",
";",
"int",
"len",
"=",
"className",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"className",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start2",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
")",
";",
"}",
"public",
"void",
"testInnerClass3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"className",
"=",
"\"Inner\"",
";",
"int",
"len",
"=",
"className",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"className",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start3",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
")",
";",
"}",
"public",
"void",
"testInnerClass4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"Inner",
"g\"",
";",
"String",
"className",
"=",
"\"Inner\"",
";",
"int",
"len",
"=",
"className",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"className",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"className",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start1",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
")",
";",
"}",
"public",
"void",
"testGenerics1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"HTML",
"i\"",
";",
"String",
"name",
"=",
"\"HTML\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start1",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
")",
";",
"}",
"public",
"void",
"testGenerics2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"HTML",
"i\"",
";",
"String",
"name",
"=",
"\"HTML\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start2",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
")",
";",
"}",
"public",
"void",
"testGenerics3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"HTML",
"i\"",
";",
"String",
"name",
"=",
"\"HTML\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start4",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
")",
";",
"}",
"public",
"void",
"testAnnotationOnImport",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"@Deprecatedn\"",
"+",
"\"\"",
"+",
"\"Deprecated\"",
";",
"String",
"name",
"=",
"\"Deprecated\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"name",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start",
"=",
"start2",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
")",
";",
"}",
"public",
"void",
"testLiterals1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"'fff'\"",
";",
"String",
"name",
"=",
"\"'fff'\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
")",
";",
"}",
"public",
"void",
"testLiterals2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"'''fff'''\"",
";",
"String",
"name",
"=",
"\"'''fff'''\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
")",
";",
"}",
"public",
"void",
"testLiterals3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"'''fff'''\"",
";",
"String",
"name",
"=",
"\"'''fff'''\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"name",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
")",
";",
"}",
"public",
"void",
"testOverloaded1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
")",
";",
"int",
"len",
"=",
"\"meth\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"meth\"",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
")",
";",
"}",
"public",
"void",
"testOverloaded2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
")",
"+",
"1",
")",
";",
"int",
"len",
"=",
"\"meth\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"meth\"",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
")",
";",
"}",
"public",
"void",
"testOverloaded3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
")",
"+",
"1",
")",
"+",
"1",
")",
";",
"int",
"len",
"=",
"\"meth\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"meth\"",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
")",
";",
"}",
"public",
"void",
"testDefaultParameters1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
")",
";",
"int",
"len",
"=",
"\"meth\"",
".",
"length",
"(",
")",
";",
"int",
"dontCare",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start",
")",
";",
"int",
"start1",
"=",
"dontCare",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start5",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start4",
"+",
"1",
")",
";",
"int",
"start6",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start5",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
",",
"start5",
",",
"len",
",",
"start6",
",",
"len",
")",
";",
"}",
"public",
"void",
"testStaticImports1",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"FOOn\"",
"+",
"\"p.Other.FOO\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"FOO\"",
")",
";",
"int",
"len",
"=",
"\"FOO\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"\"FOO\"",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"\"FOO\"",
",",
"start2",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
")",
";",
"}",
"public",
"void",
"testStaticImports2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"BARn\"",
"+",
"\"p.Other.BAR\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"BAR\"",
")",
";",
"int",
"len",
"=",
"\"BAR\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"\"BAR\"",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"\"BAR\"",
",",
"start2",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
")",
";",
"}",
"public",
"void",
"testStaticImports3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"Othern\"",
"+",
"\"p.Other.BAR\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"p.Other\"",
")",
";",
"int",
"len1",
"=",
"\"p.Other\"",
".",
"length",
"(",
")",
";",
"int",
"len",
"=",
"\"Other\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"\"Other\"",
",",
"start1",
"+",
"len1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"\"Other\"",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"\"p.Other\"",
",",
"start3",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len1",
",",
"start1",
",",
"len1",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len1",
")",
";",
"}",
"public",
"void",
"_testDefaultParameters1a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
")",
";",
"int",
"len",
"=",
"\"meth\"",
".",
"length",
"(",
")",
";",
"int",
"dontCare",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start",
"+",
"1",
")",
";",
"int",
"start1",
"=",
"dontCare",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start5",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start4",
"+",
"1",
")",
";",
"int",
"start6",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start5",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start3",
",",
"len",
",",
"start4",
",",
"len",
",",
"start5",
",",
"len",
",",
"start6",
",",
"len",
")",
";",
"}",
"public",
"void",
"_testDefaultParameters2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
")",
";",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start",
"+",
"1",
")",
";",
"int",
"len",
"=",
"\"meth\"",
".",
"length",
"(",
")",
";",
"int",
"start1",
"=",
"start",
";",
"int",
"start2",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start1",
"+",
"1",
")",
";",
"int",
"start3",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start2",
"+",
"1",
")",
";",
"int",
"start4",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start3",
"+",
"1",
")",
";",
"int",
"start5",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start4",
"+",
"1",
")",
";",
"int",
"start6",
"=",
"contents",
".",
"indexOf",
"(",
"\"meth\"",
",",
"start5",
"+",
"1",
")",
";",
"doTest",
"(",
"contents",
",",
"start",
",",
"len",
",",
"start1",
",",
"len",
",",
"start2",
",",
"len",
",",
"start5",
",",
"len",
",",
"start6",
",",
"len",
")",
";",
"}",
"private",
"void",
"doTest",
"(",
"String",
"contents",
",",
"int",
"start",
",",
"int",
"length",
",",
"int",
"...",
"expected",
")",
"throws",
"JavaModelException",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Occurrences\"",
",",
"contents",
")",
";",
"try",
"{",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"OccurrenceLocation",
"[",
"]",
"actual",
"=",
"find",
"(",
"unit",
",",
"start",
",",
"length",
")",
";",
"assertOccurrences",
"(",
"expected",
",",
"actual",
")",
";",
"}",
"finally",
"{",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"}",
"private",
"void",
"assertOccurrences",
"(",
"int",
"[",
"]",
"expected",
",",
"OccurrenceLocation",
"[",
"]",
"actual",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"Arrays",
".",
"toString",
"(",
"expected",
")",
"+",
"\"nbut",
"found:n\"",
"+",
"printOccurrences",
"(",
"actual",
")",
",",
"expected",
".",
"length",
"/",
"2",
",",
"actual",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actual",
".",
"length",
";",
"i",
"++",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"i",
"+",
"\"",
"expecting:n\"",
"+",
"Arrays",
".",
"toString",
"(",
"expected",
")",
"+",
"\"nbut",
"found:n\"",
"+",
"printOccurrences",
"(",
"actual",
")",
",",
"expected",
"[",
"i",
"*",
"2",
"]",
",",
"actual",
"[",
"i",
"]",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"i",
"+",
"\"",
"expecting:n\"",
"+",
"Arrays",
".",
"toString",
"(",
"expected",
")",
"+",
"\"nbut",
"found:n\"",
"+",
"printOccurrences",
"(",
"actual",
")",
",",
"expected",
"[",
"i",
"*",
"2",
"+",
"1",
"]",
",",
"actual",
"[",
"i",
"]",
".",
"getLength",
"(",
")",
")",
";",
"}",
"}",
"private",
"String",
"printOccurrences",
"(",
"OccurrenceLocation",
"[",
"]",
"os",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"OccurrenceLocation",
"o",
":",
"os",
")",
"{",
"sb",
".",
"append",
"(",
"o",
"+",
"\"n\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"private",
"OccurrenceLocation",
"[",
"]",
"find",
"(",
"GroovyCompilationUnit",
"unit",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"GroovyOccurrencesFinder",
"finder",
"=",
"new",
"GroovyOccurrencesFinder",
"(",
")",
";",
"finder",
".",
"setGroovyCompilationUnit",
"(",
"unit",
")",
";",
"finder",
".",
"initialize",
"(",
"null",
",",
"start",
",",
"length",
")",
";",
"return",
"finder",
".",
"getOccurrences",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,073 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"tests",
";",
"import",
"javax",
".",
"swing",
".",
"text",
".",
"html",
".",
"HTML",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotationNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Parameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeLookup",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"VariableScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
".",
"TypeConfidence",
";",
"public",
"class",
"TestTypeLookup",
"implements",
"ITypeLookup",
"{",
"public",
"TypeLookupResult",
"lookupType",
"(",
"Expression",
"node",
",",
"VariableScope",
"scope",
",",
"ClassNode",
"objectExpressionType",
")",
"{",
"return",
"new",
"TypeLookupResult",
"(",
"ClassHelper",
".",
"make",
"(",
"HTML",
".",
"class",
")",
",",
"VariableScope",
".",
"VOID_CLASS_NODE",
",",
"VariableScope",
".",
"STRING_CLASS_NODE",
".",
"getMethod",
"(",
"\"toString\"",
",",
"new",
"Parameter",
"[",
"0",
"]",
")",
",",
"TypeConfidence",
".",
"LOOSELY_INFERRED",
",",
"scope",
")",
";",
"}",
"public",
"TypeLookupResult",
"lookupType",
"(",
"FieldNode",
"node",
",",
"VariableScope",
"scope",
")",
"{",
"return",
"null",
";",
"}",
"public",
"TypeLookupResult",
"lookupType",
"(",
"MethodNode",
"node",
",",
"VariableScope",
"scope",
")",
"{",
"return",
"null",
";",
"}",
"public",
"TypeLookupResult",
"lookupType",
"(",
"AnnotationNode",
"node",
",",
"VariableScope",
"scope",
")",
"{",
"return",
"null",
";",
"}",
"public",
"TypeLookupResult",
"lookupType",
"(",
"ImportNode",
"node",
",",
"VariableScope",
"scope",
")",
"{",
"return",
"null",
";",
"}",
"public",
"TypeLookupResult",
"lookupType",
"(",
"ClassNode",
"node",
",",
"VariableScope",
"scope",
")",
"{",
"return",
"null",
";",
"}",
"public",
"TypeLookupResult",
"lookupType",
"(",
"Parameter",
"node",
",",
"VariableScope",
"scope",
")",
"{",
"return",
"null",
";",
"}",
"public",
"void",
"initialize",
"(",
"GroovyCompilationUnit",
"unit",
",",
"VariableScope",
"topLevelScope",
")",
"{",
"}",
"}",
"</s>"
] |
6,074 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"junit",
".",
"test",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"internal",
".",
"jobs",
".",
"JobManager",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"launcher",
".",
"JUnit3TestFinder",
";",
"public",
"class",
"JUnit3TestFinderTests",
"extends",
"JUnitTestCase",
"{",
"public",
"JUnit3TestFinderTests",
"(",
")",
"{",
"super",
"(",
"JUnit3TestFinderTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testFinderWithSuite",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Hello\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit3TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testFinderOfSubclass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Hello\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit3TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Tester\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"new",
"JUnit3TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testFinderOfNonPublicSubclass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Hello\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit3TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Tester\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"new",
"JUnit3TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testFindAllTestSuites",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello2\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"NotATest\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Set",
"<",
"IType",
">",
"testTypes",
"=",
"new",
"HashSet",
"<",
"IType",
">",
"(",
")",
";",
"IProject",
"project",
"=",
"getProject",
"(",
"projectPath",
")",
";",
"new",
"JUnit3TestFinder",
"(",
")",
".",
"findTestsInContainer",
"(",
"JavaCore",
".",
"create",
"(",
"project",
")",
",",
"testTypes",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"3",
",",
"testTypes",
".",
"size",
"(",
")",
")",
";",
"boolean",
"testerFound",
"=",
"false",
";",
"boolean",
"helloFound",
"=",
"false",
";",
"boolean",
"hello2Found",
"=",
"false",
";",
"for",
"(",
"IType",
"type",
":",
"testTypes",
")",
"{",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Hello\"",
")",
")",
"helloFound",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Hello2\"",
")",
")",
"hello2Found",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Tester\"",
")",
")",
"testerFound",
"=",
"true",
";",
"}",
"assertTrue",
"(",
"\"\"",
",",
"helloFound",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hello2Found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"testerFound",
")",
";",
"}",
"}",
"</s>"
] |
6,075 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"junit",
".",
"test",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"JUnitPropertyTester",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"launcher",
".",
"JUnit4TestFinder",
";",
"public",
"class",
"JUnit4TestFinderTests",
"extends",
"JUnitTestCase",
"{",
"public",
"JUnit4TestFinderTests",
"(",
")",
"{",
"super",
"(",
"JUnit4TestFinderTests",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testFinderWithSuite",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Hello\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testFinderOfSubclass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Hello\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Tester\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testFinderOfNonPublicSubclass",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Hello\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"Tester\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testUsingTestAnnotation",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"T2\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"@Testn\"",
"+",
"\"\"",
"+",
"\"return;n\"",
"+",
"\"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"T2\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testUsingRunWithAnnotation",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"T3\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"return;n\"",
"+",
"\"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"T3\"",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"type",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"isTest",
"(",
"type",
")",
")",
";",
"}",
"public",
"void",
"testFindAllTestSuites",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello2\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Hello3\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"T2\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"@Testn\"",
"+",
"\"\"",
"+",
"\"return;n\"",
"+",
"\"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"NotATest\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"T3\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"return;n\"",
"+",
"\"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Set",
"<",
"IType",
">",
"testTypes",
"=",
"new",
"HashSet",
"<",
"IType",
">",
"(",
")",
";",
"IProject",
"project",
"=",
"getProject",
"(",
"projectPath",
")",
";",
"new",
"JUnit4TestFinder",
"(",
")",
".",
"findTestsInContainer",
"(",
"JavaCore",
".",
"create",
"(",
"project",
")",
",",
"testTypes",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"boolean",
"testerFound",
"=",
"false",
";",
"boolean",
"helloFound",
"=",
"false",
";",
"boolean",
"hello2Found",
"=",
"false",
";",
"boolean",
"hello3Found",
"=",
"false",
";",
"boolean",
"t2Found",
"=",
"false",
";",
"boolean",
"t3Found",
"=",
"false",
";",
"for",
"(",
"IType",
"type",
":",
"testTypes",
")",
"{",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Hello\"",
")",
")",
"helloFound",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Hello2\"",
")",
")",
"hello2Found",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Hello3\"",
")",
")",
"hello3Found",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"T2\"",
")",
")",
"t2Found",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"T3\"",
")",
")",
"t3Found",
"=",
"true",
";",
"if",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"Tester\"",
")",
")",
"testerFound",
"=",
"true",
";",
"}",
"assertTrue",
"(",
"\"\"",
",",
"helloFound",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hello2Found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"hello3Found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"t2Found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"t3Found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"testerFound",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"6",
",",
"testTypes",
".",
"size",
"(",
")",
")",
";",
"}",
"public",
"void",
"testFindTestWithExpectedException",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"root",
"=",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
";",
"IPath",
"unitPath",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Tester\"",
",",
"\"package",
"p2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"unitPath",
")",
")",
";",
"boolean",
"found",
"=",
"new",
"JUnitPropertyTester",
"(",
")",
".",
"test",
"(",
"unit",
",",
"\"\"",
",",
"new",
"Object",
"[",
"0",
"]",
",",
"null",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"unit",
",",
"found",
")",
";",
"}",
"}",
"</s>"
] |
6,076 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"junit",
".",
"test",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"public",
"class",
"AllJUnitTests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"\"\"",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"JUnit3TestFinderTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"JUnit4TestFinderTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"MainMethodFinderTests",
".",
"class",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
6,077 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"junit",
".",
"test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"JUnitTestCase",
"extends",
"BuilderTests",
"{",
"public",
"JUnitTestCase",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"protected",
"IPath",
"createGenericProject",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addJUnitJar",
"(",
"projectPath",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"return",
"projectPath",
";",
"}",
"protected",
"IFile",
"getFile",
"(",
"IPath",
"projectPath",
",",
"String",
"fileName",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"projectPath",
".",
"append",
"(",
"fileName",
")",
")",
";",
"}",
"protected",
"IFolder",
"getolder",
"(",
"IPath",
"projectPath",
",",
"String",
"folderName",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"projectPath",
".",
"append",
"(",
"folderName",
")",
")",
";",
"}",
"protected",
"IProject",
"getProject",
"(",
"IPath",
"projectPath",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectPath",
".",
"segment",
"(",
"0",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,078 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"junit",
".",
"test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"GroovyResourcePropertyTester",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"public",
"class",
"GroovyResourcePropertyTests",
"extends",
"JUnitTestCase",
"{",
"public",
"GroovyResourcePropertyTests",
"(",
")",
"{",
"super",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNothing",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
6,079 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"astviews",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ElementChangedEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IElementChangedListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"Action",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"DoubleClickEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IDoubleClickListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ITreeContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"LabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TreeViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"Viewer",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IPartListener",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"DrillDownAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"ViewPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditor",
";",
"public",
"class",
"ASTView",
"extends",
"ViewPart",
"{",
"private",
"TreeViewer",
"viewer",
";",
"private",
"Action",
"doubleClickAction",
";",
"private",
"IEditorPart",
"editor",
";",
"private",
"IPartListener",
"partListener",
";",
"private",
"IElementChangedListener",
"listener",
";",
"class",
"ViewContentProvider",
"implements",
"IStructuredContentProvider",
",",
"ITreeContentProvider",
"{",
"ITreeNode",
"root",
";",
"public",
"void",
"inputChanged",
"(",
"Viewer",
"v",
",",
"Object",
"oldInput",
",",
"Object",
"newInput",
")",
"{",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"Object",
"[",
"]",
"getElements",
"(",
"Object",
"inputElement",
")",
"{",
"if",
"(",
"!",
"(",
"inputElement",
"instanceof",
"ModuleNode",
")",
")",
"{",
"return",
"new",
"Object",
"[",
"0",
"]",
";",
"}",
"root",
"=",
"TreeNodeFactory",
".",
"createTreeNode",
"(",
"null",
",",
"inputElement",
",",
"\"Module",
"Nodes\"",
")",
";",
"Object",
"[",
"]",
"children",
"=",
"root",
".",
"getChildren",
"(",
")",
";",
"return",
"children",
";",
"}",
"public",
"Object",
"getParent",
"(",
"Object",
"child",
")",
"{",
"Object",
"parent",
"=",
"(",
"(",
"ITreeNode",
")",
"child",
")",
".",
"getParent",
"(",
")",
";",
"return",
"parent",
";",
"}",
"public",
"Object",
"[",
"]",
"getChildren",
"(",
"Object",
"parent",
")",
"{",
"ITreeNode",
"[",
"]",
"children",
"=",
"(",
"(",
"ITreeNode",
")",
"parent",
")",
".",
"getChildren",
"(",
")",
";",
"return",
"children",
";",
"}",
"public",
"boolean",
"hasChildren",
"(",
"Object",
"parent",
")",
"{",
"boolean",
"has",
"=",
"!",
"(",
"(",
"ITreeNode",
")",
"parent",
")",
".",
"isLeaf",
"(",
")",
";",
"return",
"has",
";",
"}",
"}",
"class",
"ViewLabelProvider",
"extends",
"LabelProvider",
"{",
"@",
"Override",
"public",
"String",
"getText",
"(",
"Object",
"obj",
")",
"{",
"return",
"(",
"(",
"ITreeNode",
")",
"obj",
")",
".",
"getDisplayName",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Image",
"getImage",
"(",
"Object",
"obj",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"ASTView",
"(",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"createPartControl",
"(",
"Composite",
"parent",
")",
"{",
"viewer",
"=",
"new",
"TreeViewer",
"(",
"parent",
",",
"SWT",
".",
"MULTI",
"|",
"SWT",
".",
"H_SCROLL",
"|",
"SWT",
".",
"V_SCROLL",
")",
";",
"new",
"DrillDownAdapter",
"(",
"viewer",
")",
";",
"viewer",
".",
"setContentProvider",
"(",
"new",
"ViewContentProvider",
"(",
")",
")",
";",
"viewer",
".",
"setLabelProvider",
"(",
"new",
"ViewLabelProvider",
"(",
")",
")",
";",
"viewer",
".",
"setSorter",
"(",
"null",
")",
";",
"viewer",
".",
"setInput",
"(",
"null",
")",
";",
"makeActions",
"(",
")",
";",
"hookDoubleClickAction",
"(",
")",
";",
"hookGroovy",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"unhookGroovy",
"(",
")",
";",
"super",
".",
"dispose",
"(",
")",
";",
"}",
"private",
"void",
"hookGroovy",
"(",
")",
"{",
"partListener",
"=",
"new",
"IPartListener",
"(",
")",
"{",
"public",
"void",
"partActivated",
"(",
"IWorkbenchPart",
"part",
")",
"{",
"}",
"public",
"void",
"partBroughtToTop",
"(",
"IWorkbenchPart",
"part",
")",
"{",
"try",
"{",
"if",
"(",
"part",
"instanceof",
"IEditorPart",
")",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"(",
"(",
"IEditorPart",
")",
"part",
")",
".",
"getEditorInput",
"(",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"file",
"!=",
"null",
"&&",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"if",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"if",
"(",
"editor",
"!=",
"part",
")",
"{",
"editor",
"=",
"(",
"IEditorPart",
")",
"part",
";",
"Object",
"[",
"]",
"treePaths",
"=",
"viewer",
".",
"getExpandedElements",
"(",
")",
";",
"viewer",
".",
"setInput",
"(",
"(",
"(",
"GroovyCompilationUnit",
")",
"unit",
")",
".",
"getModuleNode",
"(",
")",
")",
";",
"viewer",
".",
"setExpandedElements",
"(",
"treePaths",
")",
";",
"}",
"else",
"{",
"}",
"return",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"editor",
"=",
"null",
";",
"if",
"(",
"viewer",
".",
"getContentProvider",
"(",
")",
"!=",
"null",
")",
"{",
"viewer",
".",
"setInput",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"partClosed",
"(",
"IWorkbenchPart",
"part",
")",
"{",
"}",
"public",
"void",
"partDeactivated",
"(",
"IWorkbenchPart",
"part",
")",
"{",
"}",
"public",
"void",
"partOpened",
"(",
"IWorkbenchPart",
"part",
")",
"{",
"}",
"}",
";",
"getSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"addPartListener",
"(",
"partListener",
")",
";",
"if",
"(",
"getSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"getActiveEditor",
"(",
")",
"instanceof",
"GroovyEditor",
")",
"{",
"partListener",
".",
"partBroughtToTop",
"(",
"getSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"getActiveEditor",
"(",
")",
")",
";",
"}",
"listener",
"=",
"new",
"IElementChangedListener",
"(",
")",
"{",
"public",
"void",
"elementChanged",
"(",
"ElementChangedEvent",
"event",
")",
"{",
"if",
"(",
"editor",
"==",
"null",
")",
"{",
"return",
";",
"}",
"IJavaElementDelta",
"delta",
"=",
"event",
".",
"getDelta",
"(",
")",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"editor",
".",
"getEditorInput",
"(",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"final",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"if",
"(",
"isUnitInDelta",
"(",
"delta",
",",
"unit",
")",
")",
"{",
"Display",
".",
"getDefault",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"Object",
"[",
"]",
"treePaths",
"=",
"viewer",
".",
"getExpandedElements",
"(",
")",
";",
"viewer",
".",
"setInput",
"(",
"unit",
".",
"getModuleNode",
"(",
")",
")",
";",
"viewer",
".",
"setExpandedElements",
"(",
"treePaths",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"private",
"boolean",
"isUnitInDelta",
"(",
"IJavaElementDelta",
"delta",
",",
"GroovyCompilationUnit",
"unit",
")",
"{",
"IJavaElement",
"elt",
"=",
"delta",
".",
"getElement",
"(",
")",
";",
"if",
"(",
"elt",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"if",
"(",
"elt",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"unit",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"ICompilationUnit",
"candidateUnit",
"=",
"(",
"ICompilationUnit",
")",
"elt",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"candidateUnit",
"!=",
"null",
")",
"{",
"if",
"(",
"candidateUnit",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"unit",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"IJavaElementDelta",
"[",
"]",
"deltas",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"if",
"(",
"deltas",
"!=",
"null",
")",
"{",
"for",
"(",
"IJavaElementDelta",
"delta2",
":",
"deltas",
")",
"{",
"if",
"(",
"isUnitInDelta",
"(",
"delta2",
",",
"unit",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"}",
";",
"JavaCore",
".",
"addElementChangedListener",
"(",
"listener",
",",
"ElementChangedEvent",
".",
"POST_RECONCILE",
")",
";",
"}",
"private",
"void",
"unhookGroovy",
"(",
")",
"{",
"JavaCore",
".",
"removeElementChangedListener",
"(",
"listener",
")",
";",
"getSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"removePartListener",
"(",
"partListener",
")",
";",
"}",
"private",
"void",
"makeActions",
"(",
")",
"{",
"doubleClickAction",
"=",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"ISelection",
"selection",
"=",
"viewer",
".",
"getSelection",
"(",
")",
";",
"Object",
"obj",
"=",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
".",
"getFirstElement",
"(",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"(",
"(",
"ITreeNode",
")",
"obj",
")",
".",
"getValue",
"(",
")",
"instanceof",
"ASTNode",
")",
"{",
"Object",
"value",
"=",
"(",
"(",
"ITreeNode",
")",
"obj",
")",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"ASTNode",
")",
")",
"{",
"return",
";",
"}",
"ASTNode",
"node",
"=",
"(",
"ASTNode",
")",
"value",
";",
"if",
"(",
"node",
".",
"getLineNumber",
"(",
")",
"!=",
"-",
"1",
")",
"{",
"int",
"offset0",
"=",
"node",
".",
"getStart",
"(",
")",
";",
"int",
"offset1",
"=",
"node",
".",
"getEnd",
"(",
")",
";",
"if",
"(",
"editor",
"instanceof",
"ITextEditor",
")",
"{",
"(",
"(",
"ITextEditor",
")",
"editor",
")",
".",
"getSelectionProvider",
"(",
")",
".",
"setSelection",
"(",
"new",
"TextSelection",
"(",
"offset0",
",",
"offset1",
"-",
"offset0",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
";",
"}",
"private",
"void",
"hookDoubleClickAction",
"(",
")",
"{",
"viewer",
".",
"addDoubleClickListener",
"(",
"new",
"IDoubleClickListener",
"(",
")",
"{",
"public",
"void",
"doubleClick",
"(",
"DoubleClickEvent",
"event",
")",
"{",
"doubleClickAction",
".",
"run",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"setFocus",
"(",
")",
"{",
"viewer",
".",
"getControl",
"(",
")",
".",
"setFocus",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,080 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"astviews",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"plugin",
".",
"AbstractUIPlugin",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"BundleContext",
";",
"public",
"class",
"Activator",
"extends",
"AbstractUIPlugin",
"{",
"public",
"static",
"final",
"String",
"PLUGIN_ID",
"=",
"\"\"",
";",
"private",
"static",
"Activator",
"plugin",
";",
"public",
"Activator",
"(",
")",
"{",
"plugin",
"=",
"this",
";",
"}",
"@",
"Override",
"public",
"void",
"start",
"(",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"super",
".",
"start",
"(",
"context",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"stop",
"(",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"plugin",
"=",
"null",
";",
"super",
".",
"stop",
"(",
"context",
")",
";",
"}",
"public",
"static",
"Activator",
"getDefault",
"(",
")",
"{",
"return",
"plugin",
";",
"}",
"public",
"static",
"ImageDescriptor",
"getImageDescriptor",
"(",
"String",
"path",
")",
"{",
"return",
"imageDescriptorFromPlugin",
"(",
"PLUGIN_ID",
",",
"path",
")",
";",
"}",
"}",
"</s>"
] |
6,081 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassCodeVisitorSupport",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ArgumentListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ArrayExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"AttributeExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BitwiseNegationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BooleanExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"CastExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClassExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstructorCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"DeclarationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ElvisOperatorExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"FieldExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"GStringExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapEntryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodPointerExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"NotExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PostfixExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PrefixExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PropertyExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"RangeExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"SpreadExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"SpreadMapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"StaticMethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TernaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TupleExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"UnaryMinusExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"UnaryPlusExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"classgen",
".",
"BytecodeExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"SourceUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"ASTFragmentFactory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"ASTFragmentKind",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"FragmentVisitor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"MethodCallFragment",
";",
"public",
"class",
"FindAllOccurrencesVisitor",
"extends",
"ClassCodeVisitorSupport",
"{",
"class",
"FragmentMatcherVisitor",
"extends",
"FragmentVisitor",
"{",
"private",
"boolean",
"matchWasFound",
"=",
"false",
";",
"@",
"Override",
"public",
"boolean",
"previsit",
"(",
"IASTFragment",
"fragment",
")",
"{",
"IASTFragment",
"matched",
"=",
"fragment",
".",
"findMatchingSubFragment",
"(",
"toFind",
")",
";",
"if",
"(",
"matched",
".",
"kind",
"(",
")",
"!=",
"ASTFragmentKind",
".",
"EMPTY",
")",
"{",
"occurrences",
".",
"add",
"(",
"matched",
")",
";",
"matchWasFound",
"=",
"true",
";",
"}",
"return",
"fragment",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"BINARY",
";",
"}",
"boolean",
"matchWasFound",
"(",
")",
"{",
"boolean",
"b",
"=",
"matchWasFound",
";",
"matchWasFound",
"=",
"false",
";",
"return",
"b",
";",
"}",
"}",
"class",
"AssociatedExpressionMatcher",
"extends",
"FragmentVisitor",
"{",
"boolean",
"ignoreNext",
"=",
"false",
";",
"@",
"Override",
"public",
"boolean",
"previsit",
"(",
"IASTFragment",
"fragment",
")",
"{",
"if",
"(",
"!",
"ignoreNext",
")",
"{",
"fragment",
".",
"getAssociatedExpression",
"(",
")",
".",
"visit",
"(",
"FindAllOccurrencesVisitor",
".",
"this",
")",
";",
"}",
"else",
"{",
"ignoreNext",
"=",
"false",
";",
"}",
"return",
"true",
";",
"}",
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"MethodCallFragment",
"fragment",
")",
"{",
"fragment",
".",
"getArguments",
"(",
")",
".",
"visit",
"(",
"FindAllOccurrencesVisitor",
".",
"this",
")",
";",
"return",
"true",
";",
"}",
"}",
"private",
"IASTFragment",
"toFind",
";",
"private",
"List",
"<",
"IASTFragment",
">",
"occurrences",
";",
"private",
"ModuleNode",
"module",
";",
"private",
"AnnotatedNode",
"limitTo",
";",
"private",
"ASTFragmentFactory",
"factory",
";",
"private",
"FragmentMatcherVisitor",
"fragmentMatcher",
";",
"private",
"AssociatedExpressionMatcher",
"associatedExpressionMatcher",
";",
"public",
"FindAllOccurrencesVisitor",
"(",
"ModuleNode",
"module",
")",
"{",
"this",
"(",
"module",
",",
"null",
")",
";",
"}",
"public",
"FindAllOccurrencesVisitor",
"(",
"ModuleNode",
"module",
",",
"AnnotatedNode",
"limitTo",
")",
"{",
"this",
".",
"limitTo",
"=",
"limitTo",
";",
"this",
".",
"module",
"=",
"module",
";",
"this",
".",
"factory",
"=",
"new",
"ASTFragmentFactory",
"(",
")",
";",
"this",
".",
"fragmentMatcher",
"=",
"new",
"FragmentMatcherVisitor",
"(",
")",
";",
"this",
".",
"associatedExpressionMatcher",
"=",
"new",
"AssociatedExpressionMatcher",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"SourceUnit",
"getSourceUnit",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"List",
"<",
"IASTFragment",
">",
"findOccurrences",
"(",
"IASTFragment",
"fragment",
")",
"{",
"this",
".",
"toFind",
"=",
"fragment",
";",
"this",
".",
"occurrences",
"=",
"new",
"ArrayList",
"<",
"IASTFragment",
">",
"(",
")",
";",
"if",
"(",
"limitTo",
"==",
"null",
")",
"{",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"module",
".",
"getClasses",
"(",
")",
";",
"for",
"(",
"ClassNode",
"classNode",
":",
"classes",
")",
"{",
"visitClass",
"(",
"classNode",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"limitTo",
"instanceof",
"ClassNode",
")",
"{",
"visitClass",
"(",
"(",
"ClassNode",
")",
"limitTo",
")",
";",
"}",
"else",
"if",
"(",
"limitTo",
"instanceof",
"MethodNode",
")",
"{",
"visitMethod",
"(",
"(",
"MethodNode",
")",
"limitTo",
")",
";",
"}",
"else",
"if",
"(",
"limitTo",
"instanceof",
"FieldNode",
")",
"{",
"visitField",
"(",
"(",
"FieldNode",
")",
"limitTo",
")",
";",
"}",
"else",
"{",
"limitTo",
".",
"visit",
"(",
"this",
")",
";",
"}",
"}",
"return",
"this",
".",
"occurrences",
";",
"}",
"@",
"Override",
"protected",
"void",
"visitConstructorOrMethod",
"(",
"MethodNode",
"node",
",",
"boolean",
"isConstructor",
")",
"{",
"if",
"(",
"node",
".",
"getEnd",
"(",
")",
"==",
"0",
"&&",
"!",
"node",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"<clinit>\"",
")",
")",
"{",
"return",
";",
"}",
"super",
".",
"visitConstructorOrMethod",
"(",
"node",
",",
"isConstructor",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitField",
"(",
"FieldNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getEnd",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"super",
".",
"visitField",
"(",
"node",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitProperty",
"(",
"PropertyNode",
"node",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"visitArgumentlistExpression",
"(",
"ArgumentListExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitArgumentlistExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitArrayExpression",
"(",
"ArrayExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitArrayExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitAttributeExpression",
"(",
"AttributeExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitAttributeExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBinaryExpression",
"(",
"BinaryExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"associatedExpressionMatcher",
".",
"ignoreNext",
"=",
"false",
";",
"fragment",
".",
"accept",
"(",
"associatedExpressionMatcher",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBitwiseNegationExpression",
"(",
"BitwiseNegationExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitBitwiseNegationExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBooleanExpression",
"(",
"BooleanExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitBooleanExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBytecodeExpression",
"(",
"BytecodeExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitBytecodeExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitCastExpression",
"(",
"CastExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitCastExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClassExpression",
"(",
"ClassExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitClassExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureExpression",
"(",
"ClosureExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitClosureExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureListExpression",
"(",
"ClosureListExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitClosureListExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitConstantExpression",
"(",
"ConstantExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitConstantExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitConstructorCallExpression",
"(",
"ConstructorCallExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitConstructorCallExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitDeclarationExpression",
"(",
"DeclarationExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitDeclarationExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitVariableExpression",
"(",
"VariableExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitVariableExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitFieldExpression",
"(",
"FieldExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitFieldExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitGStringExpression",
"(",
"GStringExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitGStringExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitListExpression",
"(",
"ListExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitListExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMapEntryExpression",
"(",
"MapEntryExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitMapEntryExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMapExpression",
"(",
"MapExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitMapExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethodCallExpression",
"(",
"MethodCallExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"associatedExpressionMatcher",
".",
"ignoreNext",
"=",
"true",
";",
"fragment",
".",
"accept",
"(",
"associatedExpressionMatcher",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethodPointerExpression",
"(",
"MethodPointerExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"associatedExpressionMatcher",
".",
"ignoreNext",
"=",
"true",
";",
"fragment",
".",
"accept",
"(",
"associatedExpressionMatcher",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitNotExpression",
"(",
"NotExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitNotExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPostfixExpression",
"(",
"PostfixExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitPostfixExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPrefixExpression",
"(",
"PrefixExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitPrefixExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPropertyExpression",
"(",
"PropertyExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"associatedExpressionMatcher",
".",
"ignoreNext",
"=",
"true",
";",
"fragment",
".",
"accept",
"(",
"associatedExpressionMatcher",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitRangeExpression",
"(",
"RangeExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitRangeExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitShortTernaryExpression",
"(",
"ElvisOperatorExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitShortTernaryExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitSpreadExpression",
"(",
"SpreadExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitSpreadExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitSpreadMapExpression",
"(",
"SpreadMapExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitSpreadMapExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitStaticMethodCallExpression",
"(",
"StaticMethodCallExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitStaticMethodCallExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitTernaryExpression",
"(",
"TernaryExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitTernaryExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitTupleExpression",
"(",
"TupleExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitTupleExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitUnaryMinusExpression",
"(",
"UnaryMinusExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitUnaryMinusExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitUnaryPlusExpression",
"(",
"UnaryPlusExpression",
"expression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"factory",
".",
"createFragment",
"(",
"expression",
")",
";",
"fragment",
".",
"accept",
"(",
"fragmentMatcher",
")",
";",
"if",
"(",
"!",
"fragmentMatcher",
".",
"matchWasFound",
"(",
")",
")",
"super",
".",
"visitUnaryPlusExpression",
"(",
"expression",
")",
";",
"}",
"}",
"</s>"
] |
6,082 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNodeCompatibilityWrapper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PackageNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ArgumentListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ArrayExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"AttributeExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BitwiseNegationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BooleanExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"CastExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClassExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstructorCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"DeclarationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ElvisOperatorExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"FieldExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"GStringExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapEntryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodPointerExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"NotExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PostfixExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PrefixExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PropertyExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"RangeExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"SpreadExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"SpreadMapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"StaticMethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TernaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TupleExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"UnaryMinusExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"UnaryPlusExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"AssertStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"BlockStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"BreakStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"CaseStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"CatchStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ContinueStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"DoWhileStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"EmptyStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ExpressionStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ForStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"IfStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ReturnStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"SwitchStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"SynchronizedStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ThrowStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"TryCatchStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"WhileStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"ASTFragmentFactory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"ASTNodeFinder",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"Region",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"util",
".",
"VisitCompleteException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"public",
"class",
"FindSurroundingNode",
"extends",
"ASTNodeFinder",
"{",
"public",
"static",
"enum",
"VisitKind",
"{",
"SURROUNDING_NODE",
",",
"EXTRA_EXPAND",
",",
"PARENT_STACK",
"}",
"private",
"final",
"VisitKind",
"visitKind",
";",
"private",
"Stack",
"<",
"IASTFragment",
">",
"nodeStack",
";",
"private",
"ASTFragmentFactory",
"factory",
";",
"private",
"MethodNode",
"runMethod",
";",
"public",
"FindSurroundingNode",
"(",
"Region",
"r",
")",
"{",
"this",
"(",
"r",
",",
"VisitKind",
".",
"EXTRA_EXPAND",
")",
";",
"}",
"public",
"FindSurroundingNode",
"(",
"Region",
"r",
",",
"VisitKind",
"visitKind",
")",
"{",
"super",
"(",
"r",
")",
";",
"nodeStack",
"=",
"new",
"Stack",
"<",
"IASTFragment",
">",
"(",
")",
";",
"this",
".",
"visitKind",
"=",
"visitKind",
";",
"factory",
"=",
"new",
"ASTFragmentFactory",
"(",
")",
";",
"}",
"public",
"IASTFragment",
"doVisitSurroundingNode",
"(",
"ModuleNode",
"module",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"module",
")",
")",
";",
"ASTNode",
"node",
"=",
"super",
".",
"doVisit",
"(",
"module",
")",
";",
"if",
"(",
"node",
"==",
"null",
"&&",
"runMethod",
"!=",
"null",
")",
"{",
"try",
"{",
"internalVisitConstructorOrMethod",
"(",
"runMethod",
",",
"false",
")",
";",
"}",
"catch",
"(",
"VisitCompleteException",
"e",
")",
"{",
"}",
"}",
"IASTFragment",
"maybeNode",
"=",
"factory",
".",
"createFragment",
"(",
"node",
")",
";",
"if",
"(",
"visitKind",
"!=",
"VisitKind",
".",
"PARENT_STACK",
")",
"{",
"while",
"(",
"!",
"nodeStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"maybeNode",
"=",
"nodeStack",
".",
"peek",
"(",
")",
";",
"if",
"(",
"maybeNode",
".",
"getEnd",
"(",
")",
"==",
"0",
"||",
"(",
"visitKind",
"==",
"VisitKind",
".",
"EXTRA_EXPAND",
"&&",
"super",
".",
"getRegion",
"(",
")",
".",
"isSame",
"(",
"maybeNode",
")",
")",
")",
"{",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"}",
"return",
"nodeStack",
".",
"isEmpty",
"(",
")",
"?",
"maybeNode",
":",
"nodeStack",
".",
"peek",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"ASTNode",
"doVisit",
"(",
"ModuleNode",
"module",
")",
"{",
"Assert",
".",
"isLegal",
"(",
"false",
",",
"\"\"",
")",
";",
"return",
"super",
".",
"doVisit",
"(",
"module",
")",
";",
"}",
"public",
"Stack",
"<",
"IASTFragment",
">",
"getParentStack",
"(",
")",
"{",
"return",
"nodeStack",
";",
"}",
"protected",
"void",
"reset",
"(",
")",
"{",
"nodeStack",
".",
"clear",
"(",
")",
";",
"runMethod",
"=",
"null",
";",
"}",
"@",
"Override",
"public",
"void",
"visitAnnotations",
"(",
"AnnotatedNode",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitAnnotations",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitAssertStatement",
"(",
"AssertStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitAssertStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBlockStatement",
"(",
"BlockStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitBlockStatement",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBreakStatement",
"(",
"BreakStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitBreakStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitCaseStatement",
"(",
"CaseStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitCaseStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitContinueStatement",
"(",
"ContinueStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitContinueStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitDoWhileLoop",
"(",
"DoWhileStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitDoWhileLoop",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitExpressionStatement",
"(",
"ExpressionStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitExpressionStatement",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitIfElse",
"(",
"IfStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitIfElse",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPackage",
"(",
"PackageNode",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitPackage",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitImports",
"(",
"ModuleNode",
"module",
")",
"{",
"for",
"(",
"ImportNode",
"importNode",
":",
"new",
"ImportNodeCompatibilityWrapper",
"(",
"module",
")",
".",
"getAllImportNodes",
"(",
")",
")",
"{",
"if",
"(",
"importNode",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"importNode",
")",
")",
";",
"check",
"(",
"importNode",
".",
"getType",
"(",
")",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"}",
"}",
"@",
"Override",
"public",
"void",
"visitSwitch",
"(",
"SwitchStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitSwitch",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitSynchronizedStatement",
"(",
"SynchronizedStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitSynchronizedStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitThrowStatement",
"(",
"ThrowStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitThrowStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitTryCatchFinally",
"(",
"TryCatchStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitTryCatchFinally",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitWhileLoop",
"(",
"WhileStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitWhileLoop",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitArgumentlistExpression",
"(",
"ArgumentListExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitArgumentlistExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitAttributeExpression",
"(",
"AttributeExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitAttributeExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBinaryExpression",
"(",
"BinaryExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"if",
"(",
"getRegion",
"(",
")",
".",
"regionIsCoveredByNode",
"(",
"node",
")",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
",",
"getRegion",
"(",
")",
".",
"getOffset",
"(",
")",
",",
"getRegion",
"(",
")",
".",
"getEnd",
"(",
")",
")",
")",
";",
"}",
"super",
".",
"visitBinaryExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBitwiseNegationExpression",
"(",
"BitwiseNegationExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitBitwiseNegationExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitBooleanExpression",
"(",
"BooleanExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"if",
"(",
"!",
"isColocated",
"(",
"node",
".",
"getExpression",
"(",
")",
",",
"node",
")",
")",
"{",
"check",
"(",
"node",
")",
";",
"}",
"super",
".",
"visitBooleanExpression",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"private",
"boolean",
"isColocated",
"(",
"ASTNode",
"node1",
",",
"ASTNode",
"node2",
")",
"{",
"return",
"node1",
".",
"getStart",
"(",
")",
"==",
"node2",
".",
"getStart",
"(",
")",
"&&",
"node1",
".",
"getEnd",
"(",
")",
"==",
"node2",
".",
"getEnd",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureListExpression",
"(",
"ClosureListExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitClosureListExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"protected",
"void",
"visitEmptyStatement",
"(",
"EmptyStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitListExpression",
"(",
"ListExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitListExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMapEntryExpression",
"(",
"MapEntryExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitMapEntryExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMapExpression",
"(",
"MapExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitMapExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethodCallExpression",
"(",
"MethodCallExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"if",
"(",
"getRegion",
"(",
")",
".",
"regionIsCoveredByNode",
"(",
"node",
")",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
",",
"getRegion",
"(",
")",
".",
"getOffset",
"(",
")",
",",
"getRegion",
"(",
")",
".",
"getEnd",
"(",
")",
")",
")",
";",
"}",
"super",
".",
"visitMethodCallExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethodPointerExpression",
"(",
"MethodPointerExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"if",
"(",
"getRegion",
"(",
")",
".",
"regionIsCoveredByNode",
"(",
"node",
")",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
",",
"getRegion",
"(",
")",
".",
"getOffset",
"(",
")",
",",
"getRegion",
"(",
")",
".",
"getEnd",
"(",
")",
")",
")",
";",
"}",
"super",
".",
"visitMethodPointerExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitNotExpression",
"(",
"NotExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitNotExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPostfixExpression",
"(",
"PostfixExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitPostfixExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPrefixExpression",
"(",
"PrefixExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitPrefixExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitPropertyExpression",
"(",
"PropertyExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitPropertyExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitRangeExpression",
"(",
"RangeExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitRangeExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitShortTernaryExpression",
"(",
"ElvisOperatorExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitShortTernaryExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitSpreadExpression",
"(",
"SpreadExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitSpreadExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitSpreadMapExpression",
"(",
"SpreadMapExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitSpreadMapExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitTernaryExpression",
"(",
"TernaryExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitTernaryExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitTupleExpression",
"(",
"TupleExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitTupleExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitUnaryMinusExpression",
"(",
"UnaryMinusExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitUnaryMinusExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitUnaryPlusExpression",
"(",
"UnaryPlusExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitUnaryPlusExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitArrayExpression",
"(",
"ArrayExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitArrayExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitCastExpression",
"(",
"CastExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitCastExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitCatchStatement",
"(",
"CatchStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitCatchStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClass",
"(",
"ClassNode",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitClass",
"(",
"node",
")",
";",
"if",
"(",
"!",
"node",
".",
"isScript",
"(",
")",
")",
"{",
"check",
"(",
"node",
")",
";",
"}",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClassExpression",
"(",
"ClassExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitClassExpression",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureExpression",
"(",
"ClosureExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitClosureExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitConstantExpression",
"(",
"ConstantExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitConstantExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitConstructorCallExpression",
"(",
"ConstructorCallExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitConstructorCallExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"visitConstructorOrMethod",
"(",
"MethodNode",
"node",
",",
"boolean",
"isConstructor",
")",
"{",
"if",
"(",
"isRunMethod",
"(",
"node",
")",
")",
"{",
"runMethod",
"=",
"node",
";",
"return",
";",
"}",
"internalVisitConstructorOrMethod",
"(",
"node",
",",
"isConstructor",
")",
";",
"}",
"private",
"void",
"internalVisitConstructorOrMethod",
"(",
"MethodNode",
"node",
",",
"boolean",
"isConstructor",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitConstructorOrMethod",
"(",
"node",
",",
"isConstructor",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"private",
"boolean",
"isRunMethod",
"(",
"MethodNode",
"node",
")",
"{",
"return",
"node",
".",
"getDeclaringClass",
"(",
")",
".",
"isScript",
"(",
")",
"&&",
"node",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"run\"",
")",
"&&",
"(",
"node",
".",
"getParameters",
"(",
")",
"==",
"null",
"||",
"node",
".",
"getParameters",
"(",
")",
".",
"length",
"==",
"0",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitDeclarationExpression",
"(",
"DeclarationExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"if",
"(",
"getRegion",
"(",
")",
".",
"regionIsCoveredByNode",
"(",
"node",
")",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
",",
"getRegion",
"(",
")",
".",
"getOffset",
"(",
")",
",",
"getRegion",
"(",
")",
".",
"getEnd",
"(",
")",
")",
")",
";",
"}",
"super",
".",
"visitDeclarationExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitField",
"(",
"FieldNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"$\"",
")",
")",
"{",
"return",
";",
"}",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitField",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitProperty",
"(",
"PropertyNode",
"node",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"visitFieldExpression",
"(",
"FieldExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitFieldExpression",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitForLoop",
"(",
"ForStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitForLoop",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitGStringExpression",
"(",
"GStringExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitGStringExpression",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitReturnStatement",
"(",
"ReturnStatement",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitReturnStatement",
"(",
"node",
")",
";",
"check",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitStaticMethodCallExpression",
"(",
"StaticMethodCallExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitStaticMethodCallExpression",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitVariableExpression",
"(",
"VariableExpression",
"node",
")",
"{",
"nodeStack",
".",
"push",
"(",
"factory",
".",
"createFragment",
"(",
"node",
")",
")",
";",
"super",
".",
"visitVariableExpression",
"(",
"node",
")",
";",
"nodeStack",
".",
"pop",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,083 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ArgumentListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ArrayExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BitwiseNegationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BooleanExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"CastExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClassExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstructorCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"EmptyExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"FieldExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"GStringExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodPointerExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PostfixExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PrefixExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PropertyExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"RangeExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"SpreadExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"SpreadMapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"StaticMethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TernaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TupleExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"UnaryMinusExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"UnaryPlusExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"public",
"class",
"IsSameExpression",
"{",
"public",
"boolean",
"isSame",
"(",
"Expression",
"left",
",",
"Expression",
"right",
")",
"{",
"if",
"(",
"left",
"==",
"null",
"&&",
"right",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"left",
"==",
"null",
"||",
"right",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"handleSpecialCases",
"(",
"left",
",",
"right",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"left",
".",
"getClass",
"(",
")",
"!=",
"right",
".",
"getClass",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"left",
"instanceof",
"ArgumentListExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ArgumentListExpression",
")",
"left",
",",
"(",
"ArgumentListExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ArrayExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ArrayExpression",
")",
"left",
",",
"(",
"ArrayExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"BinaryExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"BinaryExpression",
")",
"left",
",",
"(",
"BinaryExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"BitwiseNegationExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"BitwiseNegationExpression",
")",
"left",
",",
"(",
"BitwiseNegationExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"BooleanExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"BooleanExpression",
")",
"left",
",",
"(",
"BooleanExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"CastExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"CastExpression",
")",
"left",
",",
"(",
"CastExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ClassExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ClassExpression",
")",
"left",
",",
"(",
"ClassExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ClosureExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ClosureExpression",
")",
"left",
",",
"(",
"ClosureExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ConstantExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ConstantExpression",
")",
"left",
",",
"(",
"ConstantExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ConstructorCallExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ConstructorCallExpression",
")",
"left",
",",
"(",
"ConstructorCallExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"EmptyExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"EmptyExpression",
")",
"left",
",",
"(",
"EmptyExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"FieldExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"FieldExpression",
")",
"left",
",",
"(",
"FieldExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"GStringExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"GStringExpression",
")",
"left",
",",
"(",
"GStringExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ListExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"ListExpression",
")",
"left",
",",
"(",
"ListExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"MapExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"MapExpression",
")",
"left",
",",
"(",
"MapExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"MethodCallExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"MethodCallExpression",
")",
"left",
",",
"(",
"MethodCallExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"MethodPointerExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"MethodPointerExpression",
")",
"left",
",",
"(",
"MethodPointerExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"PostfixExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"PostfixExpression",
")",
"left",
",",
"(",
"PostfixExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"PrefixExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"PrefixExpression",
")",
"left",
",",
"(",
"PrefixExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"PropertyExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"PropertyExpression",
")",
"left",
",",
"(",
"PropertyExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"RangeExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"RangeExpression",
")",
"left",
",",
"(",
"RangeExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"SpreadExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"SpreadExpression",
")",
"left",
",",
"(",
"SpreadExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"SpreadMapExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"SpreadMapExpression",
")",
"left",
",",
"(",
"SpreadMapExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"StaticMethodCallExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"StaticMethodCallExpression",
")",
"left",
",",
"(",
"StaticMethodCallExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"TernaryExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"TernaryExpression",
")",
"left",
",",
"(",
"TernaryExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"TupleExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"TupleExpression",
")",
"left",
",",
"(",
"TupleExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"UnaryMinusExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"UnaryMinusExpression",
")",
"left",
",",
"(",
"UnaryMinusExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"UnaryPlusExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"UnaryPlusExpression",
")",
"left",
",",
"(",
"UnaryPlusExpression",
")",
"right",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"VariableExpression",
")",
"{",
"return",
"visit",
"(",
"(",
"VariableExpression",
")",
"left",
",",
"(",
"VariableExpression",
")",
"right",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"private",
"boolean",
"handleSpecialCases",
"(",
"Expression",
"left",
",",
"Expression",
"right",
")",
"{",
"if",
"(",
"left",
"instanceof",
"ConstantExpression",
"&&",
"right",
"instanceof",
"ClassExpression",
")",
"{",
"return",
"right",
".",
"getType",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"(",
"(",
"ConstantExpression",
")",
"left",
")",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"left",
"instanceof",
"ClassExpression",
"&&",
"right",
"instanceof",
"ConstantExpression",
")",
"{",
"return",
"left",
".",
"getType",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"(",
"(",
"ConstantExpression",
")",
"right",
")",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"visit",
"(",
"VariableExpression",
"left",
",",
"VariableExpression",
"right",
")",
"{",
"return",
"left",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"right",
".",
"getName",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"UnaryPlusExpression",
"left",
",",
"UnaryPlusExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"UnaryMinusExpression",
"left",
",",
"UnaryMinusExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"TupleExpression",
"left",
",",
"TupleExpression",
"right",
")",
"{",
"return",
"checkExpressionList",
"(",
"left",
".",
"getExpressions",
"(",
")",
",",
"right",
".",
"getExpressions",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"TernaryExpression",
"left",
",",
"TernaryExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getBooleanExpression",
"(",
")",
",",
"right",
".",
"getBooleanExpression",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getTrueExpression",
"(",
")",
",",
"right",
".",
"getTrueExpression",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getFalseExpression",
"(",
")",
",",
"right",
".",
"getFalseExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"StaticMethodCallExpression",
"left",
",",
"StaticMethodCallExpression",
"right",
")",
"{",
"return",
"visit",
"(",
"left",
".",
"getType",
"(",
")",
",",
"right",
".",
"getType",
"(",
")",
")",
"&&",
"left",
".",
"getMethod",
"(",
")",
".",
"equals",
"(",
"right",
".",
"getMethod",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getArguments",
"(",
")",
",",
"right",
".",
"getArguments",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"SpreadExpression",
"left",
",",
"SpreadExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"SpreadMapExpression",
"left",
",",
"SpreadMapExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"RangeExpression",
"left",
",",
"RangeExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getFrom",
"(",
")",
",",
"right",
".",
"getFrom",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getTo",
"(",
")",
",",
"right",
".",
"getTo",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"PropertyExpression",
"left",
",",
"PropertyExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getObjectExpression",
"(",
")",
",",
"right",
".",
"getObjectExpression",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getProperty",
"(",
")",
",",
"right",
".",
"getProperty",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"PrefixExpression",
"left",
",",
"PrefixExpression",
"right",
")",
"{",
"return",
"nullEquals",
"(",
"left",
".",
"getOperation",
"(",
")",
",",
"(",
"right",
".",
"getOperation",
"(",
")",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"PostfixExpression",
"left",
",",
"PostfixExpression",
"right",
")",
"{",
"return",
"nullEquals",
"(",
"left",
".",
"getOperation",
"(",
")",
",",
"(",
"right",
".",
"getOperation",
"(",
")",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"MethodPointerExpression",
"left",
",",
"MethodPointerExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getMethodName",
"(",
")",
",",
"right",
".",
"getMethodName",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"MethodCallExpression",
"left",
",",
"MethodCallExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getObjectExpression",
"(",
")",
",",
"right",
".",
"getObjectExpression",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getMethod",
"(",
")",
",",
"right",
".",
"getMethod",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getArguments",
"(",
")",
",",
"right",
".",
"getArguments",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"MapExpression",
"left",
",",
"MapExpression",
"right",
")",
"{",
"return",
"checkExpressionList",
"(",
"left",
".",
"getMapEntryExpressions",
"(",
")",
",",
"right",
".",
"getMapEntryExpressions",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ListExpression",
"left",
",",
"ListExpression",
"right",
")",
"{",
"return",
"checkExpressionList",
"(",
"left",
".",
"getExpressions",
"(",
")",
",",
"right",
".",
"getExpressions",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"GStringExpression",
"left",
",",
"GStringExpression",
"right",
")",
"{",
"return",
"checkExpressionList",
"(",
"left",
".",
"getStrings",
"(",
")",
",",
"right",
".",
"getStrings",
"(",
")",
")",
"&&",
"checkExpressionList",
"(",
"left",
".",
"getValues",
"(",
")",
",",
"right",
".",
"getValues",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"FieldExpression",
"left",
",",
"FieldExpression",
"right",
")",
"{",
"return",
"visit",
"(",
"left",
".",
"getField",
"(",
")",
".",
"getDeclaringClass",
"(",
")",
",",
"right",
".",
"getField",
"(",
")",
".",
"getDeclaringClass",
"(",
")",
")",
"&&",
"nullEquals",
"(",
"left",
".",
"getFieldName",
"(",
")",
",",
"right",
".",
"getFieldName",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"EmptyExpression",
"left",
",",
"EmptyExpression",
"right",
")",
"{",
"return",
"true",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ConstructorCallExpression",
"left",
",",
"ConstructorCallExpression",
"right",
")",
"{",
"return",
"visit",
"(",
"left",
".",
"getType",
"(",
")",
",",
"right",
".",
"getType",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getArguments",
"(",
")",
",",
"right",
".",
"getArguments",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ConstantExpression",
"left",
",",
"ConstantExpression",
"right",
")",
"{",
"return",
"nullEquals",
"(",
"left",
".",
"getText",
"(",
")",
",",
"right",
".",
"getText",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ClosureExpression",
"left",
",",
"ClosureExpression",
"right",
")",
"{",
"return",
"false",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ClassExpression",
"left",
",",
"ClassExpression",
"right",
")",
"{",
"return",
"visit",
"(",
"left",
".",
"getType",
"(",
")",
",",
"right",
".",
"getType",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"CastExpression",
"left",
",",
"CastExpression",
"right",
")",
"{",
"return",
"visit",
"(",
"left",
".",
"getType",
"(",
")",
",",
"right",
".",
"getType",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"BooleanExpression",
"left",
",",
"BooleanExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"BitwiseNegationExpression",
"left",
",",
"BitwiseNegationExpression",
"right",
")",
"{",
"return",
"isSame",
"(",
"left",
".",
"getExpression",
"(",
")",
",",
"right",
".",
"getExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"BinaryExpression",
"left",
",",
"BinaryExpression",
"right",
")",
"{",
"return",
"left",
".",
"getOperation",
"(",
")",
".",
"getType",
"(",
")",
"==",
"right",
".",
"getOperation",
"(",
")",
".",
"getType",
"(",
")",
"&&",
"isSame",
"(",
"left",
".",
"getLeftExpression",
"(",
")",
",",
"right",
".",
"getLeftExpression",
"(",
")",
")",
"&&",
"isSame",
"(",
"left",
".",
"getRightExpression",
"(",
")",
",",
"right",
".",
"getRightExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ArrayExpression",
"left",
",",
"ArrayExpression",
"right",
")",
"{",
"return",
"checkExpressionList",
"(",
"left",
".",
"getExpressions",
"(",
")",
",",
"right",
".",
"getExpressions",
"(",
")",
")",
"&&",
"checkExpressionList",
"(",
"left",
".",
"getSizeExpression",
"(",
")",
",",
"right",
".",
"getSizeExpression",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"visit",
"(",
"ClassNode",
"left",
",",
"ClassNode",
"right",
")",
"{",
"return",
"nullEquals",
"(",
"left",
",",
"right",
")",
";",
"}",
"private",
"boolean",
"nullEquals",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"{",
"if",
"(",
"left",
"==",
"null",
"&&",
"right",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"left",
"==",
"null",
"||",
"right",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"left",
".",
"equals",
"(",
"right",
")",
";",
"}",
"}",
"private",
"<",
"T",
"extends",
"Expression",
">",
"boolean",
"checkExpressionList",
"(",
"List",
"<",
"T",
">",
"left",
",",
"List",
"<",
"T",
">",
"right",
")",
"{",
"if",
"(",
"right",
"==",
"null",
"&&",
"left",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"right",
"==",
"null",
"||",
"left",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"left",
".",
"size",
"(",
")",
"!=",
"right",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Iterator",
"<",
"T",
">",
"leftIter",
"=",
"left",
".",
"iterator",
"(",
")",
";",
"Iterator",
"<",
"T",
">",
"rightIter",
"=",
"right",
".",
"iterator",
"(",
")",
";",
"boolean",
"success",
"=",
"true",
";",
"while",
"(",
"leftIter",
".",
"hasNext",
"(",
")",
"&&",
"rightIter",
".",
"hasNext",
"(",
")",
")",
"{",
"success",
"&=",
"isSame",
"(",
"leftIter",
".",
"next",
"(",
")",
",",
"rightIter",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"success",
";",
"}",
"}",
"</s>"
] |
6,084 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Plugin",
";",
"public",
"class",
"GroovyBrowsingPlugin",
"extends",
"Plugin",
"{",
"private",
"static",
"GroovyBrowsingPlugin",
"plugin",
";",
"public",
"GroovyBrowsingPlugin",
"(",
")",
"{",
"plugin",
"=",
"this",
";",
"}",
"public",
"static",
"GroovyBrowsingPlugin",
"getDefault",
"(",
")",
"{",
"return",
"plugin",
";",
"}",
"}",
"</s>"
] |
6,085 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"IsSameExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"syntax",
".",
"Token",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"public",
"class",
"BinaryExpressionFragment",
"implements",
"IASTFragment",
"{",
"private",
"final",
"Token",
"token",
";",
"private",
"final",
"Expression",
"expression",
";",
"private",
"final",
"IASTFragment",
"next",
";",
"private",
"int",
"actualStartPosition",
";",
"BinaryExpressionFragment",
"(",
"Token",
"token",
",",
"Expression",
"expression",
",",
"IASTFragment",
"next",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"next",
")",
";",
"this",
".",
"token",
"=",
"token",
";",
"this",
".",
"expression",
"=",
"expression",
";",
"this",
".",
"next",
"=",
"next",
";",
"this",
".",
"actualStartPosition",
"=",
"expression",
".",
"getStart",
"(",
")",
";",
"}",
"void",
"setActualStartPosition",
"(",
"int",
"actualStartPosition",
")",
"{",
"this",
".",
"actualStartPosition",
"=",
"actualStartPosition",
";",
"}",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
"{",
"return",
"expression",
";",
"}",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
"{",
"return",
"expression",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"getNext",
"(",
")",
".",
"getEnd",
"(",
")",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"actualStartPosition",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"return",
"getEnd",
"(",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getNext",
"(",
")",
".",
"getTrimmedEnd",
"(",
"unit",
")",
";",
"}",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getTrimmedEnd",
"(",
"unit",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"Token",
"getToken",
"(",
")",
"{",
"return",
"token",
";",
"}",
"public",
"IASTFragment",
"getNext",
"(",
")",
"{",
"return",
"next",
";",
"}",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"!",
"(",
"other",
"instanceof",
"BinaryExpressionFragment",
")",
")",
"{",
"return",
"false",
";",
"}",
"BinaryExpressionFragment",
"otherBinary",
"=",
"(",
"BinaryExpressionFragment",
")",
"other",
";",
"return",
"otherBinary",
".",
"getToken",
"(",
")",
".",
"getText",
"(",
")",
".",
"equals",
"(",
"this",
".",
"token",
".",
"getText",
"(",
")",
")",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"expression",
",",
"otherBinary",
".",
"getAssociatedExpression",
"(",
")",
")",
"&&",
"this",
".",
"next",
".",
"matches",
"(",
"otherBinary",
".",
"getNext",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"print",
"(",
"0",
")",
";",
"}",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
"{",
"return",
"ASTFragmentFactory",
".",
"spaces",
"(",
"indentLvl",
")",
"+",
"\"(B)",
"\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\"n\"",
"+",
"next",
".",
"print",
"(",
"indentLvl",
"+",
"1",
")",
";",
"}",
"public",
"int",
"fragmentLength",
"(",
")",
"{",
"return",
"1",
"+",
"next",
".",
"fragmentLength",
"(",
")",
";",
"}",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"previsit",
"(",
"this",
")",
"&&",
"visitor",
".",
"visit",
"(",
"this",
")",
")",
"{",
"next",
".",
"accept",
"(",
"visitor",
")",
";",
"}",
"}",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
"{",
"return",
"ASTFragmentKind",
".",
"BINARY",
";",
"}",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"this",
".",
"fragmentLength",
"(",
")",
"<",
"other",
".",
"fragmentLength",
"(",
")",
")",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"if",
"(",
"other",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"other",
".",
"getAssociatedExpression",
"(",
")",
")",
")",
"{",
"return",
"new",
"SimpleExpressionASTFragment",
"(",
"expression",
")",
";",
"}",
"else",
"if",
"(",
"other",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"BINARY",
")",
"{",
"BinaryExpressionFragment",
"otherBinary",
"=",
"(",
"BinaryExpressionFragment",
")",
"other",
";",
"if",
"(",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"other",
".",
"getAssociatedExpression",
"(",
")",
")",
"&&",
"this",
".",
"getToken",
"(",
")",
".",
"getText",
"(",
")",
".",
"equals",
"(",
"otherBinary",
".",
"getToken",
"(",
")",
".",
"getText",
"(",
")",
")",
")",
"{",
"IASTFragment",
"result",
"=",
"this",
".",
"next",
".",
"findMatchingSubFragment",
"(",
"otherBinary",
".",
"next",
")",
";",
"if",
"(",
"result",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
")",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"else",
"{",
"BinaryExpressionFragment",
"newResult",
"=",
"new",
"BinaryExpressionFragment",
"(",
"token",
",",
"expression",
",",
"result",
")",
";",
"newResult",
".",
"setActualStartPosition",
"(",
"actualStartPosition",
")",
";",
"return",
"newResult",
";",
"}",
"}",
"}",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,086 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"IsSameExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"public",
"class",
"MethodCallFragment",
"implements",
"IASTFragment",
"{",
"private",
"final",
"Expression",
"arguments",
";",
"private",
"final",
"Expression",
"methodExpression",
";",
"private",
"final",
"IASTFragment",
"next",
";",
"private",
"int",
"actualEndPosition",
";",
"MethodCallFragment",
"(",
"Expression",
"methodExpression",
",",
"Expression",
"arguments",
",",
"IASTFragment",
"next",
",",
"int",
"actualEndPosition",
")",
"{",
"this",
".",
"methodExpression",
"=",
"methodExpression",
";",
"this",
".",
"arguments",
"=",
"arguments",
";",
"this",
".",
"next",
"=",
"next",
";",
"this",
".",
"actualEndPosition",
"=",
"actualEndPosition",
";",
"}",
"public",
"MethodCallFragment",
"(",
"Expression",
"methodExpression",
",",
"Expression",
"arguments",
",",
"int",
"actualEndPosition",
")",
"{",
"this",
"(",
"methodExpression",
",",
"arguments",
",",
"null",
",",
"actualEndPosition",
")",
";",
"}",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"next",
"!=",
"null",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"hasNext",
"(",
")",
"?",
"next",
".",
"getEnd",
"(",
")",
":",
"actualEndPosition",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"methodExpression",
".",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"return",
"getEnd",
"(",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"if",
"(",
"hasNext",
"(",
")",
")",
"{",
"return",
"getNext",
"(",
")",
".",
"getTrimmedEnd",
"(",
"unit",
")",
";",
"}",
"else",
"{",
"char",
"[",
"]",
"contents",
"=",
"unit",
".",
"getContents",
"(",
")",
";",
"int",
"end",
"=",
"actualEndPosition",
";",
"while",
"(",
"end",
">",
"methodExpression",
".",
"getStart",
"(",
")",
"&&",
"Character",
".",
"isWhitespace",
"(",
"contents",
"[",
"end",
"]",
")",
")",
"{",
"end",
"--",
";",
"}",
"return",
"end",
";",
"}",
"}",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getTrimmedEnd",
"(",
"unit",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"Expression",
"getArguments",
"(",
")",
"{",
"return",
"arguments",
";",
"}",
"public",
"IASTFragment",
"getNext",
"(",
")",
"{",
"return",
"next",
";",
"}",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"!",
"(",
"other",
"instanceof",
"MethodCallFragment",
")",
")",
"{",
"return",
"false",
";",
"}",
"MethodCallFragment",
"otherCall",
"=",
"(",
"MethodCallFragment",
")",
"other",
";",
"if",
"(",
"otherCall",
".",
"hasNext",
"(",
")",
"!=",
"hasNext",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"arguments",
",",
"otherCall",
".",
"getArguments",
"(",
")",
")",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"methodExpression",
",",
"otherCall",
".",
"getAssociatedExpression",
"(",
")",
")",
";",
"}",
"public",
"int",
"fragmentLength",
"(",
")",
"{",
"return",
"hasNext",
"(",
")",
"?",
"1",
"+",
"next",
".",
"fragmentLength",
"(",
")",
":",
"1",
";",
"}",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
"{",
"return",
"methodExpression",
";",
"}",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
"{",
"return",
"methodExpression",
";",
"}",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
"{",
"return",
"ASTFragmentFactory",
".",
"spaces",
"(",
"indentLvl",
")",
"+",
"\"(M)",
"\"",
"+",
"methodExpression",
"+",
"\".\"",
"+",
"arguments",
"+",
"(",
"hasNext",
"(",
")",
"?",
"\"n\"",
"+",
"next",
".",
"print",
"(",
"indentLvl",
"+",
"1",
")",
":",
"\"\"",
")",
";",
"}",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"previsit",
"(",
"this",
")",
"&&",
"visitor",
".",
"visit",
"(",
"this",
")",
"&&",
"hasNext",
"(",
")",
")",
"{",
"next",
".",
"accept",
"(",
"visitor",
")",
";",
"}",
"}",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
"{",
"return",
"ASTFragmentKind",
".",
"METHOD_CALL",
";",
"}",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"other",
".",
"fragmentLength",
"(",
")",
">",
"this",
".",
"fragmentLength",
"(",
")",
")",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"if",
"(",
"other",
".",
"kind",
"(",
")",
"==",
"this",
".",
"kind",
"(",
")",
")",
"{",
"MethodCallFragment",
"toMatchCall",
"=",
"(",
"MethodCallFragment",
")",
"other",
";",
"if",
"(",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"toMatchCall",
".",
"getAssociatedExpression",
"(",
")",
")",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getArguments",
"(",
")",
",",
"toMatchCall",
".",
"getArguments",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"toMatchCall",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"new",
"MethodCallFragment",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"this",
".",
"getArguments",
"(",
")",
",",
"this",
".",
"actualEndPosition",
")",
";",
"}",
"else",
"{",
"IASTFragment",
"result",
"=",
"this",
".",
"getNext",
"(",
")",
".",
"findMatchingSubFragment",
"(",
"toMatchCall",
".",
"getNext",
"(",
")",
")",
";",
"if",
"(",
"result",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
")",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"else",
"{",
"MethodCallFragment",
"newFragment",
"=",
"new",
"MethodCallFragment",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"this",
".",
"getArguments",
"(",
")",
",",
"result",
",",
"this",
".",
"actualEndPosition",
")",
";",
"return",
"newFragment",
";",
"}",
"}",
"}",
"}",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,087 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"public",
"class",
"EnclosingASTNodeFragment",
"implements",
"IASTFragment",
"{",
"private",
"final",
"ASTNode",
"node",
";",
"EnclosingASTNodeFragment",
"(",
"ASTNode",
"node",
")",
"{",
"this",
".",
"node",
"=",
"node",
";",
"}",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
"{",
"visitor",
".",
"previsit",
"(",
"this",
")",
";",
"visitor",
".",
"visit",
"(",
"this",
")",
";",
"}",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
"{",
"return",
"null",
";",
"}",
"public",
"int",
"fragmentLength",
"(",
")",
"{",
"return",
"1",
";",
"}",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
"{",
"Assert",
".",
"isLegal",
"(",
"false",
",",
"\"\"",
")",
";",
"return",
"null",
";",
"}",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"node",
".",
"getEnd",
"(",
")",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"node",
".",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"return",
"getEnd",
"(",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"char",
"[",
"]",
"contents",
"=",
"unit",
".",
"getContents",
"(",
")",
";",
"int",
"end",
"=",
"getEnd",
"(",
")",
";",
"int",
"start",
"=",
"node",
".",
"getStart",
"(",
")",
";",
"while",
"(",
"end",
">",
"start",
"&&",
"Character",
".",
"isWhitespace",
"(",
"contents",
"[",
"end",
"]",
")",
")",
"{",
"end",
"--",
";",
"}",
"return",
"end",
";",
"}",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getTrimmedEnd",
"(",
"unit",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
"{",
"return",
"ASTFragmentKind",
".",
"ENCLOSING",
";",
"}",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
"{",
"return",
"this",
".",
"kind",
"(",
")",
"==",
"other",
".",
"kind",
"(",
")",
"&&",
"this",
".",
"node",
"==",
"(",
"(",
"EnclosingASTNodeFragment",
")",
"other",
")",
".",
"getAssociatedNode",
"(",
")",
";",
"}",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
"{",
"return",
"\"(E)",
"\"",
"+",
"node",
".",
"toString",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"print",
"(",
"0",
")",
";",
"}",
"}",
"</s>"
] |
6,088 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"IsSameExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"public",
"class",
"PropertyExpressionFragment",
"implements",
"IASTFragment",
"{",
"private",
"final",
"ASTFragmentKind",
"kind",
";",
"private",
"final",
"Expression",
"expression",
";",
"private",
"final",
"IASTFragment",
"next",
";",
"PropertyExpressionFragment",
"(",
"ASTFragmentKind",
"token",
",",
"Expression",
"expression",
",",
"IASTFragment",
"next",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"next",
")",
";",
"this",
".",
"kind",
"=",
"token",
";",
"this",
".",
"expression",
"=",
"expression",
";",
"this",
".",
"next",
"=",
"next",
";",
"}",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
"{",
"return",
"expression",
";",
"}",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
"{",
"return",
"expression",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"getNext",
"(",
")",
".",
"getEnd",
"(",
")",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"expression",
".",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"return",
"getEnd",
"(",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getNext",
"(",
")",
".",
"getTrimmedEnd",
"(",
"unit",
")",
";",
"}",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getTrimmedEnd",
"(",
"unit",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"IASTFragment",
"getNext",
"(",
")",
"{",
"return",
"next",
";",
"}",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"!",
"(",
"other",
"instanceof",
"PropertyExpressionFragment",
")",
")",
"{",
"return",
"false",
";",
"}",
"PropertyExpressionFragment",
"otherBinary",
"=",
"(",
"PropertyExpressionFragment",
")",
"other",
";",
"return",
"otherBinary",
".",
"kind",
"(",
")",
"==",
"this",
".",
"kind",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"expression",
",",
"otherBinary",
".",
"getAssociatedExpression",
"(",
")",
")",
"&&",
"this",
".",
"next",
".",
"matches",
"(",
"otherBinary",
".",
"getNext",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"print",
"(",
"0",
")",
";",
"}",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
"{",
"return",
"ASTFragmentFactory",
".",
"spaces",
"(",
"indentLvl",
")",
"+",
"\"(P)",
"\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\"n\"",
"+",
"next",
".",
"print",
"(",
"indentLvl",
"+",
"1",
")",
";",
"}",
"public",
"int",
"fragmentLength",
"(",
")",
"{",
"return",
"1",
"+",
"next",
".",
"fragmentLength",
"(",
")",
";",
"}",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"previsit",
"(",
"this",
")",
"&&",
"visitor",
".",
"visit",
"(",
"this",
")",
")",
"{",
"next",
".",
"accept",
"(",
"visitor",
")",
";",
"}",
"}",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
"{",
"return",
"kind",
";",
"}",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"this",
".",
"fragmentLength",
"(",
")",
"<",
"other",
".",
"fragmentLength",
"(",
")",
")",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"if",
"(",
"other",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"other",
".",
"getAssociatedExpression",
"(",
")",
")",
")",
"{",
"return",
"new",
"SimpleExpressionASTFragment",
"(",
"expression",
")",
";",
"}",
"else",
"if",
"(",
"other",
".",
"kind",
"(",
")",
"==",
"this",
".",
"kind",
"(",
")",
")",
"{",
"PropertyExpressionFragment",
"toMatchBinary",
"=",
"(",
"PropertyExpressionFragment",
")",
"other",
";",
"if",
"(",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"toMatchBinary",
".",
"getAssociatedExpression",
"(",
")",
")",
")",
"{",
"IASTFragment",
"result",
"=",
"this",
".",
"getNext",
"(",
")",
".",
"findMatchingSubFragment",
"(",
"toMatchBinary",
".",
"getNext",
"(",
")",
")",
";",
"if",
"(",
"result",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
")",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
"PropertyExpressionFragment",
"(",
"this",
".",
"kind",
"(",
")",
",",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"result",
")",
";",
"}",
"}",
"}",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,089 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"public",
"interface",
"IASTFragment",
"{",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
";",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
";",
"public",
"int",
"getStart",
"(",
")",
";",
"public",
"int",
"getEnd",
"(",
")",
";",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
";",
"public",
"int",
"getLength",
"(",
")",
";",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
";",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
";",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
";",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
";",
"public",
"int",
"fragmentLength",
"(",
")",
";",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
";",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
";",
"}",
"</s>"
] |
6,090 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"EmptyExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"public",
"class",
"EmptyASTFragment",
"implements",
"IASTFragment",
"{",
"private",
"static",
"final",
"EmptyExpression",
"emptyExpression",
"=",
"new",
"EmptyExpression",
"(",
")",
";",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
"{",
"visitor",
".",
"previsit",
"(",
"this",
")",
";",
"visitor",
".",
"visit",
"(",
"this",
")",
";",
"}",
"public",
"int",
"fragmentLength",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
"{",
"return",
"emptyExpression",
";",
"}",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
"{",
"return",
"emptyExpression",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getTrimmedEnd",
"(",
"unit",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
"{",
"return",
"ASTFragmentKind",
".",
"EMPTY",
";",
"}",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
"{",
"return",
"other",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
";",
"}",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
"{",
"return",
"ASTFragmentFactory",
".",
"spaces",
"(",
"indentLvl",
")",
"+",
"\"(E)",
"empty\"",
";",
"}",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
"{",
"return",
"this",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"print",
"(",
"0",
")",
";",
"}",
"}",
"</s>"
] |
6,091 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"public",
"abstract",
"class",
"FragmentVisitor",
"{",
"public",
"boolean",
"previsit",
"(",
"IASTFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"PropertyExpressionFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"MethodCallFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"SimpleExpressionASTFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"BinaryExpressionFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"EnclosingASTNodeFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"EmptyASTFragment",
"fragment",
")",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
6,092 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BooleanExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"DeclarationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodPointerExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PropertyExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TupleExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"syntax",
".",
"Token",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"public",
"class",
"ASTFragmentFactory",
"{",
"public",
"IASTFragment",
"createFragment",
"(",
"ASTNode",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"Expression",
")",
"{",
"return",
"createFragment",
"(",
"(",
"Expression",
")",
"node",
")",
";",
"}",
"else",
"{",
"return",
"new",
"EnclosingASTNodeFragment",
"(",
"node",
")",
";",
"}",
"}",
"public",
"IASTFragment",
"createFragment",
"(",
"Expression",
"expression",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"Assert",
".",
"isLegal",
"(",
"expression",
".",
"getStart",
"(",
")",
"<=",
"start",
",",
"\"\"",
"+",
"start",
")",
";",
"Assert",
".",
"isLegal",
"(",
"expression",
".",
"getEnd",
"(",
")",
">=",
"end",
",",
"\"\"",
"+",
"end",
")",
";",
"if",
"(",
"expression",
"instanceof",
"BooleanExpression",
")",
"{",
"Expression",
"inner",
"=",
"(",
"(",
"BooleanExpression",
")",
"expression",
")",
".",
"getExpression",
"(",
")",
";",
"if",
"(",
"inner",
".",
"getStart",
"(",
")",
"==",
"expression",
".",
"getStart",
"(",
")",
"&&",
"inner",
".",
"getEnd",
"(",
")",
"==",
"expression",
".",
"getEnd",
"(",
")",
")",
"{",
"expression",
"=",
"inner",
";",
"}",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"TupleExpression",
"&&",
"(",
"(",
"TupleExpression",
")",
"expression",
")",
".",
"getExpressions",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"Expression",
"inner",
"=",
"(",
"(",
"TupleExpression",
")",
"expression",
")",
".",
"getExpression",
"(",
"0",
")",
";",
"if",
"(",
"inner",
".",
"getStart",
"(",
")",
"==",
"expression",
".",
"getStart",
"(",
")",
"&&",
"inner",
".",
"getEnd",
"(",
")",
"==",
"expression",
".",
"getEnd",
"(",
")",
")",
"{",
"expression",
"=",
"inner",
";",
"}",
"}",
"if",
"(",
"expression",
"instanceof",
"BinaryExpression",
")",
"{",
"IASTFragment",
"fragment",
"=",
"createBinaryFragment",
"(",
"(",
"BinaryExpression",
")",
"expression",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"expression",
"instanceof",
"DeclarationExpression",
")",
"{",
"if",
"(",
"fragment",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"BINARY",
")",
"{",
"(",
"(",
"BinaryExpressionFragment",
")",
"fragment",
")",
".",
"setActualStartPosition",
"(",
"(",
"(",
"DeclarationExpression",
")",
"expression",
")",
".",
"getStart",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"fragment",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
"{",
"(",
"(",
"SimpleExpressionASTFragment",
")",
"fragment",
")",
".",
"setActualStartPosition",
"(",
"(",
"(",
"DeclarationExpression",
")",
"expression",
")",
".",
"getStart",
"(",
")",
")",
";",
"}",
"}",
"return",
"fragment",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"PropertyExpression",
")",
"{",
"return",
"createPropertyBasedFragment",
"(",
"expression",
",",
"start",
",",
"end",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"MethodCallExpression",
")",
"{",
"return",
"createPropertyBasedFragment",
"(",
"expression",
",",
"start",
",",
"end",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"MethodPointerExpression",
")",
"{",
"return",
"createPropertyBasedFragment",
"(",
"expression",
",",
"start",
",",
"end",
")",
";",
"}",
"else",
"if",
"(",
"expression",
".",
"getStart",
"(",
")",
"==",
"start",
"&&",
"expression",
".",
"getEnd",
"(",
")",
"==",
"end",
")",
"{",
"return",
"new",
"SimpleExpressionASTFragment",
"(",
"expression",
")",
";",
"}",
"else",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"}",
"public",
"IASTFragment",
"createFragment",
"(",
"Expression",
"expression",
")",
"{",
"return",
"createFragment",
"(",
"expression",
",",
"expression",
".",
"getStart",
"(",
")",
",",
"expression",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"private",
"IASTFragment",
"createBinaryFragment",
"(",
"BinaryExpression",
"expression",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"List",
"<",
"Expression",
">",
"exprs",
"=",
"new",
"ArrayList",
"<",
"Expression",
">",
"(",
")",
";",
"List",
"<",
"Token",
">",
"tokens",
"=",
"new",
"ArrayList",
"<",
"Token",
">",
"(",
")",
";",
"walkBinaryExpr",
"(",
"expression",
",",
"exprs",
",",
"tokens",
")",
";",
"Expression",
"firstExpr",
"=",
"exprs",
".",
"get",
"(",
"exprs",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"IASTFragment",
"next",
"=",
"new",
"EmptyASTFragment",
"(",
")",
";",
"if",
"(",
"firstExpr",
".",
"getStart",
"(",
")",
">=",
"start",
"&&",
"firstExpr",
".",
"getEnd",
"(",
")",
"<=",
"end",
")",
"{",
"next",
"=",
"new",
"SimpleExpressionASTFragment",
"(",
"firstExpr",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"tokens",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"Expression",
"nextExpr",
"=",
"exprs",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"nextExpr",
".",
"getStart",
"(",
")",
">=",
"start",
"&&",
"nextExpr",
".",
"getEnd",
"(",
")",
"<=",
"end",
")",
"{",
"if",
"(",
"next",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
")",
"{",
"next",
"=",
"new",
"SimpleExpressionASTFragment",
"(",
"nextExpr",
")",
";",
"}",
"else",
"{",
"next",
"=",
"new",
"BinaryExpressionFragment",
"(",
"tokens",
".",
"get",
"(",
"i",
")",
",",
"nextExpr",
",",
"next",
")",
";",
"}",
"}",
"}",
"return",
"next",
";",
"}",
"private",
"void",
"walkBinaryExpr",
"(",
"BinaryExpression",
"expression",
",",
"List",
"<",
"Expression",
">",
"exprs",
",",
"List",
"<",
"Token",
">",
"tokens",
")",
"{",
"if",
"(",
"expression",
".",
"getLeftExpression",
"(",
")",
"instanceof",
"BinaryExpression",
")",
"{",
"walkBinaryExpr",
"(",
"(",
"BinaryExpression",
")",
"expression",
".",
"getLeftExpression",
"(",
")",
",",
"exprs",
",",
"tokens",
")",
";",
"}",
"else",
"{",
"exprs",
".",
"add",
"(",
"expression",
".",
"getLeftExpression",
"(",
")",
")",
";",
"}",
"tokens",
".",
"add",
"(",
"expression",
".",
"getOperation",
"(",
")",
")",
";",
"if",
"(",
"expression",
".",
"getRightExpression",
"(",
")",
"instanceof",
"BinaryExpression",
")",
"{",
"walkBinaryExpr",
"(",
"(",
"BinaryExpression",
")",
"expression",
".",
"getRightExpression",
"(",
")",
",",
"exprs",
",",
"tokens",
")",
";",
"}",
"else",
"{",
"exprs",
".",
"add",
"(",
"expression",
".",
"getRightExpression",
"(",
")",
")",
";",
"}",
"}",
"private",
"IASTFragment",
"createPropertyBasedFragment",
"(",
"Expression",
"expression",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"List",
"<",
"ASTFragmentKind",
">",
"kinds",
"=",
"new",
"ArrayList",
"<",
"ASTFragmentKind",
">",
"(",
")",
";",
"List",
"<",
"Expression",
">",
"exprs",
"=",
"new",
"ArrayList",
"<",
"Expression",
">",
"(",
")",
";",
"List",
"<",
"Expression",
">",
"args",
"=",
"new",
"ArrayList",
"<",
"Expression",
">",
"(",
")",
";",
"List",
"<",
"Integer",
">",
"ends",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"walkPropertyExpr",
"(",
"expression",
",",
"exprs",
",",
"args",
",",
"kinds",
",",
"ends",
")",
";",
"IASTFragment",
"prev",
"=",
"new",
"EmptyASTFragment",
"(",
")",
";",
"boolean",
"wasImplicitCall",
"=",
"false",
";",
"Expression",
"firstExpr",
"=",
"exprs",
".",
"get",
"(",
"exprs",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"if",
"(",
"firstExpr",
".",
"getStart",
"(",
")",
">=",
"start",
"&&",
"firstExpr",
".",
"getEnd",
"(",
")",
"<=",
"end",
")",
"{",
"if",
"(",
"kinds",
".",
"get",
"(",
"kinds",
".",
"size",
"(",
")",
"-",
"1",
")",
"==",
"ASTFragmentKind",
".",
"METHOD_CALL",
")",
"{",
"prev",
"=",
"new",
"MethodCallFragment",
"(",
"firstExpr",
",",
"args",
".",
"get",
"(",
"exprs",
".",
"size",
"(",
")",
"-",
"1",
")",
",",
"ends",
".",
"get",
"(",
"exprs",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
";",
"}",
"else",
"{",
"prev",
"=",
"new",
"SimpleExpressionASTFragment",
"(",
"firstExpr",
")",
";",
"}",
"}",
"else",
"if",
"(",
"checkWasImplicitCall",
"(",
"firstExpr",
")",
")",
"{",
"wasImplicitCall",
"=",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"exprs",
".",
"size",
"(",
")",
"-",
"2",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"Expression",
"expr",
"=",
"exprs",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"expr",
".",
"getStart",
"(",
")",
">=",
"start",
"&&",
"expr",
".",
"getEnd",
"(",
")",
"<=",
"end",
")",
"{",
"if",
"(",
"kinds",
".",
"get",
"(",
"i",
")",
"==",
"ASTFragmentKind",
".",
"METHOD_CALL",
")",
"{",
"prev",
"=",
"new",
"MethodCallFragment",
"(",
"expr",
",",
"args",
".",
"get",
"(",
"i",
")",
",",
"prev",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
"?",
"null",
":",
"prev",
",",
"ends",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"prev",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"EMPTY",
")",
"{",
"if",
"(",
"!",
"wasImplicitCall",
")",
"{",
"prev",
"=",
"new",
"SimpleExpressionASTFragment",
"(",
"expr",
")",
";",
"}",
"else",
"{",
"prev",
"=",
"new",
"MethodCallFragment",
"(",
"expr",
",",
"args",
".",
"get",
"(",
"i",
"+",
"1",
")",
",",
"null",
",",
"ends",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"wasImplicitCall",
")",
"{",
"prev",
"=",
"new",
"PropertyExpressionFragment",
"(",
"kinds",
".",
"get",
"(",
"i",
")",
",",
"expr",
",",
"prev",
")",
";",
"}",
"else",
"{",
"prev",
"=",
"new",
"MethodCallFragment",
"(",
"expr",
",",
"args",
".",
"get",
"(",
"i",
"+",
"1",
")",
",",
"prev",
",",
"ends",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}",
"}",
"wasImplicitCall",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"checkWasImplicitCall",
"(",
"expr",
")",
")",
"{",
"wasImplicitCall",
"=",
"true",
";",
"}",
"}",
"return",
"prev",
";",
"}",
"private",
"boolean",
"checkWasImplicitCall",
"(",
"Expression",
"firstExpr",
")",
"{",
"return",
"firstExpr",
".",
"getEnd",
"(",
")",
"==",
"0",
"&&",
"firstExpr",
"instanceof",
"ConstantExpression",
"&&",
"(",
"(",
"ConstantExpression",
")",
"firstExpr",
")",
".",
"getText",
"(",
")",
".",
"equals",
"(",
"\"call\"",
")",
";",
"}",
"private",
"void",
"walkPropertyExpr",
"(",
"Expression",
"startExpression",
",",
"List",
"<",
"Expression",
">",
"targetExprs",
",",
"List",
"<",
"Expression",
">",
"targetArgs",
",",
"List",
"<",
"ASTFragmentKind",
">",
"targetKinds",
",",
"List",
"<",
"Integer",
">",
"targetEnds",
")",
"{",
"if",
"(",
"startExpression",
"instanceof",
"PropertyExpression",
")",
"{",
"PropertyExpression",
"propertyExpression",
"=",
"(",
"PropertyExpression",
")",
"startExpression",
";",
"ASTFragmentKind",
"kind",
"=",
"ASTFragmentKind",
".",
"toPropertyKind",
"(",
"propertyExpression",
")",
";",
"walkPropertyExpr",
"(",
"propertyExpression",
".",
"getObjectExpression",
"(",
")",
",",
"targetExprs",
",",
"targetArgs",
",",
"targetKinds",
",",
"targetEnds",
")",
";",
"int",
"toRemove",
"=",
"targetKinds",
".",
"size",
"(",
")",
"-",
"1",
";",
"if",
"(",
"targetKinds",
".",
"get",
"(",
"toRemove",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
"{",
"targetKinds",
".",
"set",
"(",
"toRemove",
",",
"kind",
")",
";",
"targetArgs",
".",
"set",
"(",
"toRemove",
",",
"null",
")",
";",
"}",
"walkPropertyExpr",
"(",
"propertyExpression",
".",
"getProperty",
"(",
")",
",",
"targetExprs",
",",
"targetArgs",
",",
"targetKinds",
",",
"targetEnds",
")",
";",
"}",
"else",
"if",
"(",
"startExpression",
"instanceof",
"MethodCallExpression",
")",
"{",
"MethodCallExpression",
"methodCallExpression",
"=",
"(",
"MethodCallExpression",
")",
"startExpression",
";",
"walkPropertyExpr",
"(",
"methodCallExpression",
".",
"getObjectExpression",
"(",
")",
",",
"targetExprs",
",",
"targetArgs",
",",
"targetKinds",
",",
"targetEnds",
")",
";",
"int",
"toRemove",
"=",
"targetKinds",
".",
"size",
"(",
")",
"-",
"1",
";",
"if",
"(",
"targetKinds",
".",
"get",
"(",
"toRemove",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
"{",
"targetKinds",
".",
"set",
"(",
"toRemove",
",",
"ASTFragmentKind",
".",
"PROPERTY",
")",
";",
"targetArgs",
".",
"set",
"(",
"toRemove",
",",
"null",
")",
";",
"}",
"walkPropertyExpr",
"(",
"methodCallExpression",
".",
"getMethod",
"(",
")",
",",
"targetExprs",
",",
"targetArgs",
",",
"targetKinds",
",",
"targetEnds",
")",
";",
"toRemove",
"=",
"targetKinds",
".",
"size",
"(",
")",
"-",
"1",
";",
"targetKinds",
".",
"set",
"(",
"toRemove",
",",
"ASTFragmentKind",
".",
"METHOD_CALL",
")",
";",
"targetArgs",
".",
"set",
"(",
"toRemove",
",",
"methodCallExpression",
".",
"getArguments",
"(",
")",
")",
";",
"targetEnds",
".",
"set",
"(",
"toRemove",
",",
"methodCallExpression",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"startExpression",
"instanceof",
"MethodPointerExpression",
")",
"{",
"MethodPointerExpression",
"methodPointerExpression",
"=",
"(",
"MethodPointerExpression",
")",
"startExpression",
";",
"walkPropertyExpr",
"(",
"methodPointerExpression",
".",
"getExpression",
"(",
")",
",",
"targetExprs",
",",
"targetArgs",
",",
"targetKinds",
",",
"targetEnds",
")",
";",
"int",
"toRemove",
"=",
"targetKinds",
".",
"size",
"(",
")",
"-",
"1",
";",
"if",
"(",
"targetKinds",
".",
"get",
"(",
"toRemove",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
"{",
"targetKinds",
".",
"set",
"(",
"toRemove",
",",
"ASTFragmentKind",
".",
"METHOD_POINTER",
")",
";",
"targetArgs",
".",
"set",
"(",
"toRemove",
",",
"null",
")",
";",
"}",
"walkPropertyExpr",
"(",
"methodPointerExpression",
".",
"getMethodName",
"(",
")",
",",
"targetExprs",
",",
"targetArgs",
",",
"targetKinds",
",",
"targetEnds",
")",
";",
"}",
"else",
"{",
"targetKinds",
".",
"add",
"(",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
")",
";",
"targetArgs",
".",
"add",
"(",
"null",
")",
";",
"targetExprs",
".",
"add",
"(",
"startExpression",
")",
";",
"targetEnds",
".",
"add",
"(",
"startExpression",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"}",
"public",
"static",
"String",
"spaces",
"(",
"int",
"num",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"while",
"(",
"num",
"--",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,093 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodPointerExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"PropertyExpression",
";",
"public",
"enum",
"ASTFragmentKind",
"{",
"PROPERTY",
",",
"SAFE_PROPERTY",
",",
"SPREAD_SAFE_PROPERTY",
",",
"METHOD_POINTER",
",",
"METHOD_CALL",
",",
"BINARY",
",",
"SIMPLE_EXPRESSION",
",",
"EMPTY",
",",
"ENCLOSING",
";",
"static",
"ASTFragmentKind",
"toPropertyKind",
"(",
"Expression",
"expr",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"PropertyExpression",
")",
"{",
"PropertyExpression",
"prop",
"=",
"(",
"PropertyExpression",
")",
"expr",
";",
"if",
"(",
"prop",
".",
"isSafe",
"(",
")",
")",
"{",
"return",
"SAFE_PROPERTY",
";",
"}",
"else",
"if",
"(",
"prop",
".",
"isSpreadSafe",
"(",
")",
")",
"{",
"return",
"SPREAD_SAFE_PROPERTY",
";",
"}",
"else",
"{",
"return",
"PROPERTY",
";",
"}",
"}",
"else",
"if",
"(",
"expr",
"instanceof",
"MethodPointerExpression",
")",
"{",
"return",
"METHOD_POINTER",
";",
"}",
"else",
"if",
"(",
"expr",
"instanceof",
"MethodCallExpression",
")",
"{",
"return",
"METHOD_CALL",
";",
"}",
"else",
"if",
"(",
"expr",
"instanceof",
"BinaryExpression",
")",
"{",
"return",
"BINARY",
";",
"}",
"else",
"{",
"return",
"SIMPLE_EXPRESSION",
";",
"}",
"}",
"public",
"static",
"boolean",
"isExpressionKind",
"(",
"IASTFragment",
"fragment",
")",
"{",
"if",
"(",
"fragment",
"==",
"null",
")",
"return",
"false",
";",
"ASTFragmentKind",
"kind",
"=",
"fragment",
".",
"kind",
"(",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"PROPERTY",
":",
"case",
"SAFE_PROPERTY",
":",
"case",
"SPREAD_SAFE_PROPERTY",
":",
"case",
"METHOD_POINTER",
":",
"case",
"METHOD_CALL",
":",
"case",
"BINARY",
":",
"case",
"SIMPLE_EXPRESSION",
":",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"}",
"}",
"</s>"
] |
6,094 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"IsSameExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"public",
"class",
"SimpleExpressionASTFragment",
"implements",
"IASTFragment",
"{",
"private",
"final",
"Expression",
"expression",
";",
"private",
"int",
"actualStartPosition",
";",
"SimpleExpressionASTFragment",
"(",
"Expression",
"expression",
")",
"{",
"this",
".",
"expression",
"=",
"expression",
";",
"actualStartPosition",
"=",
"expression",
".",
"getStart",
"(",
")",
";",
"}",
"public",
"Expression",
"getAssociatedExpression",
"(",
")",
"{",
"return",
"expression",
";",
"}",
"public",
"ASTNode",
"getAssociatedNode",
"(",
")",
"{",
"return",
"expression",
";",
"}",
"void",
"setActualStartPosition",
"(",
"int",
"actualStartPosition",
")",
"{",
"this",
".",
"actualStartPosition",
"=",
"actualStartPosition",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"expression",
".",
"getEnd",
"(",
")",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"actualStartPosition",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"return",
"getEnd",
"(",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"int",
"getTrimmedEnd",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"char",
"[",
"]",
"contents",
"=",
"unit",
".",
"getContents",
"(",
")",
";",
"int",
"end",
"=",
"getEnd",
"(",
")",
";",
"while",
"(",
"end",
">",
"actualStartPosition",
"&&",
"Character",
".",
"isWhitespace",
"(",
"contents",
"[",
"end",
"]",
")",
")",
"{",
"end",
"--",
";",
"}",
"return",
"end",
";",
"}",
"public",
"int",
"getTrimmedLength",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"getTrimmedEnd",
"(",
"unit",
")",
"-",
"getStart",
"(",
")",
";",
"}",
"public",
"boolean",
"matches",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"!",
"(",
"other",
"instanceof",
"SimpleExpressionASTFragment",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"expression",
",",
"other",
".",
"getAssociatedExpression",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"print",
"(",
"0",
")",
";",
"}",
"public",
"String",
"print",
"(",
"int",
"indentLvl",
")",
"{",
"return",
"ASTFragmentFactory",
".",
"spaces",
"(",
"indentLvl",
")",
"+",
"\"(S)",
"\"",
"+",
"expression",
".",
"toString",
"(",
")",
";",
"}",
"public",
"int",
"fragmentLength",
"(",
")",
"{",
"return",
"1",
";",
"}",
"public",
"void",
"accept",
"(",
"FragmentVisitor",
"visitor",
")",
"{",
"visitor",
".",
"previsit",
"(",
"this",
")",
";",
"visitor",
".",
"visit",
"(",
"this",
")",
";",
"}",
"public",
"ASTFragmentKind",
"kind",
"(",
")",
"{",
"return",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
";",
"}",
"public",
"IASTFragment",
"findMatchingSubFragment",
"(",
"IASTFragment",
"other",
")",
"{",
"if",
"(",
"other",
".",
"kind",
"(",
")",
"==",
"ASTFragmentKind",
".",
"SIMPLE_EXPRESSION",
"&&",
"new",
"IsSameExpression",
"(",
")",
".",
"isSame",
"(",
"this",
".",
"getAssociatedExpression",
"(",
")",
",",
"other",
".",
"getAssociatedExpression",
"(",
")",
")",
")",
"{",
"return",
"new",
"SimpleExpressionASTFragment",
"(",
"expression",
")",
";",
"}",
"else",
"{",
"return",
"new",
"EmptyASTFragment",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,095 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"elements",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Variable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedBinaryType",
";",
"public",
"class",
"GroovyResolvedBinaryType",
"extends",
"ResolvedBinaryType",
"implements",
"IGroovyResolvedElement",
"{",
"private",
"final",
"String",
"extraDoc",
";",
"private",
"ASTNode",
"inferredElement",
";",
"public",
"GroovyResolvedBinaryType",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"uniqueKey",
",",
"String",
"extraDoc",
",",
"ASTNode",
"inferredElement",
")",
"{",
"super",
"(",
"parent",
",",
"name",
",",
"uniqueKey",
")",
";",
"this",
".",
"extraDoc",
"=",
"extraDoc",
";",
"this",
".",
"inferredElement",
"=",
"inferredElement",
";",
"}",
"public",
"String",
"getExtraDoc",
"(",
")",
"{",
"return",
"extraDoc",
";",
"}",
"public",
"String",
"getInferredElementName",
"(",
")",
"{",
"if",
"(",
"inferredElement",
"instanceof",
"Variable",
")",
"{",
"return",
"(",
"(",
"Variable",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"MethodNode",
")",
"{",
"return",
"(",
"(",
"MethodNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"ClassNode",
")",
"{",
"return",
"(",
"(",
"ClassNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"return",
"inferredElement",
".",
"getText",
"(",
")",
";",
"}",
"}",
"public",
"ASTNode",
"getInferredElement",
"(",
")",
"{",
"return",
"inferredElement",
";",
"}",
"}",
"</s>"
] |
6,096 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"elements",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Variable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedSourceType",
";",
"public",
"class",
"GroovyResolvedSourceType",
"extends",
"ResolvedSourceType",
"implements",
"IGroovyResolvedElement",
"{",
"private",
"final",
"String",
"extraDoc",
";",
"private",
"final",
"ASTNode",
"inferredElement",
";",
"public",
"GroovyResolvedSourceType",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"uniqueKey",
",",
"String",
"extraDoc",
",",
"ASTNode",
"inferredElement",
")",
"{",
"super",
"(",
"parent",
",",
"name",
",",
"uniqueKey",
")",
";",
"this",
".",
"extraDoc",
"=",
"extraDoc",
";",
"this",
".",
"inferredElement",
"=",
"inferredElement",
";",
"}",
"public",
"String",
"getExtraDoc",
"(",
")",
"{",
"return",
"extraDoc",
";",
"}",
"public",
"String",
"getInferredElementName",
"(",
")",
"{",
"if",
"(",
"inferredElement",
"instanceof",
"Variable",
")",
"{",
"return",
"(",
"(",
"Variable",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"MethodNode",
")",
"{",
"return",
"(",
"(",
"MethodNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"ClassNode",
")",
"{",
"return",
"(",
"(",
"ClassNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"return",
"inferredElement",
".",
"getText",
"(",
")",
";",
"}",
"}",
"public",
"ASTNode",
"getInferredElement",
"(",
")",
"{",
"return",
"inferredElement",
";",
"}",
"}",
"</s>"
] |
6,097 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"elements",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"public",
"interface",
"IGroovyResolvedElement",
"extends",
"IJavaElement",
",",
"ISourceReference",
"{",
"String",
"getExtraDoc",
"(",
")",
";",
"String",
"getKey",
"(",
")",
";",
"String",
"getInferredElementName",
"(",
")",
";",
"ASTNode",
"getInferredElement",
"(",
")",
";",
"}",
"</s>"
] |
6,098 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"elements",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Variable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedSourceField",
";",
"public",
"class",
"GroovyResolvedSourceField",
"extends",
"ResolvedSourceField",
"implements",
"IGroovyResolvedElement",
"{",
"private",
"final",
"String",
"extraDoc",
";",
"private",
"ASTNode",
"inferredElement",
";",
"public",
"GroovyResolvedSourceField",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"uniqueKey",
",",
"String",
"extraDoc",
",",
"ASTNode",
"inferredElement",
")",
"{",
"super",
"(",
"parent",
",",
"name",
",",
"uniqueKey",
")",
";",
"this",
".",
"extraDoc",
"=",
"extraDoc",
";",
"this",
".",
"inferredElement",
"=",
"inferredElement",
";",
"}",
"public",
"String",
"getExtraDoc",
"(",
")",
"{",
"return",
"extraDoc",
";",
"}",
"public",
"String",
"getInferredElementName",
"(",
")",
"{",
"if",
"(",
"inferredElement",
"instanceof",
"Variable",
")",
"{",
"return",
"(",
"(",
"Variable",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"MethodNode",
")",
"{",
"return",
"(",
"(",
"MethodNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"ClassNode",
")",
"{",
"return",
"(",
"(",
"ClassNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"return",
"inferredElement",
".",
"getText",
"(",
")",
";",
"}",
"}",
"public",
"ASTNode",
"getInferredElement",
"(",
")",
"{",
"return",
"inferredElement",
";",
"}",
"}",
"</s>"
] |
6,099 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"elements",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Variable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ResolvedBinaryMethod",
";",
"public",
"class",
"GroovyResolvedBinaryMethod",
"extends",
"ResolvedBinaryMethod",
"implements",
"IGroovyResolvedElement",
"{",
"private",
"final",
"String",
"extraDoc",
";",
"private",
"ASTNode",
"inferredElement",
";",
"public",
"GroovyResolvedBinaryMethod",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"[",
"]",
"parameterTypes",
",",
"String",
"uniqueKey",
",",
"String",
"extraDoc",
",",
"ASTNode",
"inferredElement",
")",
"{",
"super",
"(",
"parent",
",",
"name",
",",
"parameterTypes",
",",
"uniqueKey",
")",
";",
"this",
".",
"extraDoc",
"=",
"extraDoc",
";",
"this",
".",
"inferredElement",
"=",
"inferredElement",
";",
"}",
"public",
"String",
"getExtraDoc",
"(",
")",
"{",
"return",
"extraDoc",
";",
"}",
"public",
"String",
"getInferredElementName",
"(",
")",
"{",
"if",
"(",
"inferredElement",
"instanceof",
"Variable",
")",
"{",
"return",
"(",
"(",
"Variable",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"MethodNode",
")",
"{",
"return",
"(",
"(",
"MethodNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"ClassNode",
")",
"{",
"return",
"(",
"(",
"ClassNode",
")",
"inferredElement",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"return",
"inferredElement",
".",
"getText",
"(",
")",
";",
"}",
"}",
"public",
"ASTNode",
"getInferredElement",
"(",
")",
"{",
"return",
"inferredElement",
";",
"}",
"}",
"</s>"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.