Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
291,700
String () { return field; }
getField
291,701
void (String [] args) { Limitless myClass = new Limitless(); System.out.println(myClass.getField()+" "+myClass.getId()); Example example = new Example(1, "name"); int r = example.getI()+9; myClass.getId(); }
main
291,702
int () { return id; }
getId
291,703
String () { return field; }
getField
291,704
void (String [] args) { Limitless myClass = new Limitless(); System.out.println(myClass.field+" "+myClass.id); Example example = new Example(1, "name"); int r = example.getI()+9; myClass.id; }
main
291,705
void () { final String in = """ class A extends TestCase { void testOne() { System.out.println(); } } """; final String what = "class '_A { void '_b:[regex( test.* )](); }"; final String by = "class $A$ {\n @java.lang.Override void $b$();\n}"; assertEquals(""" class A extends TestCase { @Override void testOne() { Syste...
testMethodContentReplacement
291,706
void () { final String in = """ abstract class A { abstract void a(); }"""; final String what = "void '_a();"; final String by = "void $a$(int i);"; assertEquals(""" abstract class A { abstract void a(int i); }""", replace(in, what, by)); final String what2 = "abstract void '_a('_T '_p*);"; final String by2 = "void $a$...
testReplaceMethodWithoutBody
291,707
void () { final String in = """ class A { void a(int b) {} }"""; final String what = "int '_a = '_b{0,1};"; final String by = "final long /*!*/ $a$ = $b$;"; assertEquals(""" class A { void a(final long /*!*/ b) {} }""", replace(in, what, by)); final String in2 = """ class X { void m() { for (int x : new int[]{1, 2, 3})...
testReplaceParameterWithComment
291,708
void () { String in = """ public class A { public class B<T> extends A implements java.io.Serializable {} }"""; String what = """ class '_A { class '_B {} }"""; String by = """ class $A$ { private class $B$ { } }"""; assertEquals(""" public class A { private class B<T> extends A implements java.io.Serializable { } }"""...
testReplaceInnerClass
291,709
void () {}
m2
291,710
void () {}
m2
291,711
void () { String in = """ class A { String s; void setS(String s) { System.out.println(this.s); this.s = s; } }"""; String what = "System.out.println('_a);"; String by = "System.out.println(\"$a$\" + $a$);"; assertEquals("don't drop this", """ class A { String s; void setS(String s) { System.out.println("this.s" + this...
testReplaceQualifiedReference
291,712
void () { String in = """ class A { void m() { new Object(); } }"""; String what = "'_expr;"; String by = "$expr$.toString();"; assertEquals("too many semicolons", """ class A { void m() { new Object().toString(); } }""", replace(in, what, by, true)); }
testReplaceExpressionStatement
291,713
void () { String in = """ class X { private final int i = 1; }"""; String what = "int '_v;"; String by = "long $v$;"; assertEquals("initializer should remain", """ class X { private final long i=1; }""", replace(in, what, by, true)); }
testReplaceVariableInitializer
291,714
void () { String in = """ public class MyFile { void test(String a, Object b) { if(a.length() == 0) { System.out.println("empty"); } if(((String) b).length() == 0) { System.out.println("empty"); } } }"""; String what = "'_expr:[exprtype( String )].length() == 0"; String by = "$expr$.isEmpty()"; assertEquals("parenthese...
testReplaceParentheses
291,715
void () { String in = """ import org.junit.Test; class Help { private String s = "hello"; @Test public void testThisThing(){ System.out.println(); System.out.println(); System.out.println(); s = null; } }"""; String what = """ class 'Class { '_FieldType '_FieldName; @'_Annotation '_MethodType '_MethodName() { '_Stateme...
testReplaceTarget
291,716
void () { System.out.println(); System.out.println(); System.out.println(); s = null; }
testThisThing
291,717
void () { options.setToShortenFQN(false); String in = """ import java.util.ArrayList; import java.util.List; class X { List<String> list = new java.util.LinkedList<String>(); List<Integer> list2 = new java.util.ArrayList<Integer>(); List<Double> list3 = new ArrayList<>(); }"""; assertEquals("should properly replace wit...
testReplaceGenerics
291,718
void () { String in = """ public abstract class Bar { String[] x; abstract String[] foo(String[] x); }"""; assertEquals("should keep array brackets 1", """ public abstract class Bar { String[] x; abstract String[] foo(String[] x); }""", replace(in, "'_FieldType 'Field = '_Init?;", "$FieldType$ $Field$ = $Init$;", true)...
testArrays
291,719
void () { String in = """ class X { void x() {} void y() { x(); this.x(); } }"""; assertEquals("replace (un)qualified calls correctly", """ class X { void x() {} void y() { x(); this.x(); } }""", replace(in, "'_Instance?.'_MethodCall('_arguments*)", "$Instance$.$MethodCall$($arguments$)", true)); String in2 = """ class...
testMethodCall
291,720
void () { String in = "@Deprecated\n" + "public class X {}"; final String what = "class '_X {}"; final String replacement = "/** comment */\n" + "class $X$ {}"; final String expected = """ /** comment */ @Deprecated public class X {}"""; assertEquals("keep newline in modifier list", expected, replace(in, what, replacem...
testKeepModifierFormatting
291,721
void () { final String in = """ class Util { @SafeVarargs @Contract(pure=true) public static <T> T @NotNull [] ar(T @NotNull ... elements) { return elements; } }"""; final String what = "$RT$ ar($T$ $p$);"; final String replacement = "$RT$ ar($T$ $p$);"; assertEquals("keep method type parameters", in, replace(in, what,...
testTypeParameterReplacement
291,722
Sdk () { return IdeaTestUtil.getMockJdk11(); }
getProjectJDK
291,723
void () { doTest("A.f", "[in code:f]"); }
testClassByQName
291,724
void () { doTest("exception should not be in plan", "class C {" + " void '_m{0,1} () throws OMGWTFBBQException {}" + "}", "[in code:C][in code:class|in code:enum|in code:interface|in code:record]"); doTest("throws should not be in plan", "class C {" + " String m() throws '_E{0,1} {" + " System.out.println();" + " retur...
testOptionalMethodWithThrowsClause
291,725
void () { doTest("extends should not be in plan", "class A extends '_B{0,0} {}", "[in code:A][in code:class|in code:enum|in code:interface|in code:record]"); doTest("implements should not be in plan", "class B implements '_I{0,0} {}", "[in code:B][in code:class|in code:enum|in code:interface|in code:record]"); }
testExtendsImplements
291,726
void () { doTest(":: in plan", "'_Q::x", "[in code:x][in code:::]"); doTest("-> in plan", "() -> {}", "[in code:->]"); }
testLambda
291,727
void () { doTest("regex should not be in plan", "'x:[regex( a+ )]", ""); doTest("regex should not be in plan 2", "'x:[ regex(a}
testRegExpChar
291,728
void () { doTest("class A {}", "[in code:A][in code:class|in code:enum|in code:interface|in code:record]"); doTest("interface I {}", "[in code:I][in code:interface]"); doTest("enum E {}", "[in code:E][in code:enum]"); doTest("record R() {}", "[in code:R][in code:record]"); }
testClasses
291,729
void () { doTest("classes outside search scope should also be added to descendants plan", "class '_A:*List {}", "[in code:AbstractImmutableList|in code:AbstractList|in code:AbstractSequentialList|in code:ArrayList|in code:AsList" + "|in code:COWSubList|in code:CheckedList|in code:CheckedRandomAccessList|in code:CopiesL...
testDescendants
291,730
void () { doTest("new java.lang.RuntimeException('_x)", "[in code:new][in code:RuntimeException]"); doTest("new java.lang.reflect.InvocationTargetException('_x)", "[in code:new][in code:InvocationTargetException][in code:reflect][in code:lang][in code:java]"); }
testQualifiedReference
291,731
void () { doTest("try {" + " '_st*;" + "} catch ('_Type '_exception{0,0}) {" + " '_st2*;" + "}", "[in code:try]"); }
testTryWithoutCatch
291,732
void () { doTest("/* one/two (3|4|5) */", "[in comments:one][in comments:two][in comments:3][in comments:4][in comments:5]"); }
testComment
291,733
void () { doTest("@Modifier(\"packageLocal\") '_FieldType '_Field = '_Init?;", ""); }
testPackageLocal
291,734
void () { doTest("assert '_exp != null && true: \"'_exp is null\";", "[in literals:null][in literals:is][in code:assert][in code:null][in code:true]"); }
testLiterals
291,735
void () { doTest("\"asd fasdf\\\\n\"", "[in literals:fasdf][in literals:asd]"); }
testStringLiteral
291,736
void () { doTest("pkg.Tmp3.id()", "[in code:id]"); }
testFullyQualifiedMethodName
291,737
void () { doTest("ArrayUtil.toObjectArray($var$, $class$.class)", "[in code:toObjectArray][in code:class]"); }
testClassObjectAccessExpression
291,738
void () { doTest("java.util.List.of($x$)", "[in code:of][in code:List][in code:util][in code:java]"); }
testStaticCall
291,739
void (String query, String plan) { assertEquals(plan, getSearchPlan(query, JavaFileType.INSTANCE)); }
doTest
291,740
void (String message, String query, String plan) { assertEquals(message, plan, getSearchPlan(query, JavaFileType.INSTANCE)); }
doTest
291,741
void () { final String s2 = "class X {{ ((dialog==null)? (dialog = new SearchDialog()): dialog).show(); }}"; assertFalse("subexpr match", findMatchesCount(s2, "dialog = new SearchDialog()") == 0); final String s10 = """ class X {{ listener.add(new Runnable() { public void run() {} }); }}"""; assertEquals("search for ne...
testSearchExpressions
291,742
void () { matchContext.getSink().matchingFinished(); }
run
291,743
void () { String s = System.getProperty(a); }
b
291,744
void () { // do stuff }
run
291,745
void () { // do stuff }
run
291,746
void (BigDecimal[] array) { // do nothing }
prorate
291,747
void (java.math.BigDecimal[] array) { // do nothing }
prorate2
291,748
void (BigDecimal bd) { // do nothing }
prorate
291,749
void (String[] args) { BigDecimal[] something = new BigDecimal[2]; java.math.BigDecimal[] something2 = new BigDecimal[2]; something[0] = new BigDecimal(1.0); something[1] = new BigDecimal(1.0); Prorator prorator = new Prorator(); // --------------------------------------------------- // the line below should've been fo...
main
291,750
void () { String s9 = """ class X {{ int a[] = new int[] { 1,2,3,4}; int b[] = { 2,3,4,5 }; Object[] c = new Object[] { "", null}; Object[] d = {null, null}; Object[] e = {}; Object[] f = new Object[]{}; String[] g = new String[]{}; String[] h = new String[]{new String()}; }}"""; assertEquals("Find new array expression...
testNewArrayExpressions
291,751
void () { String s = """ class A { static String a = 1; static String s = "aaa"; static String s2; }"""; assertEquals("Literal", 2, findMatchesCount(s, "static String '_FieldName = '_Init?:[!regex( \".*\" )];")); assertEquals("Literal, 2", 1, findMatchesCount(s, "static String '_FieldName = '_Init:[!regex( \".*\" )];")...
testLiteral
291,752
void () { String s1 = "class X {{ String[] argv; }}"; String s2 = "class X {{ String argv; }}"; assertEquals("Find array types", 0, findMatchesCount(s1, "String argv;")); assertEquals("Find array types, 2", 0, findMatchesCount(s2, "String[] argv;")); assertEquals("Find array types, 3", 0, findMatchesCount(s2, "'T[] arg...
testCovariantArraySearch
291,753
void () { String source = """ class A { String ss[][]; int f()[] { return null; } }"""; String target = "String[][] '_s;"; assertEquals("should find multi-dimensional c-style array declarations", 1, findMatchesCount(source, target)); String target2 = "class '_A { int[] 'f(); }"; assertEquals("should find c-style method...
testFindArrayDeclarations
291,754
void () { final String s = """ class X {{ debug("In action performed:"+event); project = (Project)event.getDataContext().getData(DataConstants.PROJECT); CodeEditorManager.getInstance(project).commitAllToPsiFile(); file = (PsiFile) event.getDataContext().getData("psi.File"); ((dialog==null)? (dialog = new SearchDialog()...
testSearchStatements
291,755
void () { final String s43 = """ interface A extends B { int B = 1; } interface D { public final static double e = 1; } interface E { final static ind d = 2; } interface F { }"""; assertEquals("no modifier for interface vars", 3, findMatchesCount(s43, "interface '_ { '_T 'T2 = '_T3; } ")); final String s45 = """ class ...
testSearchClass
291,756
void () {}
b
291,757
void () { f(); }
run
291,758
void () { //To change body of created methods use File | Settings | File Templates. }
f
291,759
void () { f(); }
run
291,760
void () { //To change body of created methods use File | Settings | File Templates. }
g
291,761
void () { f(); }
run
291,762
void () { //To change body of created methods use File | Settings | File Templates. }
f
291,763
void () { '_f (); }
run
291,764
void () { final String s143 = """ class A { A() {} }; class B { B(int a) {} }; class C { C() {} C(int a) {} }; class D { void method() {} } class E {}"""; assertEquals("parameterless constructor search", 3, findMatchesCount(s143, "class '_a { '_d{0,0}:[ script( \"__context__.constructor\" ) ]('_b '_c+); }")); assertEqu...
testParameterlessConstructorSearch
291,765
void () { final String source = """ package a; class BX extends java.util.List { private static final java.util.List VALUE = new BX(); } class CX extends java.util.List { private static final String S = ""; }"""; // find static final fields whose type is a proper ancestor of the class declaring their fields assertEqual...
testScriptSearch
291,766
void () { try { findMatchesCount("", "'_b:[script( \"^^^\" )]"); fail("Validation does not work"); } catch (MalformedPatternException ignored) {} }
testCheckScriptValidation
291,767
void () { String s1 = """ import java.util.*; class A { void b() { Map map = new HashMap(); class AppPreferences {} String key = "key"; AppPreferences value = new AppPreferences(); map.put(key, value ); map.put(value, value ); map.put("key", value ); map.put("key", new AppPreferences()); } }"""; String s2 = "'_map:[exp...
testExprTypeWithObject
291,768
void () { String in = """ class A implements Cloneable {} class B implements Serializable {} class C implements Cloneable,Serializable {} class C2 implements Serializable,Cloneable {} class E extends B implements Cloneable {} class F extends A implements Serializable {} class D extends C {}"""; assertEquals("search int...
testInterfaceImplementationsSearch
291,769
void () { final String s89 = "class X {{ a = 1; b = 2; c=3; }}"; assertEquals("backtracking greedy regexp", 1, findMatchesCount(s89, "{ '_T*; '_T2*; }")); assertEquals("backtracking greedy regexp 2", 1, findMatchesCount(s89, " { '_T*; '_T2*; '_T3+; } ")); assertEquals("backtracking greedy regexp 3", 0, findMatchesCount...
testSearchBacktracking
291,770
void () { final String s131 = "class X {{ a.b(); c.d = 1; }}"; assertEquals("symbol match", 2, findMatchesCount(s131, "'T:b|d")); options.setCaseSensitiveMatch(true); final String s129 = "class X {{ A a = new A(); }}"; assertEquals("case sensitive match", 2, findMatchesCount(s129, "'Sym:A")); final String s133 = "class...
testSearchSymbol
291,771
A () {}
a
291,772
void () { final String s81 = """ class Pair<First,Second> { <C,F> void a(B<C> b, D<F> e) throws C { P<Q> r = (S<T>)null; Q q = null; if (r instanceof S<T>) {} } } class Q { void b() {} }"""; assertEquals("parameterized class match", 2, findMatchesCount(s81, "class '_<'T> {}")); assertEquals("parameterized instanceof ma...
testSearchGenerics
291,773
void () { final String s15 = "'T;"; final String s1 = "class X {{ if (true) { aaa(var); }}}"; assertEquals("search for parameterized pattern", 3, findMatchesCount(s1, s15)); final String s2 = "class X {{ if (true) { aaa(var); bbb(var2); }\n if(1==1) { system.out.println('o'); }}}"; assertEquals("search for parameterize...
testSearchSubstitutions
291,774
void () { final String s = """ class A { void m() { /** tool */ class Local {} } }"""; assertEquals("dangling javadoc followed by a local class", 1, findMatchesCount(s, "{\n/** tool */\nclass 'A {}\n}")); assertEquals("class with javadoc shouldn't find dangling javadoc and local class", 0, findMatchesCount(s, "/** tool...
testSearchJavaDoc
291,775
Long () { return id; }
getId
291,776
void (Long id) { this.id=id; }
setId
291,777
Date () { return birthdate; }
getBirthdate
291,778
char () { return sex; }
getSex
291,779
void () { String s133 = """ class String1 implements java.io.Serializable { private static final long serialVersionUID = -6849794470754667710L; private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0]; } class StringBuilder1 implements java.io.Serializable { private void writeObject(ja...
testNamedPatterns
291,780
NodeFilter () { if (instance==null) instance = new MethodFilter(); return instance; }
getInstance
291,781
void () { final String s105 = "class B {} class A extends B { } class C {} class D extends C {}"; assertEquals("extends match", 1, findMatchesCount(s105, "class '_ extends '_:[ref( \"class B {}\" )] {}")); final String s107 = """ interface IA {} interface IB extends IA {} interface IC extends IB {} interface ID extends...
testHierarchy
291,782
void () { String s1 = """ class X {{ // This is some comment /* This is another comment*/ // Some garbage /** And now third comment*/ /** Some garbage*/ }}"""; assertEquals("Comment matching", 3, findMatchesCount(s1, "// 'Comment:[regex( .*(?:comment).* )]")); assertEquals("Comment matching, 2", 3, findMatchesCount(s1,...
testSearchInCommentsAndLiterals
291,783
void (int i) { int g=0; //sss }
f
291,784
void () { final String s73 = " class A { int A; static int B=5; public abstract void a(int c); void q() { ind d=7; } }"; assertEquals("optional init match in definition", 4, findMatchesCount(s73, " '_Type 'Var = '_Init?; ")); final String s77 = """ class X {{ new ActionListener() {}; }}"""; assertEquals("null match", 0...
testOther
291,785
void () { String s1 = "import java.awt.List;\n" + "class A { List l; }"; String s2 = "class '_ { 'Type:java\\.util\\.List '_Field; }"; assertEquals("No matches for qualified class", 0, findMatchesCount(s1, s2)); String s1_2 = "import java.util.List;\n" + "class A { List l; }"; assertEquals("Matches for qualified class"...
testFQNInPatternAndVariableConstraints
291,786
void () { String s1 = """ @MyBean("") @MyBean2("") public class TestBean {} @MyBean2("") @MyBean(value="") public class TestBean2 {} public class TestBean3 {} @MyBean("a") @MyBean2("a") public class TestBean4{}"""; String s2 = """ @MyBean("") @MyBean2("") public class '_a {} """; assertEquals("Simple find annotated cla...
testAnnotations
291,787
Collection<PsiElement> (final PsiReference reference, final Project project) {}
resolveElements
291,788
Collection (final PsiReference reference, final Project project) {}
resolveElements2
291,789
void () {}
singleValue
291,790
void () {}
multiValue
291,791
void () {}
explicitSingleValue
291,792
void () {}
explicitMultiValue
291,793
void () {}
different
291,794
void () {}
end
291,795
void () { String s1 = """ class X {{ class A { void b(Integer i); void b2(int i); void c(int d); void c2(Integer d); } A a; a.b2(1) ; a.b2(1) ; a.b(1) ; a.b( new Integer(0) ) ; a.b( new Integer(0) ) ; a.c(new Integer(2)); a.c(new Integer(3)); a.c2(new Integer(3)); a.c(3); Integer i = 4; int j = Integer.valueOf(4); }}""...
testBoxingAndUnboxing
291,796
void () { String s1 = """ class A { int a; // comment char b; int c; // comment2 }"""; assertEquals("Find field by dcl with comment", 2, findMatchesCount(s1, "'_Type '_Variable = '_Value?; //'Comment")); String s2 = """ class A { // comment int a; char b; // comment2 int c; }"""; assertEquals("Find field by dcl with co...
testCommentsInDclSearch
291,797
void () { String s1 = """ class A { int a; private char b; private char b2; public int c; public int c2; }"""; assertEquals("Finding package-private dcls",1, findMatchesCount(s1, "@Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;")); assertEquals("Finding package-private dcls",3, findMatchesCount(s1, "@Modifier...
testSearchingEmptyModifiers
291,798
void () { String source = """ public class TestClass { transient private String field1; transient String field2; String field3; }"""; assertEquals("Finding package-private transient fields", 1, findMatchesCount(source, "transient @Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;")); }
testSearchTransientFieldsWithModifier
291,799
void () { String s1 = """ class X {{ if (LOG.isDebugEnabled()) { int a = 1; int a = 1; } }}"""; String pattern = """ if ('_Log.isDebugEnabled()) { '_ThenStatement; '_ThenStatement; }"""; assertEquals("Comparing declarations", 1, findMatchesCount(s1, pattern)); }
test