Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
291,600
void () { List<InspectionToolWrapper<?, ?>> tools = myProfile.getInspectionTools(null); assertEquals("SSBasedInspection and 1 child tool should be available", 2, tools.size()); }
testSimple
291,601
void () { final String expected = """ <profile version="1.0" is_locked="true"> <option name="myName" value="test" /> <inspection_tool class="SSBasedInspection" enabled="true" level="WARNING" enabled_by_default="true"> <searchConfiguration name="i" text="int i;" recursive="false" caseInsensitive="false" type="JAVA" /> <...
testDefaultToolsNotWritten
291,602
void () { final Configuration configuration = myInspection.getConfigurations().get(0); myProfile.setToolEnabled(configuration.getUuid(), false); final String expected = """ <profile version="1.0" is_locked="true"> <option name="myName" value="test" /> <inspection_tool class="865c0c0b-4ab0-3063-a5ca-a3387c1a8741" enable...
testModifiedToolShouldBeWritten
291,603
void () { final Configuration configuration = myInspection.getConfigurations().get(0); configuration.setName("j"); final String expected = """ <profile version="1.0" is_locked="true"> <option name="myName" value="test" /> <inspection_tool class="SSBasedInspection" enabled="true" level="WARNING" enabled_by_default="true...
testWriteUuidWhenNameChanged
291,604
void () { String s1 = "String ID_SPEED = \"Speed\";"; String s2 = "String 'name = \"'_string\";"; String s2_2 = "String 'name = \"'_string:[regex( .* )]\";"; String s3 = "VSegAttribute $name$ = new VSegAttribute(\"$string$\");"; String expectedResult = "VSegAttribute ID_SPEED = new VSegAttribute(\"Speed\");"; assertEqu...
testReplaceInLiterals
291,605
void () { String s1 = """ package com.www.xxx.yyy; import javax.swing.*; public class Test { public static void main(String[] args) { if (1==1) JOptionPane.showMessageDialog(null, "MESSAGE"); } }"""; String s2 = "JOptionPane.'_showDialog(null, '_msg);"; String s3 = "//FIXME provide a parent frame\n" + "JOptionPane.$sho...
testReplace2
291,606
void (String[] args) { if (1==1) JOptionPane.showMessageDialog(null, "MESSAGE"); }
main
291,607
void (String[] args) { if (1==1) //FIXME provide a parent frame JOptionPane.showMessageDialog(null, "MESSAGE"); }
main
291,608
void () { String str = """ // searching for several constructions lastTest = "several constructions match"; matches = testMatcher.findMatches(s5,s4, options); if (matches==null || matches.size()!=3) return false; // searching for several constructions lastTest = "several constructions 2"; matches = testMatcher.findMatc...
testReplace
291,609
void () { LOG.info("refreshFilesAsync, modalityState=" + ModalityState.current()); myHandler.getFiles().refreshFilesAsync(new Runnable() { public void run() { semaphore.up(); } }); }
run
291,610
void () { semaphore.up(); }
run
291,611
void () { LOG.info("refreshFilesAsync, modalityState=" + ModalityState.current()); myHandler.getFiles().refreshFilesAsync(new Runnable() { public void run() { semaphore.up(); } }); }
run
291,612
void () { semaphore.up(); }
run
291,613
void () { String s1 = "new SimpleDateFormat(\"yyyyMMddHHmmss\")"; String s2 = "'expr"; String s3 = "new AtomicReference<DateFormat>($expr$)"; String expectedResult = "new AtomicReference<DateFormat>(new SimpleDateFormat(\"yyyyMMddHHmmss\"))"; assertEquals("Replacement of top-level expression only", expectedResult, repl...
testReplaceExpr
291,614
void () { String in1 = """ class A { void b(int c, int d, /*1*/ int e) {} }"""; String expected1a = """ class A { void b(int c, int d2, /*1*/ int e) {} }"""; assertEquals("replace method parameter", expected1a, replace(in1, "int d;", "int d2;")); String expected1b = """ class A { void b(int /*!*/ c, int /*!*/ d, /*1*/ ...
testReplaceParameter
291,615
void () { String s1 = "map.put(key, value); // line 1"; String s2 = "map.put(key, value); // line 1"; String s3 = "map.put(key, value); // line 1"; String expectedResult = "map.put(key, value); // line 1"; assertEquals("replace self with comment after", expectedResult, replace(s1, s2, s3)); String s4 = "if (true) Syste...
testReplaceWithComments
291,616
void () { String s1 = """ { System.out.println(1); System.out.println(2); System.out.println(3); } { System.out.println(1); System.out.println(2); System.out.println(3); } { System.out.println(1); System.out.println(2); System.out.println(3); }"""; String s2 = """ System.out.println(1); System.out.println(2); System.ou...
testSeveralStatements
291,617
void () { l(); }
run
291,618
void () { int i = 9; int j = 9; }
l
291,619
void () { l(); }
run
291,620
void () { l(); l(); }
l
291,621
void () { '_l (); }
run
291,622
void () { $st$; }
f
291,623
void () { int i = 9; int j = 9; }
f
291,624
void () { l(); l(); }
f
291,625
void () { l(); l(); }
run
291,626
void () { l(); l(); }
run2
291,627
void () { l(); l(); }
run
291,628
void () { l(); l(); }
run2
291,629
void () { l(); l(); }
run
291,630
void () { l2(); l2(); }
run2
291,631
void () { int i = 9; int j = 9; }
l
291,632
void () { '_l{2,2}; }
run
291,633
void () { '_l; }
run2
291,634
void () { $l$; }
f
291,635
void () { l(); l(); }
f
291,636
void () { l(); l(); }
f
291,637
void () { l(); l(); }
run
291,638
void () { l2(); l2(); }
run2
291,639
void () { int i = 9; int j = 9; }
l
291,640
Object (String[] productNames) { synchronized (lock) { Object o = new Object (); assert o != null; return o; } }
getProducts
291,641
void (String[] productNames) { synchronized (lock) { boolean[] v = {true}; } }
getProducts
291,642
Object (String[] productNames) { Object o = new Object (); assert o != null; return o; }
getProducts
291,643
void (String[] productNames) { boolean[] v = {true}; }
getProducts
291,644
void () { String in = """ enum Color { RED, GREEN, BLUE } interface X { void x(); } @interface Anno {} record R(int i, int j) {} """; String what = "class 'X {}"; String by = "/** @author me */\n" + "class $X$ {}"; String expected = """ /** @author me */ enum Color { RED, GREEN, BLUE } /** @author me */ interface X { v...
testSpecialClassReplacement
291,645
int () { return super.hashCode(); }
hashCode
291,646
String () { return "hello"; }
toString
291,647
String () { return "hello"; }
toString
291,648
int () { return super.hashCode(); }
hashCode
291,649
void () { options.setToReformatAccordingToStyle(true); String s1 = "class A { public void b() {} }"; String s2 = "class 'a { '_Other* }"; String s3 = "class $a$New { Logger LOG; $Other$ }"; String expectedResult = """ class ANew { Logger LOG; public void b() { } }"""; assertEquals("Basic class replacement", expectedRes...
testClassReplacement
291,650
void () { }
b
291,651
void () { }
b
291,652
void () {}
b
291,653
void () { }
b
291,654
void () { String s37 = "class A { int a = 1; void B() {} int C(char ch) { int z = 1; } int b = 2; }"; String s38 = "class 'A { '_T '_M*('_PT '_PN*) { '_S*; } '_O* }"; String s39 = "class $A$ { $T$ $M$($PT$ $PN$) { System.out.println(\"$M$\"); $S$; } $O$ }"; String expectedResult14 = "class A { int a = 1; void B( ) { Sy...
_testClassReplacement3
291,655
void () { String s1 = """ class A { int a = 1; int b; private int c = 2; }"""; String s2 = "@Modifier(\"packageLocal\") '_Type '_Instance = '_Init?;"; String s3 = "public $Type$ $Instance$ = $Init$;"; String expectedResult = """ class A { public int a = 1; public int b; private int c = 2; }"""; assertEquals("Multiple f...
testClassReplacement4
291,656
void () { String s1 = """ public class X { /** * zzz */ void f() { } }"""; String s2 = """ class 'c { /** * zzz */ void f(){} }"""; String s3 = """ class $c$ { /** * ppp */ void f(){} }"""; String expectedResult = """ public class X { /** * ppp */ void f(){} }"""; assertEquals("Not preserving comment if it is present",...
testClassReplacement5
291,657
void () { String s1 = """ public class X { /** * zzz */ private void f(int i) { //s } }"""; String s2 = """ class 'c { /** * zzz */ void f('_t '_p){'_s+;} }"""; String s3 = """ class $c$ { /** * ppp */ void f($t$ $p$){$s$;} }"""; String expectedResult = """ public class X { /** * ppp */ private void f(int i){//s } }"""...
testClassReplacement6
291,658
void (int i) { //s }
f
291,659
void (int i) {//s }
f
291,660
void (int i) { int a = 1; //s }
f
291,661
void (int i) {int a = 1; //s }
f
291,662
void () { String s1 = """ /** * Created by IntelliJ IDEA. * User: cdr * Date: Nov 15, 2005 * Time: 4:23:29 PM * To change this template use File | Settings | File Templates. */ public class CC { /** My Comment */ int a = 3; // aaa // bbb long c = 2; void f() { } }"""; String s2 = """ /** * Created by IntelliJ IDEA. * U...
testClassReplacement7
291,663
void () { String s1 = """ public class CC { /** AAA*/ int b = 1; // comment }"""; String s2 = "int b = 1;"; String s3 = "long c = 2;"; String expectedResult = """ public class CC { /** AAA*/ long c = 2; // comment }"""; assertEquals("Class field replacement with simple pattern", expectedResult, replace(s1, s2, s3, true...
testClassReplacement8
291,664
String () { return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/"; }
getTestDataPath
291,665
void () { String searchIn = "return ( new String[]{CoreVars.CMUAudioPort + \"\"} );"; String searchFor = "return ( '_A );"; String replaceBy = "return $A$;"; String expectedResult = "return new String[]{CoreVars.CMUAudioPort + \"\"};"; assertEquals("ReplaceReturnWithArrayInitializer", expectedResult, replace(searchIn, ...
testReplaceReturnWithArrayInitializer
291,666
void () { String s1 = """ try { aaa(); } catch(Exception ex) { LOG.assertTrue(false); }"""; String s2 = "{ LOG.assertTrue(false); }"; String s3 = "{ if (false) LOG.assertTrue(false); }"; String expectedResult = """ try { aaa(); } catch (Exception ex) { if (false) LOG.assertTrue(false); }"""; options.setToReformatAccord...
testCatchReplacement
291,667
void () { String s43 = """ public @Deprecated class Foo implements Comparable<Foo> { int x; void m(){} }"""; String s44 = "class 'Class implements '_Interface { '_Content* }"; String s45 = """ @MyAnnotation class $Class$ implements $Interface$ { $Content$ }"""; String expectedResult16 = """ @MyAnnotation public @Deprec...
testSavingAccessModifiersDuringClassReplacement
291,668
void () { String s43 = """ public @Deprecated class Foo implements Comparable<Foo> { int x; void m(){} }"""; String s44 = "class 'Class implements '_Interface {}"; String s45 = "@MyAnnotation\n" + "class $Class$ implements $Interface$ {}"; String expectedResult16 = """ @MyAnnotation public @Deprecated class Foo impleme...
testDontRequireSpecialVarsForUnmatchedContent
291,669
void () {}
m2
291,670
void () {}
m2
291,671
void () { String s40 = """ class A { /* special comment*/ private List<String> a = new ArrayList(); static { int a = 1; } }"""; String s41 = """ class '_Class { '_Stuff2* '_FieldType '_FieldName = '_Init?; static { '_Stmt*; } '_Stuff* }"""; String s42 = """ class $Class$ { $Stuff2$ $FieldType$ $FieldName$ = build$Field...
testClassReplacement2
291,672
List<String> () { List<String> a = new ArrayList(); int a = 1; return a; }
buildaMap
291,673
void () { String s1 = "a=a;"; String s2 = "'a"; String s3 = "$b$"; try { replace(s1, s2, s3); fail("Undefined replace variable is not checked"); } catch (MalformedPatternException ignored) { } String s4 = "a=a;"; String s5 = "a=a;"; String s6 = "a=a"; try { replace(s4, s6, s5); fail("Undefined no ; in search"); } catch...
testReplaceExceptions
291,674
void () { String s1 = """ filterActions[0] = new Action(TEXT, LifeUtil.getIcon("search")) { void test() { int a = 1; } };"""; String s2 = "LifeUtil.getIcon(\"search\")"; String s3 = "StdIcons.SEARCH_LIFE"; String expectedResult = """ filterActions[0] = new Action(TEXT, StdIcons.SEARCH_LIFE) { void test() { int a = 1; }...
testActualParameterReplacementInConstructorInvokation
291,675
void () { String s1 = """ class A { /* */ void a() { } /* */ int b = 1; /* * */ class C {} { /* aaa */ int a; /* */ a = 1; } }"""; String s2 = "/* 'a:[regex( .* )] */"; String s2_2 = "/* */"; String s3 = ""; String expectedResult = """ class A { void a() { } int b = 1; class C { } { int a; a = 1; } }"""; options.setToR...
testRemove
291,676
void () { String code = """ for (int i = 0; i < MIMEHelper.MIME_MAP.length; i++) { String s = aFileNameWithOutExtention + MIMEHelper.MIME_MAP[i][0][0]; try { if (ENABLE_Z107_READING) { in = aFileNameWithOutExtention.getClass().getResourceAsStream(s); } else { data = ResourceHelper.readResource(s); } mime = MIMEHelper.M...
testTryCatchInLoop
291,677
void () { final String in = "class X {{ Math.abs(-1); }}"; final String what = "Math.abs('_a)"; final String by = "Math.abs($a$)"; options.setToUseStaticImport(true); final String expected = """ import static java.lang.Math.abs; class X {{ abs(-1); }}"""; assertEquals("Replacing with static import", expected, replace(i...
testUseStaticImport
291,678
void () { final String in = """ class ImportTest {{ Math.abs(-0.5); Math.sin(0.5); Math.max(1, 2); }}"""; final String what = "Math.'m('_a*)"; final String by = "Math.$m$($a$)"; final boolean save = options.isToUseStaticImport(); options.setToUseStaticImport(true); try { // depends on default setting being equal to 3 f...
testUseStaticStarImport
291,679
void () { String s1 = """ @Nullable (a=String.class) @String class Test { void aaa(String t) { String a = String.valueOf(' '); String2 a2 = String2.valueOf(' '); } }"""; String s2 = "'String:String"; String s2_2 = "String"; String s2_3 = "'String:java\\.lang\\.String"; String s2_4 = "java.lang.String"; String replaceme...
testLeastSurprise
291,680
void () { String s1 = "class B { int s(int a) { a = 1; a = 2; c(a); } }"; String s2 = "a"; String replacement = "a2"; String expected = "class B { int s(int a2) { a2 = 1; a2 = 2; c(a2); } }"; assertEquals(expected, replace(s1, s2, replacement)); }
testLeastSurprise2
291,681
void () { String s1 = """ try { em.persist(p); } catch (PersistenceException e) { // good }"""; String s2 = "try { '_TryStatement; } catch('_ExceptionType '_ExceptionDcl) { /* '_CommentContent */ }"; String replacement = "try { $TryStatement$; } catch($ExceptionType$ $ExceptionDcl$) { _logger.warning(\"$CommentContent$...
testReplaceTry
291,682
void () { String in = """ try { String[] a = {"a"}; System.out.println("blah"); } finally { } """; String what = """ try { '_statement*; } finally { \s }"""; String replacement = "$statement$;"; String expected = """ String[] a = {"a"}; System.out.println("blah"); """; assertEquals(expected, replace(in, what, replaceme...
testReplaceExtraSemicolon
291,683
void (String tag) { String psiDocTagValue = null; boolean isTypedValue = false; {} }
visitDocTag
291,684
void (String tag) { System.out.println(); String psiDocTagValue = null; boolean isTypedValue = false; {} }
visitDocTag
291,685
void () { String s1 = """ class Foo { void foo(final int i,final int i2, final int i3) { final int x = 5; } }"""; String s2 = "final '_type 'var = '_init?;"; String s3 = "$type$ $var$ = $init$;"; String expected = """ class Foo { void foo(int i,int i2, int i3) { int x = 5; } }"""; assertEquals(expected, replace(s1, s2,...
testReplaceFinalModifier
291,686
void () { final String in = """ class X { private static final int foo = 1; }"""; final String expected = """ class X { protected static final int foo = 1; }"""; assertEquals(expected, replace(in, "private '_Type '_field = '_init;", "protected $Type$ $field$ = $init$;")); }
testKeepUnmatchedModifiers
291,687
void () { String s1 = """ int a = 1; a = 2; int b = a; b2 = 3;"""; String s2 = """ int '_a = '_i; '_st*; '_a = '_c;"""; String s3 = "$st$;\n" + "$c$ = $i$;"; String expected = """ 2 = 1; int b = a; b2 = 3;"""; assertEquals(expected, replace(s1, s2, s3)); String s2_2 = """ int '_a = '_i; '_st*; int '_c = '_a;"""; String...
testRemovingRedundancy
291,688
void () { String source = "public class Peepers {\n public long serialVersionUID = 1L; \n}"; String search = "long serialVersionUID = $value$;"; String replace = ""; String expectedResult = "public class Peepers { \n}"; assertEquals(expectedResult, replace(source, search, replace, true)); }
testReplaceWithEmptyString
291,689
void () { String source = "abstract class MyClass implements java.util.List {\n private String a, b;\n}"; String search = "class 'Name implements java.util.List {\n '_ClassContent*\n}"; String replace = "class $Name$ {\n $ClassContent$\n}"; String expectedResult = "abstract class MyClass {\n private String a, b;\n}"; a...
testReplaceMultipleFieldsInSingleDeclaration
291,690
void () { String source = """ import java.io.Externalizable; import java.io.Serializable; abstract class MyClass implements Serializable, java.util.List, Externalizable {}"""; String search = "class 'TestCase implements java.util.List, '_others* {\n '_MyClassContent\n}"; String replace = "class $TestCase$ implements $o...
testReplaceInImplementsList
291,691
void () { String source = """ class MyClass { private String b;// comment public void foo() { } }"""; String search = "class 'Class {\n '_Content*\n}"; String replace = """ class $Class$ { void x() {} $Content$ void bar() {} }"""; String expectedResult = """ class MyClass { void x() {} private String b;// comment publi...
testReplaceFieldWithEndOfLineComment
291,692
void () { }
foo
291,693
void () { }
foo
291,694
void () { final String in1 = "@SuppressWarnings(\"ALL\")\n" + "public class A {}"; final String what = "@SuppressWarnings(\"ALL\")"; final String expected1a = "public class A {}"; assertEquals(expected1a, replace(in1, what, "")); final String expected1b = "@SuppressWarnings(\"NONE\") @Deprecated\n" + "public class A {}...
testReplaceAnnotation
291,695
void () { final String in1 = """ class A { int i = 1 + 2 + 3; }"""; final String what1 = "1 + '_a+"; final String by1 = "4"; assertEquals(""" class A { int i = 4; }""", replace(in1, what1, by1)); final String by2 = "$a$"; assertEquals(""" class A { int i = 2 + 3; }""", replace(in1, what1, by2)); final String by3 = "$a$...
testReplacePolyadicExpression
291,696
void () { final String in = """ class A { void m(int i) { assert 10 > i; } }"""; final String what = "assert '_a > '_b : '_c?;"; final String by = "assert $b$ < $a$ : $c$;"; assertEquals(""" class A { void m(int i) { assert i < 10; } }""", replace(in, what, by)); }
testReplaceAssert
291,697
void () { final String in = """ class A { private int i, /*1*/j, k; void m() { int i, j,// 2 k; } } """; final String what1 = "int '_i+;"; final String by1 = "float $i$;"; assertEquals(""" class A { private float i, /*1*/j, k; void m() { float i, j,// 2 k; } } """, replace(in, what1, by1)); final String what2 = "int '_...
testReplaceMultipleVariablesInOneDeclaration
291,698
void () { final String in = """ class A { void method(Object... os) {} void f(Object a, Object b, Object c) { method(a, b, c, "one" + "two"); method(a); } }"""; final String what = "method('_arg+)"; final String by = "method($newarg$)"; final ReplacementVariableDefinition variable = options.addNewVariableDefinition("ne...
testReplaceWithScriptedVariable
291,699
int () { return id; }
getId