Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
28,600
void () { doTest(); }
testSlurper
28,601
void () { doTest(); }
testStub1
28,602
void () { doTest(); }
testStub_field1
28,603
void () { doTest(); }
testStub_method1
28,604
void () { doTest(); }
testTypeParameters
28,605
String () { return TestUtils.getTestDataPath() + "groovy/stubs"; }
getBasePath
28,606
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test"); String fileText = data.get(0); PsiFile psiFile = TestUtils.createPseudoPhysicalGroovyFile(getProject(), fileText); ASTNode node = psiFile.getNode(); Assert.assertNotNull(node); IElementType type = node.getElementType(); Assert.assertTrue(type instanceof IStubFileElementType); IStubFileElementType stubFileType = (IStubFileElementType) type; StubBuilder builder = stubFileType.getBuilder(); StubElement element = builder.buildStubTree(psiFile); StringBuffer buffer = new StringBuffer(); getStubsTreeImpl(element, buffer, ""); String stubTree = buffer.toString().trim(); assertEquals(data.get(1), stubTree); }
doTest
28,607
void (StubElement element, StringBuffer buffer, String offset) { PsiElement psi = element.getPsi(); buffer.append(offset).append("[").append(psi.toString()). append(element instanceof NamedStub ? " : " + ((NamedStub<?>) element).getName() : ""). append("]\n"); for (StubElement stubElement : ((List<StubElement>) element.getChildrenStubs())) { getStubsTreeImpl(stubElement, buffer, offset + " "); } }
getStubsTreeImpl
28,608
void () { Ref<Boolean> gotIt = new Ref<>(false); PsiTreeChangeAdapter listener = new PsiTreeChangeAdapter() { @Override public void childReplaced(@NotNull PsiTreeChangeEvent event) { gotIt.set(true); } }; getPsiManager().addPsiTreeChangeListener(listener, getTestRootDisposable()); Project project = getProject(); GroovyFile file = GroovyPsiElementFactory.getInstance(project).createGroovyFile("/** This is doc comment*/class C{}", true, null); PsiDocumentManager docManager = PsiDocumentManager.getInstance(project); Document doc = docManager.getDocument(file); assertNotNull(doc); CommandProcessor.getInstance().executeCommand( project, () -> ApplicationManager.getApplication().runWriteAction(() -> { doc.insertString(3, " "); docManager.commitDocument(doc); }), "file text set", this ); assertTrue(gotIt.get()); }
testEditingInDocComment
28,609
void (@NotNull PsiTreeChangeEvent event) { gotIt.set(true); }
childReplaced
28,610
String () { return StringGroovyMethods.capitalize(super.getTestName()); }
getTestName
28,611
void () { fileHighlightingTest(); }
rawMethodAccess
28,612
void () { fileHighlightingTest(); }
rawFieldAccess
28,613
void () { fileHighlightingTest(); }
rawArrayStyleAccess
28,614
void () { fileHighlightingTest(); }
rawArrayStyleAccessToMap
28,615
void () { fileHighlightingTest(); }
rawArrayStyleAccessToList
28,616
void () { highlightingTest(""" class A<T> { A(T t) {this.t = t} T t def cl = { return t } } def a = new A(new Date()) Date d = <warning descr="Cannot assign 'Object' to 'Date'">a.cl()</warning> """); }
rawClosureReturnType
28,617
String () { return TestUtils.getTestDataPath() + "groovy/inspections/rangeTypeCheck"; }
getBasePath
28,618
void () { myFixture.configureByFile(getTestName(false) + ".groovy"); final int offset = myFixture.getEditor().getCaretModel().getOffset(); final PsiElement atCaret = myFixture.getFile().findElementAt(offset); final GrRangeExpression range = PsiTreeUtil.getParentOfType(atCaret, GrRangeExpression.class); final GroovyRangeTypeCheckInspection inspection = new GroovyRangeTypeCheckInspection(); final LocalQuickFix fix = inspection.buildFix(range); LocalQuickFix[] fixes = {fix}; final ProblemDescriptor descriptor = InspectionManager.getInstance(getProject()).createProblemDescriptor(range, "bla-bla", false, fixes, ProblemHighlightType.WEAK_WARNING); WriteCommandAction.runWriteCommandAction(getProject(), () -> { fix.applyFix(myFixture.getProject(), descriptor); }); myFixture.checkResultByFile(getTestName(false) + "_after.groovy"); }
doTest
28,619
void () { doTest(); }
testNotComparable
28,620
void () {doTest(); }
testNext
28,621
void () {doTest(); }
testAll
28,622
void () { doTest("ClassB", "ClassB1", false); }
testNoReturnType
28,623
void (@NonNls final String className, @NonNls final String superClassName, final boolean replaceInstanceOf) { doTest((rootDir, rootAfter) -> this.performAction(className, superClassName, replaceInstanceOf), true); }
doTest
28,624
String () { return "/refactoring/turnRefsToSuper/"; }
getTestRoot
28,625
String () { return TestUtils.getAbsoluteTestDataPath(); }
getTestDataPath
28,626
void (final String className, final String superClassName, boolean replaceInstanceOf) { final PsiClass aClass = myJavaFacade.findClass(className, GlobalSearchScope.allScope(myProject)); assertNotNull("Class " + className + " not found", aClass); PsiClass superClass = myJavaFacade.findClass(superClassName, GlobalSearchScope.allScope(myProject)); assertNotNull("Class " + superClassName + " not found", superClass); new TurnRefsToSuperProcessor(myProject, aClass, superClass, replaceInstanceOf).run(); FileDocumentManager.getInstance().saveAllDocuments(); }
performAction
28,627
GroovyIntroduceVariableDialog (@NotNull GrIntroduceContext context) { return new MockGrIntroduceVariableDialog(context, new GroovyVariableValidator(context), mySettings); }
getDialog
28,628
String () { return TestUtils.getTestDataPath() + "groovy/refactoring/introduceVariableValidator/"; }
getBasePath
28,629
void () { doTest(); }
testAll1
28,630
void () { doTest(); }
testAll2
28,631
void () { doTest(); }
testClass1
28,632
void () { doTest(); }
testClass2
28,633
void () { doTest(); }
testE
28,634
void () { doTest(); }
testFile1
28,635
void () { doTest(); }
testFile2
28,636
void () { doTest(); }
testLoop1
28,637
void () { doTest(); }
testLoop2
28,638
void () { doTest(); }
testLoop3
28,639
void () { doTest(); }
testSimple
28,640
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + getTestName(true) + ".test"); assertEquals(StringUtil.trimEnd(data.get(1), "\n"), processFile(data.get(0))); }
doTest
28,641
void () { close(0); }
show
28,642
MockSettings () { return mySettings; }
getSettings
28,643
boolean () { return true; }
isOK
28,644
boolean () { return myFinal; }
isDeclareFinal
28,645
String () { return myName; }
getName
28,646
boolean () { return myAllOccurrences; }
replaceAllOccurrences
28,647
PsiType () { return myType; }
getSelectedType
28,648
String () { return TestUtils.getTestDataPath() + "refactoring/move/moveScript/"; }
getBasePath
28,649
void () { doTest(new String[]{"a/Script.groovy"}, "b"); }
testMoveScriptBasic
28,650
void () { doTest(new String[]{"a/Script.groovy"}, "b"); }
testUpdateReferences
28,651
void () { doTest(new String[]{"a/Script.groovy", "a/Script2.groovy"}, "b"); }
testMultiMove
28,652
void () { doTest(new String[]{"a/Foo.groovy"}, "b"); }
testScriptWithClasses
28,653
void () { doTest(new String[]{"a/Foo.groovy"}, "b"); }
testFileWithTwoClasses
28,654
void () { doTest(new String[]{"a/Foo.groovy"}, "b"); }
testMoveToSamePackage
28,655
void (String[] fileNames, String newDirName, String dir) { final PsiFile[] files = new PsiFile[fileNames.length]; for (int i = 0; i < files.length; i++) { String fileName = fileNames[i]; final VirtualFile file = myFixture.getTempDirFixture().getFile(dir + "/" + fileName); assertNotNull("File " + fileName + " not found", file); files[i] = PsiManager.getInstance(getProject()).findFile(file); assertNotNull("File " + fileName + " not found", files[i]); } final VirtualFile virDir = myFixture.getTempDirFixture().getFile(dir + "/" + newDirName); assertNotNull("Directory " + newDirName + " not found", virDir); final PsiDirectory psiDirectory = PsiManager.getInstance(getProject()).findDirectory(virDir); assertNotNull("Directory " + newDirName + " not found", psiDirectory); final PsiPackage pkg = JavaDirectoryService.getInstance().getPackage(psiDirectory); List<PsiClass> classList = new ArrayList<>(); for (PsiFile file : files) { Collections.addAll(classList, ((PsiClassOwner)file).getClasses()); } final PsiClass[] classes = classList.toArray(PsiClass.EMPTY_ARRAY); new MoveClassesOrPackagesProcessor(getProject(), classes, new SingleSourceRootMoveDestination(PackageWrapper.create(pkg), psiDirectory), true, true, null).run(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); FileDocumentManager.getInstance().saveAllDocuments(); }
performAction
28,656
void (String[] fileNames, String newDirName) { String testName = getTestName(true); final VirtualFile actualRoot = myFixture.copyDirectoryToProject(testName + "/before", ""); performAction(fileNames, newDirName, VfsUtilCore.getRelativePath(actualRoot, myFixture.getTempDirFixture().getFile(""), '/')); final VirtualFile expectedRoot = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getTestName(true) + "/after"); //File expectedRoot = new File(getTestDataPath() + testName + "/after"); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); VirtualFileManager.getInstance().syncRefresh(); try { PlatformTestUtil.assertDirectoriesEqual(expectedRoot, actualRoot); } catch (IOException e) { throw new RuntimeException(e); } }
doTest
28,657
GrIntroduceDialog<GrIntroduceFieldSettings> (@NotNull GrIntroduceContext context) { return new GrIntroduceDialog<>() { @Override public GrIntroduceFieldSettings getSettings() { return new GrIntroduceFieldSettings() { @Override public boolean declareFinal() { return myDeclareFinal; } @Override public Init initializeIn() { return myInitializeIn; } @Override public String getVisibilityModifier() { return PsiModifier.PACKAGE_LOCAL; } @Override public boolean isStatic() { return myIsStatic; } @Override public boolean removeLocalVar() { return myRemoveLocal; } @Override public String getName() { return "f"; } @Override public boolean replaceAllOccurrences() { return replaceAll; } @Override public PsiType getSelectedType() { return mySelectedType; } }; } @Override public void show() { } @Override public boolean isOK() { return true; } @NotNull @Override public LinkedHashSet<String> suggestNames() { LinkedHashSet<String> strings = new LinkedHashSet<>(); strings.add("f"); return strings; } }; }
getDialog
28,658
GrIntroduceFieldSettings () { return new GrIntroduceFieldSettings() { @Override public boolean declareFinal() { return myDeclareFinal; } @Override public Init initializeIn() { return myInitializeIn; } @Override public String getVisibilityModifier() { return PsiModifier.PACKAGE_LOCAL; } @Override public boolean isStatic() { return myIsStatic; } @Override public boolean removeLocalVar() { return myRemoveLocal; } @Override public String getName() { return "f"; } @Override public boolean replaceAllOccurrences() { return replaceAll; } @Override public PsiType getSelectedType() { return mySelectedType; } }; }
getSettings
28,659
boolean () { return myDeclareFinal; }
declareFinal
28,660
Init () { return myInitializeIn; }
initializeIn
28,661
String () { return PsiModifier.PACKAGE_LOCAL; }
getVisibilityModifier
28,662
boolean () { return myIsStatic; }
isStatic
28,663
boolean () { return myRemoveLocal; }
removeLocalVar
28,664
String () { return "f"; }
getName
28,665
boolean () { return replaceAll; }
replaceAllOccurrences
28,666
PsiType () { return mySelectedType; }
getSelectedType
28,667
void () { }
show
28,668
boolean () { return true; }
isOK
28,669
LinkedHashSet<String> () { LinkedHashSet<String> strings = new LinkedHashSet<>(); strings.add("f"); return strings; }
suggestNames
28,670
GrParameterInfo[] (GrMethod method) { GrParameter[] params = method.getParameterList().getParameters(); int size = myInfos.size(); GrParameterInfo[] result = new GrParameterInfo[size]; for (int i = 0; i < size; i++) { final SimpleInfo sim = myInfos.get(i); int oldIndex = sim.myOldIndex; GrParameterInfo info; String name = null; String defInitializer = null; PsiType type = null; String defValue = null; if (oldIndex > -1) { final GrParameter p = params[oldIndex]; name = p.getName(); final GrExpression initializer = p.getInitializerGroovy(); defInitializer = initializer != null ? initializer.getText() : null; type = p.getDeclaredType(); } if (sim.myNewName != null) { name = sim.myNewName; } if (sim.myType != null && !sim.myType.isEmpty()) { type = JavaPsiFacade.getElementFactory(myProject).createTypeFromText(sim.myType, method); } if (sim.myDefaultInitializer != null) { defInitializer = sim.myDefaultInitializer; } if (sim.myDefaultValue != null) { defValue = sim.myDefaultValue; } assert oldIndex >= 0 || defValue != null || defInitializer != null; assert name != null; info = new GrParameterInfo(name, defValue, defInitializer, type, oldIndex, sim.myFeelLucky); result[i] = info; } return result; }
genParams
28,671
ThrownExceptionInfo[] (PsiMethod method) { for (ThrownExceptionInfo info : myInfos) { info.updateFromMethod(method); } return myInfos; }
genExceptions
28,672
void () { doTest(new SimpleInfo("p", -1, "\"5\"", null, CommonClassNames.JAVA_LANG_STRING)); }
testOneNewParameter
28,673
void () { doTest(new SimpleInfo(0), new SimpleInfo(2)); }
testRemoveParameterMultiline
28,674
void () { doTest(new SimpleInfo(1), new SimpleInfo(0), new SimpleInfo(2)); }
testMoveParametersMultiline
28,675
void () { doTest(); }
testRemoveParameter
28,676
void () { doTest(new SimpleInfo(0), new SimpleInfo("p", -1, "5", "-3", PsiTypes.intType()), new SimpleInfo(1)); }
testInsertParameter
28,677
void () { doTest(new SimpleInfo(0), new SimpleInfo(1), new SimpleInfo("p", -1, "5", "-3", PsiTypes.intType())); }
testInsertOptionalParameter
28,678
void () { doTest(new SimpleInfo(1), new SimpleInfo(2)); }
testNamedParametersRemove
28,679
void () { doTest(new SimpleInfo(0), new SimpleInfo(2)); }
testNamedParametersOrder1
28,680
void () { doTest(new SimpleInfo(1), new SimpleInfo(0)); }
testMoveVarArgParameters
28,681
void () { doTest(PsiModifier.PROTECTED, "newName", null, new ArrayList<>(Arrays.asList(new SimpleInfo(0))), new ArrayList<>(), false); }
testChangeVisibilityAndName
28,682
void () { doTest(new SimpleInfo("p", -1, "5", null, PsiTypes.intType())); }
testImplicitConstructorInConstructor
28,683
void () { doTest(new SimpleInfo("p", -1, "5", null, PsiTypes.intType())); }
testImplicitConstructorForClass
28,684
void () { doTest(new SimpleInfo("p", -1, "5", null, PsiTypes.intType())); }
testAnonymousClassUsage
28,685
void () { doTest(new SimpleInfo(0), new SimpleInfo(2)); }
testGroovyDocReferences
28,686
void () { doTest(PsiModifier.PUBLIC, "bar", null, new ArrayList<>(Arrays.asList(new SimpleInfo(0))), new ArrayList<>(), false); }
testOverriders
28,687
void () { doTest(new SimpleInfo("newP", 0)); }
testParameterRename
28,688
void () { doTest("int", new SimpleInfo(0)); }
testAddReturnType
28,689
void () { doTest("int", new SimpleInfo(0)); }
testChangeReturnType
28,690
void () { doTest("", new SimpleInfo(0)); }
testRemoveReturnType
28,691
void () { doTest("", new SimpleInfo("p", 0, null, null, PsiTypes.intType())); }
testChangeParameterType
28,692
void () { doTest("", true, new SimpleInfo(0), new SimpleInfo("p", -1, "2", "2", PsiTypes.intType())); }
testGenerateDelegate
28,693
void () { doTest(PsiModifier.PUBLIC, null, "", Arrays.asList(new SimpleInfo(0)), Arrays.asList(new JavaThrownExceptionInfo(-1, (PsiClassType)createType("java.io.IOException"))), false); }
testAddException
28,694
void () { doTest(PsiModifier.PUBLIC, null, "", Arrays.asList(new SimpleInfo(0)), Arrays.asList(new JavaThrownExceptionInfo(-1, (PsiClassType)createType("java.io.IOException"))), false); }
testExceptionCaughtInUsage
28,695
void () { doTest(PsiModifier.PUBLIC, null, "", Arrays.asList(new SimpleInfo(0)), Arrays.asList(new JavaThrownExceptionInfo(-1, (PsiClassType)createType("java.io.IOException"))), false); }
testExceptionInClosableBlock
28,696
void () { doTest(PsiModifier.PUBLIC, "Foo", null, new ArrayList<>(Arrays.asList(new SimpleInfo(0), new SimpleInfo("a", -1, "5", null, PsiTypes.intType()))), new ArrayList<>(), true); }
testGenerateDelegateForConstructor
28,697
void () { doTest(PsiModifier.PUBLIC, "foo", null, new ArrayList<>(Arrays.asList(new SimpleInfo(0), new SimpleInfo("a", -1, "5", null, PsiTypes.intType()))), new ArrayList<>(), true); }
testGenerateDelegateForAbstract
28,698
void () { doTest(new SimpleInfo("list", -1, "null", null, "java.util.List<T>"), new SimpleInfo(0)); }
testTypeParameters
28,699
void () { doTest(new SimpleInfo(1), new SimpleInfo(0)); }
testMoveArrayToTheEnd