Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
12,100
void () { }
run
12,101
void () { myFixture.addClass(""" package org.springframework.beans.factory.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface Qualifier { String value() default ""; }"""); }
addQualifierClass
12,102
String () { return super.getBasePath() + "/" + TEST_DATA_INSPECTION_DIRECTORY + "/onXAnnotation"; }
getBasePath
12,103
InspectionProfileEntry () { return new LombokInspection(); }
getInspection
12,104
void () { doTest(); }
testConstructorOnConstructor
12,105
void () { doTest(); }
testGetterOnMethod
12,106
void () { doTest(); }
testSetterOnParam
12,107
String () { return super.getBasePath() + "/" + TEST_DATA_INSPECTION_DIRECTORY + "/delegate"; }
getBasePath
12,108
InspectionProfileEntry () { return new LombokInspection(); }
getInspection
12,109
void () { doTest(); }
testConcreteType
12,110
void () { doTest(); }
testOnMethodWithParameter
12,111
void () { doTest(); }
testOnStaticFieldOrMethod
12,112
void () { doTest(); }
testRecursionType
12,113
void () { myFixture.enableInspections(LombokInspection.class); @Language("JAVA") final String text = """ import lombok.experimental.SuperBuilder; @SuperBuilder class DeltaComponentWithSalesAndTechComponentId { } @SuperBuilder<caret> public class DeltaOfferComponent extends DeltaComponentWithSalesAndTechComponentId { Integer max; public class DeltaOfferComponentBuilder { public DeltaOfferComponentBuilder max(Integer max) { this.max = max; return this; } } } """; myFixture.configureByText(JavaFileType.INSTANCE, text); IntentionAction action = myFixture.findSingleIntention("Make 'DeltaOfferComponentBuilder' abstract and static"); myFixture.launchAction(action); myFixture.checkResult(""" import lombok.experimental.SuperBuilder; @SuperBuilder class DeltaComponentWithSalesAndTechComponentId { } @SuperBuilder public class DeltaOfferComponent extends DeltaComponentWithSalesAndTechComponentId { Integer max; public abstract static class DeltaOfferComponentBuilder { public DeltaOfferComponentBuilder max(Integer max) { this.max = max; return this; } } } """); }
testAddModifiersAbstractAndStaticOnInnerBuilderClass
12,114
DeltaOfferComponentBuilder (Integer max) { this.max = max; return this; }
max
12,115
DeltaOfferComponentBuilder (Integer max) { this.max = max; return this; }
max
12,116
void () { @Language("JAVA") final String text = """ import lombok.experimental.SuperBuilder; @SuperBuilder class DeltaComponentWithSalesAndTechComponentId { } @SuperBuilder<caret> public class DeltaOfferComponent extends DeltaComponentWithSalesAndTechComponentId { Integer max; public static class DeltaOfferComponentBuilder { public DeltaOfferComponentBuilder max(Integer max) { this.max = max; return this; } } } """; myFixture.configureByText(JavaFileType.INSTANCE, text); assertTrue(hasActionWithText("Make 'DeltaOfferComponentBuilder' abstract")); }
testAddModifiersAbstractOnInnerBuilderClass
12,117
DeltaOfferComponentBuilder (Integer max) { this.max = max; return this; }
max
12,118
void () { @Language("JAVA") final String text = """ import lombok.experimental.SuperBuilder; @SuperBuilder class DeltaComponentWithSalesAndTechComponentId { } @SuperBuilder<caret> public class DeltaOfferComponent extends DeltaComponentWithSalesAndTechComponentId { Integer max; public abstract class DeltaOfferComponentBuilder { public DeltaOfferComponentBuilder max(Integer max) { this.max = max; return this; } } } """; myFixture.configureByText(JavaFileType.INSTANCE, text); assertTrue(hasActionWithText("Make 'DeltaOfferComponentBuilder' static")); }
testAddModifiersStaticOnInnerBuilderClass
12,119
DeltaOfferComponentBuilder (Integer max) { this.max = max; return this; }
max
12,120
boolean (String text) { myFixture.enableInspections(LombokInspection.class); final Editor editor = getEditor(); final PsiFile file = getFile(); CodeInsightTestFixtureImpl.instantiateAndRun(file, editor, new int[0], false); final List<IntentionAction> availableActions = CodeInsightTestFixtureImpl.getAvailableIntentions(editor, file); return ContainerUtil.exists(availableActions, action -> action.getText().contains(text)); }
hasActionWithText
12,121
LightProjectDescriptor () { return LombokTestUtil.LOMBOK_NEW_DESCRIPTOR; }
getProjectDescriptor
12,122
String () { return PathManager.getCommunityHomePath() + "/plugins/lombok/testData"; }
getTestDataPath
12,123
String () { return "/inspection/lombokGetterMayBeUsed/" + getTestName(false) + ".java"; }
getFilePath
12,124
void () { doTest(getFilePath(), true, false); }
doTest
12,125
void () { doTest(); }
testFieldsWithGetter
12,126
void () { doTest(); }
testInstanceAndStaticFields
12,127
void () { doTest(); }
testShortMethods
12,128
String () { return super.getBasePath() + "/" + TEST_DATA_INSPECTION_DIRECTORY + "/defUse"; }
getBasePath
12,129
InspectionProfileEntry () { return new DefUseInspection(); }
getInspection
12,130
void () { doTest(); }
testUnusedInitializerBuilderDefault
12,131
String () { return super.getBasePath() + "/" + TEST_DATA_INSPECTION_DIRECTORY + "/superbuilder"; }
getBasePath
12,132
InspectionProfileEntry () { return new LombokInspection(); }
getInspection
12,133
void () { final BuildNumber buildNumber = ApplicationInfo.getInstance().getBuild(); if (193 <= buildNumber.getBaselineVersion()) { doNamedTest(getTestName(false) + "193"); } else { doTest(); } }
testBuilderDefaultValue
12,134
void () { doTest(); }
testBuilderInvalidIdentifier
12,135
void () { doTest(); }
testBuilderRightType
12,136
void () { doTest(); }
testBuilderDefaultsWarnings
12,137
void () { doTest(); }
testBuilderInvalidUse
12,138
void () { doTest(); }
testBuilderInvalidInnerBuilderClass
12,139
void () { doTest(); }
testBuilderObtainVia
12,140
String () { return super.getBasePath() + "/" + TEST_DATA_INSPECTION_DIRECTORY + "/diverse"; }
getBasePath
12,141
InspectionProfileEntry () { return new LombokInspection(); }
getInspection
12,142
void () { doTest(); }
testDataEqualsAndHashCodeOverride
12,143
void () { doTest(); }
testEqualsAndHashCodeCallSuper
12,144
void () { doTest(); }
testIssue37
12,145
void () { doTest(); }
testSetterOnFinalField
12,146
void () { doTest(); }
testNoArgsConstructorWithRequiredFieldsShouldBeForced
12,147
void () { doTest(); }
testNoArgsConstructorWithNotNullFieldsShouldBeNotForced
12,148
String () { return super.getBasePath() + "/" + TEST_DATA_INSPECTION_DIRECTORY + "/redundantModifierInspection"; }
getBasePath
12,149
InspectionProfileEntry () { return new RedundantModifiersOnValLombokAnnotationInspection(); }
getInspection
12,150
void () { doTest(); }
testValClass
12,151
String () { return "java.lang.Deprecated"; }
annotationToComparePattern
12,152
boolean () { return false; }
shouldCompareCodeBlocks
12,153
void () { configureClass("100"); verifyLocalVariableType("int"); }
testSimpleInt
12,154
void () { configureClass("\"\""); verifyLocalVariableType("java.lang.String"); }
testSimpleString
12,155
void () { configureClass("new java.lang.String(\"Hello World\")"); verifyLocalVariableType("java.lang.String"); }
testNewString
12,156
void () { configureClass("10.0 + 20.0"); verifyLocalVariableType("double"); }
testDoubleExpression
12,157
void () { myFixture.configureByText("a.java", """ import lombok.experimental.var; abstract class Test { private void test() { int[] myArray = new int[] {1, 2, 3, 4, 5}; for(var my<caret>Var: myArray) { } }\s } """); final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); assertTrue(elementAtCaret instanceof PsiIdentifier); final PsiElement localParameter = elementAtCaret.getParent(); assertTrue(localParameter.toString(), localParameter instanceof PsiParameter); final PsiType type = ((PsiParameter) localParameter).getType(); assertNotNull(localParameter.toString(), type); assertTrue(type.getCanonicalText(), type.equalsToText("int")); }
testIntParameter
12,158
void () { int[] myArray = new int[] {1, 2, 3, 4, 5}; for(var my<caret>Var: myArray) { } }
test
12,159
void () { configureClass("10 == 10"); verifyLocalVariableType("boolean"); }
testBooleanExpression
12,160
void () { configureClass("java.util.Arrays.asList(\"a\",\"b\")"); verifyLocalVariableType("java.util.List<java.lang.String>"); }
testGenericCollection
12,161
void () { configureClass("new java.util.ArrayList<Integer>()"); verifyLocalVariableType("java.util.ArrayList<java.lang.Integer>"); }
testGenericNewCollection
12,162
void () { configureClass("new java.util.concurrent.atomic.AtomicReference<>(\"abc\")"); verifyLocalVariableType("java.util.concurrent.atomic.AtomicReference<java.lang.String>"); }
testGenericTypeDiamond296
12,163
void () { configureClass("forClass(Integer.class)", """ public static <T> java.util.List<T> forClass(Class<T> clazz) { return new java.util.ArrayList<T>(); } """); verifyLocalVariableType("java.util.List<java.lang.Integer>"); }
testGenericMethod168
12,164
void (String valDefinition) { configureClass(valDefinition, ""); }
configureClass
12,165
void (String valDefinition, String extraDefinition) { myFixture.configureByText("a.java", "import lombok.experimental.var;\n" + "abstract class Test {\n" + " private void test() {\n" + " var my<caret>Var = " + valDefinition + "; \n" + //" my<caret>Var = " + valDefinition + "; \n" + " } \n" + extraDefinition + "}\n"); }
configureClass
12,166
void (final String expectedType) { final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); assertTrue(elementAtCaret instanceof PsiIdentifier); final PsiElement localVariable = elementAtCaret.getParent(); assertTrue(localVariable.toString(), localVariable instanceof PsiLocalVariable); final PsiType type = ((PsiLocalVariable) localVariable).getType(); assertNotNull(localVariable.toString(), type); assertTrue(type.getCanonicalText(), type.equalsToText(expectedType)); }
verifyLocalVariableType
12,167
boolean () { return false; }
shouldCompareCodeBlocks
12,168
void () { doTest(); }
testNonNullPlain
12,169
void () { doTest(); }
testSynchronizedName
12,170
void () { //TODO known problem, try to fix later doTest(); }
ignore_testSynchronizedPlain
12,171
boolean () { return true; }
shouldCompareAnnotations
12,172
boolean () { return false; }
shouldCompareCodeBlocks
12,173
void () { doTest(false); }
testTestOnX
12,174
LightProjectDescriptor () { return LombokTestUtil.LOMBOK_NEW_DESCRIPTOR; }
getProjectDescriptor
12,175
boolean () { return false; }
shouldCompareCodeBlocks
12,176
boolean () { return false; }
shouldCompareCodeBlocks
12,177
String () { return super.getBasePath() + "/augment/exception"; }
getBasePath
12,178
void () { PsiFile psiFile = loadToPsiFile(getTestName(false) + ".java"); assertNotNull(psiFile); PsiClass psiClass = PsiTreeUtil.getParentOfType(psiFile.findElementAt(myFixture.getCaretOffset()), PsiClass.class); assertNotNull(psiClass); // call augmentprovider first time final PsiMethod[] psiClassMethods = psiClass.getMethods(); assertEquals(8, psiClassMethods.length); // change something to trigger cache drop WriteCommandAction.writeCommandAction(getProject(), psiFile).compute(() -> { psiClass.getModifierList().addAnnotation("java.lang.SuppressWarnings"); return true; } ); // call augment provider second time final PsiMethod[] psiClassMethods2 = psiClass.getMethods(); assertArrayEquals(psiClassMethods, psiClassMethods2); }
testError526
12,179
void () { configureClass("100"); verifyLocalVariableType("int"); }
testSimpleInt
12,180
void () { configureClass("\"\""); verifyLocalVariableType("java.lang.String"); }
testSimpleString
12,181
void () { configureClass("new java.lang.String(\"Hello World\")"); verifyLocalVariableType("java.lang.String"); }
testNewString
12,182
void () { configureClass("10.0 + 20.0"); verifyLocalVariableType("double"); }
testDoubleExpression
12,183
void () { myFixture.configureByText("a.java", """ import lombok.val; abstract class Test { private void test() { int[] myArray = new int[] {1, 2, 3, 4, 5}; for(val my<caret>Var: myArray) { } }\s } """); final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); assertTrue(elementAtCaret instanceof PsiIdentifier); final PsiElement localParameter = elementAtCaret.getParent(); assertTrue(localParameter.toString(), localParameter instanceof PsiParameter); final PsiType type = ((PsiParameter) localParameter).getType(); assertNotNull(localParameter.toString(), type); assertTrue(type.getCanonicalText(), type.equalsToText("int")); }
testIntParameter
12,184
void () { int[] myArray = new int[] {1, 2, 3, 4, 5}; for(val my<caret>Var: myArray) { } }
test
12,185
void () { configureClass("10 == 10"); verifyLocalVariableType("boolean"); }
testBooleanExpression
12,186
void () { configureClass("java.util.Arrays.asList(\"a\",\"b\")"); verifyLocalVariableType("java.util.List<java.lang.String>"); }
testGenericCollection
12,187
void () { configureClass("new java.util.ArrayList<Integer>()"); verifyLocalVariableType("java.util.ArrayList<java.lang.Integer>"); }
testGenericNewCollection
12,188
void () { configureClass("new java.util.concurrent.atomic.AtomicReference<>(\"abc\")"); verifyLocalVariableType("java.util.concurrent.atomic.AtomicReference<java.lang.String>"); }
testGenericTypeDiamond296
12,189
void () { configureClass("forClass(Integer.class)", """ public static <T> java.util.List<T> forClass(Class<T> clazz) { return new java.util.ArrayList<T>(); } """); verifyLocalVariableType("java.util.List<java.lang.Integer>"); }
testGenericMethod168
12,190
void () { configureClass("TYPE_ID_MAPPINGS.containsKey(\"key\") ? newHashSet(TYPE_ID_MAPPINGS.get(\"key\")) : MULTIPLE_SEARCH_TYPES", """ private static java.util.Map<java.lang.String, java.lang.String> TYPE_ID_MAPPINGS = new java.util.HashMap<>(); private static java.util.Set<java.lang.String> MULTIPLE_SEARCH_TYPES = new java.util.HashSet<>(); public static <E> java.util.Collection<E> newHashSet(E foo) { return new java.util.HashSet<>(); }"""); verifyLocalVariableType("java.util.Collection<java.lang.String>"); }
testConditionalExpressionThen260
12,191
void () { configureClass("TYPE_ID_MAPPINGS.containsKey(\"key\") ? newHashSet(TYPE_ID_MAPPINGS.get(\"key\")) : MULTIPLE_SEARCH_TYPES", """ private static java.util.Map<java.lang.String, java.lang.String> TYPE_ID_MAPPINGS = new java.util.HashMap<>(); private static java.util.Set<java.lang.String> MULTIPLE_SEARCH_TYPES = new java.util.HashSet<>(); public static <E> java.util.SortedSet<E> newHashSet(E foo) { return new java.util.TreeSet<>(); }"""); verifyLocalVariableType("java.util.Set<java.lang.String>"); }
testConditionalExpressionElse260
12,192
void () { PsiFile file = myFixture.configureByText("a.java", """ import lombok.val; import java.util.Optional; class Test { public void test() { val strOpt = Optional.of("1"); val intOptInferred<caret>Lambda = strOpt.map(str -> Integer.valueOf(str)); } } """); PsiLocalVariable var = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), PsiLocalVariable.class); assertNotNull(var); PsiType typeBefore = var.getType(); assertNotNull(typeBefore); assertEquals("java.util.Optional<java.lang.Integer>", typeBefore.getCanonicalText(false)); myFixture.testHighlighting(false, false, false, file.getVirtualFile()); myFixture.type('2'); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); // this line will fail myFixture.testHighlighting(false, false, false, file.getVirtualFile()); assertTrue(var.isValid()); PsiType typeAfter = var.getType(); assertNotNull(typeAfter); assertEquals("java.util.Optional<java.lang.Integer>", typeAfter.getCanonicalText(false)); }
testIssue802GenericTypeParamShouldNotBecomeObjectAfterMappingOuterCollection
12,193
void () { val strOpt = Optional.of("1"); val intOptInferred<caret>Lambda = strOpt.map(str -> Integer.valueOf(str)); }
test
12,194
void (String valDefinition) { configureClass(valDefinition, ""); }
configureClass
12,195
void (String valDefinition, String extraDefinition) { myFixture.configureByText("a.java", "import lombok.val;\n" + "abstract static class Test {\n" + " private void test() {\n" + " val my<caret>Var = " + valDefinition + "; \n" + " myVar.toString(); \n" + " } \n" + extraDefinition + "}\n"); }
configureClass
12,196
void (final String expectedType) { final PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); assertTrue(elementAtCaret instanceof PsiIdentifier); final PsiElement localVariable = elementAtCaret.getParent(); assertTrue(localVariable.toString(), localVariable instanceof PsiLocalVariable); final PsiType type = ((PsiLocalVariable) localVariable).getType(); assertNotNull(localVariable.toString(), type); assertTrue(type.getCanonicalText(), type.equalsToText(expectedType)); }
verifyLocalVariableType
12,197
boolean () { return false; }
shouldCompareCodeBlocks
12,198
boolean () { return true; }
shouldCompareAnnotations
12,199
LightProjectDescriptor () { return LombokTestUtil.LOMBOK_DESCRIPTOR; }
getProjectDescriptor