Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
11,800
|
LombokConfigOperation () { return findNotNullChildByClass(LombokConfigOperation.class); }
|
getOperation
|
11,801
|
String () { return LombokConfigPsiUtil.getKey(this); }
|
getKey
|
11,802
|
String () { return LombokConfigPsiUtil.getValue(this); }
|
getValue
|
11,803
|
String () { return LombokConfigPsiUtil.getSign(this); }
|
getSign
|
11,804
|
void (@NotNull LombokConfigVisitor visitor) { visitor.visitCleaner(this); }
|
accept
|
11,805
|
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof LombokConfigVisitor) accept((LombokConfigVisitor)visitor); else super.accept(visitor); }
|
accept
|
11,806
|
String () { return LombokConfigPsiUtil.getKey(this); }
|
getKey
|
11,807
|
Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, LombokIcons.class.getClassLoader(), cacheKey, flags); }
|
load
|
11,808
|
String () { return "/plugins/lombok/testData"; }
|
getBasePath
|
11,809
|
LightProjectDescriptor () { return LombokTestUtil.LOMBOK_DESCRIPTOR; }
|
getProjectDescriptor
|
11,810
|
PsiFile (String fileName) { VirtualFile virtualFile = myFixture.copyFileToProject(fileName, fileName); myFixture.configureFromExistingVirtualFile(virtualFile); return myFixture.getFile(); }
|
loadToPsiFile
|
11,811
|
void () { PsiMethodCallExpression methodCall = createCall("@lombok.SneakyThrows void foo() { throwsMyException(); }"); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertTrue(exceptions.isEmpty()); }
|
testCatchAllException
|
11,812
|
void () { PsiMethodCallExpression methodCall = createCall("@lombok.SneakyThrows(MyException.class) void foo() { throwsMyException(); }"); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertTrue(exceptions.isEmpty()); }
|
testCatchSpecificException
|
11,813
|
void () { PsiMethodCallExpression methodCall = createCall("@lombok.SneakyThrows(Exception.class) void foo() { throwsMyException(); }"); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertTrue(exceptions.isEmpty()); }
|
testCatchGeneralException
|
11,814
|
void () { PsiMethodCallExpression methodCall = createCall("@lombok.SneakyThrows(SomeException.class) void foo() { throwsMyException(); }"); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertEquals(1, exceptions.size()); assertEquals("Test.MyException", exceptions.get(0).getCanonicalText()); }
|
testNotCatchException
|
11,815
|
void () { PsiFile file = createTestFile(""" @lombok.SneakyThrows public void m1() { Runnable runnable = () -> { throwsMyException(); }; } """); PsiMethodCallExpression methodCall = findMethodCall(file); assertNotNull(methodCall); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertEquals(1, exceptions.size()); assertEquals("Test.MyException", exceptions.get(0).getCanonicalText()); }
|
testLambdaSneakyThrowsWrongCatch
|
11,816
|
void () { PsiFile file = createTestFile(""" @lombok.SneakyThrows public void m1() { Runnable runnable = new Runnable() { public void run() { throwsMyException(); } }; } """); PsiMethodCallExpression methodCall = findMethodCall(file); assertNotNull(methodCall); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertEquals(1, exceptions.size()); assertEquals("Test.MyException", exceptions.get(0).getCanonicalText()); }
|
testAnonymousClassCorrectCatch
|
11,817
|
void () { throwsMyException(); }
|
run
|
11,818
|
void () { PsiFile file = createTestFile(""" @lombok.SneakyThrows public void m() { try { throwsMyException(); throwsSomeException(); } catch (Test.SomeException e) { } }"""); PsiMethodCallExpression methodCall = findMethodCall(file); assertNotNull(methodCall); PsiTryStatement tryStatement = findFirstChild(file, PsiTryStatement.class); assertNotNull(tryStatement); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, tryStatement); assertSize(0, exceptions); }
|
testTryCatchThatCatchAnotherException
|
11,819
|
void () { try { throwsMyException(); throwsSomeException(); } catch (Test.SomeException e) { } }
|
m
|
11,820
|
void () { PsiMethodCallExpression methodCall = createCall(""" @lombok.SneakyThrows public void m() { try { throwsMyException(); throwsSomeException(); } catch (Test.SomeException e) { } }"""); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertSize(0, exceptions); }
|
testTryCatchThatCatchAnotherExceptionWithNullTopElement
|
11,821
|
void () { try { throwsMyException(); throwsSomeException(); } catch (Test.SomeException e) { } }
|
m
|
11,822
|
void () { PsiFile file = createTestFile(""" @lombok.SneakyThrows public void m() { try { try { throwsMyException(); throwsSomeException(); throwsAnotherException(); } catch (Test.SomeException e) {} } catch (Test.AnotherException e) {} }"""); PsiMethodCallExpression methodCall = findMethodCall(file); assertNotNull(methodCall); PsiTryStatement tryStatement = findFirstChild(file, PsiTryStatement.class); assertNotNull(tryStatement); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertSize(0, exceptions); }
|
testTryCatchThatCatchAnotherExceptionHierarchy
|
11,823
|
void () { try { try { throwsMyException(); throwsSomeException(); throwsAnotherException(); } catch (Test.SomeException e) {} } catch (Test.AnotherException e) {} }
|
m
|
11,824
|
void () { PsiMethodCallExpression methodCall = createCall("void foo() { throwsMyException(); }"); List<PsiClassType> exceptions = ExceptionUtil.getUnhandledExceptions(methodCall, null); assertEquals(1, exceptions.size()); assertEquals("Test.MyException", exceptions.get(0).getCanonicalText()); }
|
testRegularThrows
|
11,825
|
PsiMethodCallExpression (@NonNls final String body) { final PsiFile file = createTestFile(body); PsiMethodCallExpression methodCall = findMethodCall(file); assertNotNull(methodCall); return methodCall; }
|
createCall
|
11,826
|
PsiFile (@NonNls String body) { return createFile("test.java", "class Test { " + body + "void throwsAnotherException() throws AnotherException {}" + "void throwsMyException() throws MyException {}" + "void throwsSomeException() throws SomeException {}" + "static class MyException extends Exception {}" + "static class SomeException extends Exception {}" + "static class AnotherException extends Exception {}" + "static class Exception{}" + "}"); }
|
createTestFile
|
11,827
|
PsiMethodCallExpression (@NotNull PsiElement element) { return findFirstChild(element, PsiMethodCallExpression.class); }
|
findMethodCall
|
11,828
|
void () { orderEntry = mock(OrderEntry.class); }
|
setUp
|
11,829
|
void () { when(orderEntry.getPresentableName()).thenReturn("Gradle: org.projectlombok:lombok:1.16.8"); assertEquals("1.16.8", Version.parseLombokVersion(orderEntry)); }
|
parseLombokVersionFromGradle
|
11,830
|
void () { when(orderEntry.getPresentableName()).thenReturn("Maven: org.projectlombok:lombok:1.16.6"); assertEquals("1.16.6", Version.parseLombokVersion(orderEntry)); }
|
parseLombokVersionFromMaven
|
11,831
|
void () { when(orderEntry.getPresentableName()).thenReturn("lombok"); assertNull(Version.parseLombokVersion(orderEntry)); }
|
parseLombokVersionFromUnknown
|
11,832
|
void () { assertTrue(Version.isLessThan("1", "2")); assertTrue(Version.isLessThan("", "2")); assertFalse(Version.isLessThan("1.2.3", "1.2.1")); assertTrue(Version.isLessThan("1.16.6", "1.16.8")); assertFalse(Version.isLessThan("1.16.8", "1.16.8")); assertTrue(Version.isLessThan("0.10.2", "1.16.8")); assertFalse(Version.isLessThan("1.16.9", "1.16.8")); assertTrue(Version.isLessThan(null, Version.LAST_LOMBOK_VERSION)); assertTrue(Version.isLessThan("", Version.LAST_LOMBOK_VERSION)); assertFalse(Version.isLessThan("x", Version.LAST_LOMBOK_VERSION)); assertFalse(Version.isLessThan("123", Version.LAST_LOMBOK_VERSION)); assertFalse(Version.isLessThan(Version.LAST_LOMBOK_VERSION, null)); assertFalse(Version.isLessThan(Version.LAST_LOMBOK_VERSION, "")); assertTrue(Version.isLessThan(Version.LAST_LOMBOK_VERSION, "x")); assertTrue(Version.isLessThan(Version.LAST_LOMBOK_VERSION, "123")); assertFalse(Version.isLessThan(Version.LAST_LOMBOK_VERSION, Version.LOMBOK_VERSION_WITH_JDK16_FIX)); assertFalse(Version.isLessThan(Version.LAST_LOMBOK_VERSION, Version.LAST_LOMBOK_VERSION_WITH_JPS_FIX)); }
|
isLessThan
|
11,833
|
void (@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) { DefaultLightProjectDescriptor.addJetBrainsAnnotations(model); MavenDependencyUtil.addFromMaven(model, LOMBOK_MAVEN_COORDINATES, true, DependencyScope.PROVIDED); MavenDependencyUtil.addFromMaven(model, JACKSON_MAVEN_COORDINATES); MavenDependencyUtil.addFromMaven(model, "com.google.guava:guava:27.0.1-jre"); MavenDependencyUtil.addFromMaven(model, "org.slf4j:slf4j-api:1.7.30"); model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_8); }
|
configureModule
|
11,834
|
Sdk () { return IdeaTestUtil.getMockJdk18(); }
|
getSdk
|
11,835
|
void (@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) { MavenDependencyUtil.addFromMaven(model, LOMBOK_MAVEN_COORDINATES, true, DependencyScope.PROVIDED); MavenDependencyUtil.addFromMaven(model, JACKSON_MAVEN_COORDINATES); MavenDependencyUtil.addFromMaven(model, "org.slf4j:slf4j-api:1.7.30"); model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.HIGHEST); }
|
configureModule
|
11,836
|
void (@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) { MavenDependencyUtil.addFromMaven(model, "org.projectlombok:lombok:1.18.2", true, DependencyScope.PROVIDED); model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_8); }
|
configureModule
|
11,837
|
boolean () { return !".*".equals(annotationToComparePattern()); }
|
shouldCompareAnnotations
|
11,838
|
String () { return ".*"; }
|
annotationToComparePattern
|
11,839
|
Collection<String> () { return Set.of("java.lang.SuppressWarnings", "java.lang.Override", "com.fasterxml.jackson.databind.annotation.JsonDeserialize"); }
|
annotationsToIgnoreList
|
11,840
|
boolean () { return true; }
|
shouldCompareCodeBlocks
|
11,841
|
void () { doTest(false); }
|
doTest
|
11,842
|
void (final boolean lowercaseFirstLetter) { doTest(getTestName(lowercaseFirstLetter)); }
|
doTest
|
11,843
|
void (String testName) { compareFiles(loadBeforeLombokFile(testName), loadAfterDeLombokFile(testName)); }
|
doTest
|
11,844
|
PsiJavaFile (String testName) { return getPsiJavaFile(testName, "before"); }
|
loadBeforeLombokFile
|
11,845
|
PsiJavaFile (String testName) { return getPsiJavaFile(testName, "after"); }
|
loadAfterDeLombokFile
|
11,846
|
PsiJavaFile (String testName, String type) { final String fileName = testName.replace('$', '/') + ".java"; final String filePath = type + "/" + fileName; final PsiFile psiFile = loadToPsiFile(filePath); if (!(psiFile instanceof PsiJavaFile)) { fail("The test file type is not supported"); } return (PsiJavaFile)psiFile; }
|
getPsiJavaFile
|
11,847
|
void (PsiJavaFile beforeLombokFile, PsiJavaFile afterDelombokFile) { PsiClass[] beforeClasses = beforeLombokFile.getClasses(); PsiClass[] afterClasses = afterDelombokFile.getClasses(); compareClasses(beforeClasses, afterClasses); }
|
compareFiles
|
11,848
|
void (PsiClass[] beforeClasses, PsiClass[] afterClasses) { String before = "Before classes: " + Arrays.toString(beforeClasses); String after = "After classes: " + Arrays.toString(afterClasses); assertEquals("Class counts are different " + before + " <> " + after, afterClasses.length, beforeClasses.length); for (PsiClass afterClass : afterClasses) { boolean compared = false; for (PsiClass beforeClass : beforeClasses) { if (Objects.equal(afterClass.getName(), beforeClass.getName())) { compareTwoClasses(beforeClass, afterClass); compared = true; } } assertTrue("Class names are not equal, class (" + afterClass.getName() + ") not found", compared); } }
|
compareClasses
|
11,849
|
void (PsiClass beforeClass, PsiClass afterClass) { LOG.info("Comparing classes " + beforeClass.getName() + " with " + afterClass.getName()); PsiModifierList beforeFieldModifierList = beforeClass.getModifierList(); PsiModifierList afterFieldModifierList = afterClass.getModifierList(); compareContainingClasses(beforeClass, afterClass); if (beforeFieldModifierList != null && afterFieldModifierList != null) { compareModifiers(beforeFieldModifierList, afterFieldModifierList); } compareFields(beforeClass, afterClass); compareMethods(beforeClass, afterClass); compareConstructors(beforeClass, afterClass); compareInnerClasses(beforeClass, afterClass); LOG.debug("Compared classes IntelliJ " + beforeClass.getName() + " with " + afterClass.getName()); }
|
compareTwoClasses
|
11,850
|
void (PsiClass beforeClass, PsiClass afterClass) { PsiField[] beforeClassFields = beforeClass.getFields(); PsiField[] afterClassFields = afterClass.getFields(); LOG.debug("IntelliJ fields for class " + beforeClass.getName() + ": " + Arrays.toString(beforeClassFields)); LOG.debug("Theirs fields for class " + afterClass.getName() + ": " + Arrays.toString(afterClassFields)); assertEquals("Field are different for Class: " + beforeClass.getName(), Arrays.toString(toList(afterClassFields)), Arrays.toString(toList(beforeClassFields))); for (PsiField afterField : afterClassFields) { boolean compared = false; final PsiModifierList afterFieldModifierList = afterField.getModifierList(); for (PsiField beforeField : beforeClassFields) { if (Objects.equal(afterField.getName(), beforeField.getName())) { final PsiModifierList beforeFieldModifierList = beforeField.getModifierList(); if (beforeFieldModifierList != null && afterFieldModifierList != null) { compareModifiers(beforeFieldModifierList, afterFieldModifierList); } compareType(beforeField.getType(), afterField.getType(), afterField); compareInitializers(beforeField.getInitializer(), afterField.getInitializer()); compared = true; } } assertTrue("Fieldnames are not equal, Field (" + afterField.getName() + ") not found", compared); } }
|
compareFields
|
11,851
|
void (PsiExpression beforeInitializer, PsiExpression afterInitializer) { String beforeInitializerText = null == beforeInitializer ? "" : beforeInitializer.getText(); String afterInitializerText = null == afterInitializer ? "" : afterInitializer.getText(); assertEquals("Initializers are not equals ", afterInitializerText, beforeInitializerText); }
|
compareInitializers
|
11,852
|
void (PsiType beforeType, PsiType afterType, PomNamedTarget whereTarget) { if (null != beforeType && null != afterType) { final String afterText = stripJavaLang(afterType.getCanonicalText()); final String beforeText = stripJavaLang(beforeType.getCanonicalText()); assertEquals(String.format("Types are not equal for element: %s", whereTarget.getName()), afterText, beforeText); } }
|
compareType
|
11,853
|
String (String canonicalText) { return StringUtil.trimStart(canonicalText, "java.lang."); }
|
stripJavaLang
|
11,854
|
void (@NotNull PsiModifierList beforeModifierList, @NotNull PsiModifierList afterModifierList) { for (String modifier : PsiModifier.MODIFIERS) { boolean haveSameModifiers = afterModifierList.hasModifierProperty(modifier) == beforeModifierList.hasModifierProperty(modifier); if (!haveSameModifiers) { final PsiMethod afterModifierListParentMethod = PsiTreeUtil.getContextOfType(afterModifierList, PsiMethod.class); final PsiMethod afterModifierListParentField = PsiTreeUtil.getContextOfType(afterModifierList, PsiMethod.class); final PsiClass afterModifierListParentClass = PsiTreeUtil.getContextOfType(afterModifierList, PsiClass.class); final String target; if (afterModifierListParentMethod != null) { target = afterModifierListParentMethod.getText(); } else if (afterModifierListParentField != null) { target = afterModifierListParentField.getName(); } else { target = afterModifierListParentClass.getName(); } fail(modifier + " Modifier is not equal for " + target); } } compareAnnotations(beforeModifierList, afterModifierList); }
|
compareModifiers
|
11,855
|
void (PsiModifierList beforeModifierList, PsiModifierList afterModifierList) { if (shouldCompareAnnotations()) { Collection<String> beforeAnnotations = Arrays.stream(beforeModifierList.getAnnotations()) .map(PsiAnnotation::getQualifiedName) .filter(Pattern.compile("lombok.*").asPredicate().negate().or(LombokClassNames.NON_NULL::equals)) .filter(Pattern.compile(annotationToComparePattern()).asPredicate()) .filter(Predicate.not(annotationsToIgnoreList()::contains)) .toList(); Collection<String> afterAnnotations = Arrays.stream(afterModifierList.getAnnotations()) .map(PsiAnnotation::getQualifiedName) .filter(Pattern.compile(annotationToComparePattern()).asPredicate()) .filter(Predicate.not(annotationsToIgnoreList()::contains)) .toList(); assertTrue("Annotations are different for " + afterModifierList.getParent() + ": " + beforeAnnotations + "/" + afterAnnotations, beforeAnnotations.size() == afterAnnotations.size() && beforeAnnotations.containsAll(afterAnnotations) && afterAnnotations.containsAll(beforeAnnotations)); // compare annotations parameter list for (PsiAnnotation beforeAnnotation : beforeModifierList.getAnnotations()) { String qualifiedName = beforeAnnotation.getQualifiedName(); PsiAnnotation afterAnnotation = afterModifierList.findAnnotation(qualifiedName); if (null != afterAnnotation) { Map<String, String> beforeParameter = Stream.of(beforeAnnotation.getParameterList().getAttributes()) .collect(Collectors.toMap(PsiNameValuePair::getAttributeName, p -> p.getValue().getText())); Map<String, String> afterParameter = Stream.of(afterAnnotation.getParameterList().getAttributes()) .collect(Collectors.toMap(PsiNameValuePair::getAttributeName, p -> p.getValue().getText())); assertEquals("Annotation parameter are not same for " + qualifiedName, afterParameter, beforeParameter); } } } }
|
compareAnnotations
|
11,856
|
void (PsiClass beforeClass, PsiClass afterClass) { PsiMethod[] beforeMethods = beforeClass.getMethods(); PsiMethod[] afterMethods = afterClass.getMethods(); assertEquals("Methods are different for Class: " + beforeClass.getName(), Arrays.toString(toList(afterMethods)), Arrays.toString(toList(beforeMethods))); for (PsiMethod afterMethod : afterMethods) { final Collection<PsiMethod> matchedMethods = filterMethods(beforeMethods, afterMethod); if (matchedMethods.isEmpty()) { fail("Method names are not equal, Method: " + afterMethod.getPresentation().getPresentableText() + " not found in class : " + beforeClass.getName()); } for (PsiMethod beforeMethod : matchedMethods) { compareMethod(beforeClass, afterClass, afterMethod, beforeMethod); } } }
|
compareMethods
|
11,857
|
void (PsiClass beforeClass, PsiClass afterClass, PsiMethod afterMethod, PsiMethod beforeMethod) { final PsiModifierList afterModifierList = afterMethod.getModifierList(); PsiModifierList beforeModifierList = beforeMethod.getModifierList(); compareModifiers(beforeModifierList, afterModifierList); compareType(beforeMethod.getReturnType(), afterMethod.getReturnType(), afterMethod); compareParams(beforeMethod.getParameterList(), afterMethod.getParameterList()); compareThrows(beforeMethod.getThrowsList(), afterMethod.getThrowsList(), afterMethod); if (shouldCompareCodeBlocks()) { final PsiCodeBlock beforeMethodBody = beforeMethod.getBody(); final PsiCodeBlock afterMethodBody = afterMethod.getBody(); if (null != beforeMethodBody && null != afterMethodBody) { boolean codeBlocksAreEqual = beforeMethodBody.textMatches(afterMethodBody); if (!codeBlocksAreEqual) { String text1 = beforeMethodBody.getText().replaceAll("java\\.lang\\.", "").replaceAll("\\s+", ""); String text2 = afterMethodBody.getText().replaceAll("java\\.lang\\.", "").replaceAll("\\s+", ""); assertEquals("Method: (" + afterMethod.getName() + ") in Class:" + afterClass.getName() + " different", text2, text1); } } else { if (null != afterMethodBody) { fail("MethodCodeBlocks is null: Method: (" + beforeMethod.getName() + ") Class:" + beforeClass.getName()); } } } }
|
compareMethod
|
11,858
|
Collection<PsiMethod> (PsiMethod[] beforeMethods, PsiMethod compareMethod) { Collection<PsiMethod> result = new ArrayList<>(); for (PsiMethod psiMethod : beforeMethods) { final PsiParameterList compareMethodParameterList = compareMethod.getParameterList(); final PsiParameterList psiMethodParameterList = psiMethod.getParameterList(); if (compareMethod.getName().equals(psiMethod.getName()) && compareMethodParameterList.getParametersCount() == psiMethodParameterList.getParametersCount()) { final Collection<String> typesOfCompareMethod = mapToTypeString(compareMethodParameterList); final Collection<String> typesOfPsiMethod = mapToTypeString(psiMethodParameterList); if (typesOfCompareMethod.equals(typesOfPsiMethod)) { result.add(psiMethod); } } } return result; }
|
filterMethods
|
11,859
|
Collection<String> (PsiParameterList compareMethodParameterList) { Collection<String> result = new ArrayList<>(); final PsiParameter[] compareMethodParameterListParameters = compareMethodParameterList.getParameters(); for (PsiParameter compareMethodParameterListParameter : compareMethodParameterListParameters) { result.add(stripJavaLang(compareMethodParameterListParameter.getType().getCanonicalText())); } return result; }
|
mapToTypeString
|
11,860
|
String[] (PsiNamedElement[] beforeMethods) { return Arrays.stream(beforeMethods).map(PsiNamedElement::getName) .filter(java.util.Objects::isNull).sorted(String.CASE_INSENSITIVE_ORDER).toArray(String[]::new); }
|
toList
|
11,861
|
void (PsiReferenceList beforeThrows, PsiReferenceList afterThrows, PsiMethod psiMethod) { PsiClassType[] beforeTypes = beforeThrows.getReferencedTypes(); PsiClassType[] afterTypes = afterThrows.getReferencedTypes(); assertEquals("Throws counts are different for Method :" + psiMethod.getName(), beforeTypes.length, afterTypes.length); for (PsiClassType beforeType : beforeTypes) { boolean found = false; for (PsiClassType afterType : afterTypes) { if (beforeType.equals(afterType)) { found = true; break; } } assertTrue("Expected throw: " + beforeType.getClassName() + " not found on " + psiMethod.getName(), found); } }
|
compareThrows
|
11,862
|
void (PsiClass beforeClass, PsiClass afterClass) { PsiMethod[] beforeConstructors = beforeClass.getConstructors(); PsiMethod[] afterConstructors = afterClass.getConstructors(); LOG.debug("IntelliJ constructors for class " + beforeClass.getName() + ": " + Arrays.toString(beforeConstructors)); LOG.debug("Theirs constructors for class " + afterClass.getName() + ": " + Arrays.toString(afterConstructors)); assertEquals("Constructor counts are different for Class: " + beforeClass.getName(), afterConstructors.length, beforeConstructors.length); for (PsiMethod afterConstructor : afterConstructors) { boolean compared = false; final PsiModifierList theirsFieldModifierList = afterConstructor.getModifierList(); final List<PsiType> afterConstructorParameterTypes = ContainerUtil.map(afterConstructor.getParameterList().getParameters(), PsiParameter::getType); for (PsiMethod beforeConstructor : beforeConstructors) { if (PsiElementUtil.methodMatches(beforeConstructor, null, null, afterConstructor.getName(), afterConstructorParameterTypes)) { final PsiModifierList intellijConstructorModifierList = beforeConstructor.getModifierList(); compareModifiers(intellijConstructorModifierList, theirsFieldModifierList); compared = true; break; } } assertTrue("Constructors are not equal, Constructor: '" + afterConstructor.getName() + "' (with same parameters) not found in class : " + beforeClass.getName(), compared); } }
|
compareConstructors
|
11,863
|
void (PsiClass intellij, PsiClass theirs) { PsiClass intellijContainingClass = intellij.getContainingClass(); PsiClass theirsContainingClass = theirs.getContainingClass(); String intellijContainingClassName = intellijContainingClass == null ? null : intellijContainingClass.toString(); String theirsContainingClassName = theirsContainingClass == null ? null : theirsContainingClass.toString(); LOG.debug("IntelliJ containing class for class " + intellij.getName() + ": " + intellijContainingClassName); LOG.debug("Theirs containing class for class " + theirs.getName() + ": " + theirsContainingClassName); assertEquals("Containing classes different for class: " + intellij.getName(), intellijContainingClassName, theirsContainingClassName); }
|
compareContainingClasses
|
11,864
|
void (PsiClass intellij, PsiClass theirs) { PsiClass[] intellijClasses = intellij.getInnerClasses(); PsiClass[] theirsClasses = theirs.getInnerClasses(); LOG.debug("IntelliJ inner classes for class " + intellij.getName() + ": " + Arrays.toString(intellijClasses)); LOG.debug("Theirs inner classes for class " + theirs.getName() + ": " + Arrays.toString(theirsClasses)); compareClasses(intellijClasses, theirsClasses); }
|
compareInnerClasses
|
11,865
|
void (PsiParameterList intellij, PsiParameterList theirs) { assertEquals(theirs.getParametersCount(), intellij.getParametersCount()); PsiParameter[] intellijParameters = intellij.getParameters(); PsiParameter[] theirsParameters = theirs.getParameters(); for (int i = 0; i < intellijParameters.length; i++) { PsiParameter intellijParameter = intellijParameters[i]; PsiParameter theirsParameter = theirsParameters[i]; compareType(intellijParameter.getType(), theirsParameter.getType(), theirsParameter); compareAnnotations(intellijParameter.getModifierList(), theirsParameter.getModifierList()); } }
|
compareParams
|
11,866
|
String () { return super.getBasePath() + "/configsystem/value"; }
|
getBasePath
|
11,867
|
String () { return super.getBasePath() + "/configsystem/fieldnameconstants"; }
|
getBasePath
|
11,868
|
String () { return super.getBasePath() + "/configsystem/data"; }
|
getBasePath
|
11,869
|
String () { return super.getBasePath() + "/configsystem/log"; }
|
getBasePath
|
11,870
|
String () { return super.getBasePath() + "/configsystem/getter"; }
|
getBasePath
|
11,871
|
boolean () { return true; }
|
shouldCompareAnnotations
|
11,872
|
String () { return super.getBasePath() + "/configsystem/constructor"; }
|
getBasePath
|
11,873
|
String () { return super.getBasePath() + "/configsystem/fieldDefaults"; }
|
getBasePath
|
11,874
|
void () { final String fullFileName = getTestName(true).replace('$', '/') + ".java"; final int lastIndexOf = fullFileName.lastIndexOf('/'); final String subPath = fullFileName.substring(0, lastIndexOf); final String fileName = fullFileName.substring(lastIndexOf + 1); myFixture.copyFileToProject(subPath + "/before/lombok.config", subPath + "/before/lombok.config"); doTest(subPath + "/before/" + fileName, subPath + "/after/" + fileName); }
|
doTest
|
11,875
|
void (final String beforeFileName, final String afterFileName) { final PsiFile psiDelombokFile = loadToPsiFile(afterFileName); final PsiFile psiLombokFile = loadToPsiFile(beforeFileName); if (!(psiLombokFile instanceof PsiJavaFile) || !(psiDelombokFile instanceof PsiJavaFile)) { fail("The test file type is not supported"); } compareFiles((PsiJavaFile) psiLombokFile, (PsiJavaFile) psiDelombokFile); }
|
doTest
|
11,876
|
boolean () { return true; }
|
shouldCompareAnnotations
|
11,877
|
String () { return super.getBasePath() + "/configsystem/equalsandhashcode"; }
|
getBasePath
|
11,878
|
boolean () { return true; }
|
shouldCompareAnnotations
|
11,879
|
String () { return super.getBasePath() + "/configsystem/tostring"; }
|
getBasePath
|
11,880
|
boolean () { return true; }
|
shouldCompareAnnotations
|
11,881
|
String () { return super.getBasePath() + "/configsystem/accessors"; }
|
getBasePath
|
11,882
|
String () { return super.getBasePath() + "/configsystem/builder"; }
|
getBasePath
|
11,883
|
boolean () { return true; }
|
shouldCompareAnnotations
|
11,884
|
String () { return super.getBasePath() + "/configsystem/builder"; }
|
getBasePath
|
11,885
|
String () { return super.getBasePath() + "/configsystem/completion"; }
|
getBasePath
|
11,886
|
void () { doTest("LOGGER1"); }
|
testLoggerCompletionTest
|
11,887
|
void (String... expectedSuggestions) { final String fileName = getTestName(false).replace('$', '/') + ".java"; myFixture.copyFileToProject("lombok.config", "lombok.config"); myFixture.configureByFile( fileName); myFixture.complete(CompletionType.BASIC, 1); List<String> autoSuggestions = myFixture.getLookupElementStrings(); assertNotNull(autoSuggestions); assertThat("Autocomplete doesn't contain right suggestions", autoSuggestions, CoreMatchers.hasItems(expectedSuggestions)); }
|
doTest
|
11,888
|
void () { PsiClass psiClass = myFixture.addClass(""" @lombok.AllArgsConstructor class MyBean { String property; }"""); PsiMethod[] constructors = psiClass.getConstructors(); PsiMethod constructor = assertOneElement(constructors); PsiParameter parameter = assertOneElement(constructor.getParameterList().getParameters()); PsiElement navigationElement = parameter.getNavigationElement(); PsiField field = assertInstanceOf(navigationElement, PsiField.class); assertEquals("MyBean.java", field.getContainingFile().getVirtualFile().getName()); assertEquals("property", field.getName()); }
|
testConstructorParameter
|
11,889
|
void () { PsiClass psiClass = myFixture.addClass(""" @lombok.AllArgsConstructor(staticName="of", access = AccessLevel.PUBLIC) class MyBean { String property; }"""); PsiMethod factory = ContainerUtil.find(psiClass.getMethods(), psiMethod -> psiMethod.getName().equals("of")); assertNotNull(factory); PsiParameter parameter = assertOneElement(factory.getParameterList().getParameters()); PsiElement navigationElement = parameter.getNavigationElement(); PsiField field = assertInstanceOf(navigationElement, PsiField.class); assertEquals("MyBean.java", field.getContainingFile().getVirtualFile().getName()); assertEquals("property", field.getName()); }
|
testStaticFactoryParameter
|
11,890
|
void () { Registry.get("platform.random.idempotence.check.rate").setValue(1, getTestRootDisposable()); myFixture.configureByFile("/postfix/issue670/" + getTestName(false) + ".java"); final PsiMethod[] firstCallGetMethods = myFixture.findClass("Issue670").getMethods(); assertNotEmpty(Arrays.asList(firstCallGetMethods)); // change something in the file myFixture.type('0'); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); final PsiMethod[] secondCallGetMethods = myFixture.findClass("Issue670").getMethods(); assertNotEmpty(Arrays.asList(secondCallGetMethods)); // all methods should be in same order assertArrayEquals(firstCallGetMethods, secondCallGetMethods); }
|
testIssue670
|
11,891
|
void () { doTest("/postfix/varl/"); }
|
testSimpleVarl
|
11,892
|
void () { doTest("/postfix/val/"); }
|
testSimpleVal
|
11,893
|
void (String pathSuffix) { myFixture.configureByFile( pathSuffix + getTestName(true) + ".java"); myFixture.type('\t'); myFixture.checkResultByFile(pathSuffix + getTestName(true) + "_after.java", true); }
|
doTest
|
11,894
|
void () { doPropertiesTest(LOMBOKED_TEST_CLASS, """ -Test.java -Test Test(float, String, Boolean, int) Test() equals(Object): boolean canEqual(Object): boolean hashCode(): int toString(): String -fff: float fff(): float fff(float): Test fff: float -myString: String string(): String string(String): Test myString: String -myActive: Boolean active(): Boolean active(Boolean): Test withActive(Boolean): Test myActive: Boolean -myX: int getX(): int setX(int): void myX: int """); }
|
testLombokPropertiesGrouping
|
11,895
|
void (String classText, String expected) { doTest(classText, expected, false, true); }
|
doPropertiesTest
|
11,896
|
void (String classText, String expected, boolean showInterfaces, boolean showProperties) { myFixture.configureByText("Test.java", classText); myFixture.testStructureView(svc -> { svc.setActionActive(SuperTypesGrouper.ID, showInterfaces); svc.setActionActive(PropertiesGrouper.ID, showProperties); svc.setActionActive(JavaAnonymousClassesNodeProvider.ID, true); JTree tree = svc.getTree(); PlatformTestUtil.waitWhileBusy(tree); PlatformTestUtil.expandAll(tree); PlatformTestUtil.assertTreeEqual(tree, expected); }); }
|
doTest
|
11,897
|
String () { return super.getBasePath() + "/extension"; }
|
getBasePath
|
11,898
|
void () { myFixture.configureByFile('/' + getTestName(false) + ".java"); final List<IntentionAction> availableActions = getAvailableActions(); assertTrue("Intention to add @SneakyThrows was not presented", ContainerUtil.exists(availableActions, action -> action.getText().contains("@SneakyThrows"))); }
|
testCheckedExeptionQuickFixExample
|
11,899
|
void () { myFixture.configureByFile( '/' + getTestName(false) + ".java"); final List<IntentionAction> availableActions = getAvailableActions(); assertTrue("Intention to add @SneakyThrows was not presented", ContainerUtil.exists(availableActions, action -> action.getText().contains("@SneakyThrows"))); }
|
testCheckedMultipleExceptionQuickFixExample
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.