Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
12,900
|
boolean (PsiElement another) { if (another instanceof LombokLightFieldBuilder anotherLightField) { boolean stillEquivalent = getName().equals(anotherLightField.getName()) && getType().equals(anotherLightField.getType()); if (stillEquivalent) { final PsiClass containingClass = getContainingClass(); final PsiClass anotherContainingClass = anotherLightField.getContainingClass(); stillEquivalent = (null == containingClass && null == anotherContainingClass) || (null != containingClass && containingClass.isEquivalentTo(anotherContainingClass)); } return stillEquivalent; } else { return super.isEquivalentTo(another); } }
|
isEquivalentTo
|
12,901
|
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LombokLightFieldBuilder that = (LombokLightFieldBuilder) o; return Objects.equals(myName, that.myName) && Objects.equals(myNameIdentifier, that.myNameIdentifier) && Objects.equals(myModifierList, that.myModifierList) && Objects.equals(getContainingClass(), that.getContainingClass()); }
|
equals
|
12,902
|
int () { return Objects.hash(myName, myNameIdentifier, myModifierList, getContainingClass()); }
|
hashCode
|
12,903
|
Collection<PsiAnnotation> (@NotNull PsiClass psiClass) { return Collections.emptyList(); }
|
collectProcessedAnnotations
|
12,904
|
Collection<LombokProblem> (@NotNull PsiAnnotation psiAnnotation) { // TODO warning: "You're assigning an auto-cleanup variable to something else. This is a bad idea." final ProblemValidationSink problemNewBuilder = new ProblemValidationSink(); PsiLocalVariable psiVariable = PsiTreeUtil.getParentOfType(psiAnnotation, PsiLocalVariable.class); if (null != psiVariable) { final String cleanupName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "value", "close"); if (StringUtil.isEmptyOrSpaces(cleanupName)) { problemNewBuilder.addErrorMessage("inspection.message.cleanup.value.cannot.be.empty.string"); } else { validateCleanUpMethodExists(psiVariable, cleanupName, problemNewBuilder); } validateInitializerExist(problemNewBuilder, psiVariable); } else { problemNewBuilder.addErrorMessage("inspection.message.cleanup.legal.only.on.local.variable.declarations"); } return problemNewBuilder.getProblems(); }
|
verifyAnnotation
|
12,905
|
void (@NotNull PsiLocalVariable psiVariable, @NotNull String cleanupName, @NotNull ProblemValidationSink problemNewBuilder) { final PsiType psiType = psiVariable.getType(); if (psiType instanceof PsiClassType psiClassType) { final PsiClass psiClassOfField = psiClassType.resolve(); final PsiMethod[] methods; if (psiClassOfField != null) { methods = psiClassOfField.findMethodsByName(cleanupName, true); boolean hasCleanupMethod = false; for (PsiMethod method : methods) { if (0 == method.getParameterList().getParametersCount()) { hasCleanupMethod = true; } } if (!hasCleanupMethod) { problemNewBuilder.addErrorMessage("inspection.message.cleanup.method.s.not.found.on.target.class", cleanupName); } } } else { problemNewBuilder.addErrorMessage("inspection.message.cleanup.legal.only.on.local.variable.declaration.inside.block"); } }
|
validateCleanUpMethodExists
|
12,906
|
void (@NotNull ProblemValidationSink problemNewBuilder, @NotNull PsiLocalVariable psiVariable) { if (!psiVariable.hasInitializer()) { problemNewBuilder.addErrorMessage("inspection.message.cleanup.variable.declarations.need.to.be.initialized"); } }
|
validateInitializerExist
|
12,907
|
Collection<PsiAnnotation> (@NotNull PsiClass psiClass) { return Collections.emptyList(); }
|
collectProcessedAnnotations
|
12,908
|
Collection<LombokProblem> (@NotNull PsiAnnotation psiAnnotation) { final ProblemValidationSink problemBuilder = new ProblemValidationSink(); PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiAnnotation, PsiMethod.class); if (null != psiMethod) { final PsiClass containingClass = psiMethod.getContainingClass(); if (null != containingClass) { if (containingClass.isAnnotationType() || containingClass.isInterface() || containingClass.isRecord()) { problemBuilder.addErrorMessage("inspection.message.synchronized.legal.only.on.methods.in.classes.enums"); } else { if (psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) { problemBuilder.addErrorMessage("inspection.message.synchronized.legal.only.on.concrete.methods") .withLocalQuickFixes(() -> PsiQuickFixFactory.createModifierListFix(psiMethod, PsiModifier.ABSTRACT, false, false)); } else { validateReferencedField(problemBuilder, psiAnnotation, psiMethod, containingClass); } } } } return problemBuilder.getProblems(); }
|
verifyAnnotation
|
12,909
|
void (@NotNull ProblemSink problemNewBuilder, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiMethod psiMethod, @NotNull PsiClass containingClass) { @NlsSafe final String lockFieldName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "value", ""); if (StringUtil.isNotEmpty(lockFieldName)) { final boolean isStatic = psiMethod.hasModifierProperty(PsiModifier.STATIC); final PsiField lockField = containingClass.findFieldByName(lockFieldName, true); if (null != lockField) { if (isStatic && !lockField.hasModifierProperty(PsiModifier.STATIC)) { problemNewBuilder.addErrorMessage("inspection.message.synchronized.field.is.not.static", lockFieldName) .withLocalQuickFixes(() -> PsiQuickFixFactory.createModifierListFix(lockField, PsiModifier.STATIC, true, false)); } } else { final PsiClassType javaLangObjectType = PsiType.getJavaLangObject(containingClass.getManager(), containingClass.getResolveScope()); final String[] modifiers; if (isStatic) { modifiers = new String[]{PsiModifier.PRIVATE, PsiModifier.FINAL, PsiModifier.STATIC}; } else { modifiers = new String[]{PsiModifier.PRIVATE, PsiModifier.FINAL}; } problemNewBuilder.addErrorMessage("inspection.message.field.s.does.not.exist", lockFieldName) .withLocalQuickFixes(() -> PsiQuickFixFactory.createNewFieldFix(containingClass, lockFieldName, javaLangObjectType, "new Object()", modifiers)); } } }
|
validateReferencedField
|
12,910
|
boolean (@NotNull PsiVariable psiVariable) { if (psiVariable instanceof PsiLocalVariable) { return isVal((PsiLocalVariable) psiVariable); } if (!(psiVariable instanceof PsiParameter psiParameter)) { return false; } PsiTypeElement typeElement = psiParameter.getTypeElement(); if (typeElement == null) { return false; } return isPossibleVal(typeElement.getText()) && isVal(resolveQualifiedName(typeElement)); }
|
isVal
|
12,911
|
boolean (@NotNull PsiVariable psiVariable) { if (psiVariable instanceof PsiLocalVariable) { return isVar((PsiLocalVariable) psiVariable); } if (!(psiVariable instanceof PsiParameter psiParameter)) { return false; } PsiTypeElement typeElement = psiParameter.getTypeElement(); if (typeElement == null) { return false; } return isPossibleVar(typeElement.getText()) && isVar(resolveQualifiedName(typeElement)); }
|
isVar
|
12,912
|
boolean (@NotNull PsiLocalVariable psiLocalVariable) { if (psiLocalVariable.hasInitializer()) { final PsiTypeElement typeElement = psiLocalVariable.getTypeElement(); return isPossibleVal(typeElement.getText()) && isVal(resolveQualifiedName(typeElement)); } return false; }
|
isVal
|
12,913
|
boolean (@NotNull PsiLocalVariable psiLocalVariable) { if (psiLocalVariable.hasInitializer()) { final PsiTypeElement typeElement = psiLocalVariable.getTypeElement(); return isPossibleVar(typeElement.getText()) && isVar(resolveQualifiedName(typeElement)); } return false; }
|
isVar
|
12,914
|
boolean (@NotNull PsiLocalVariable psiLocalVariable) { if (psiLocalVariable.hasInitializer()) { final PsiTypeElement typeElement = psiLocalVariable.getTypeElement(); return isPossibleValOrVar(typeElement.getText()) && isValOrVar(resolveQualifiedName(typeElement)); } return false; }
|
isValOrVar
|
12,915
|
boolean (@NotNull PsiParameter psiParameter) { if (psiParameter.getParent() instanceof PsiForeachStatement) { final PsiTypeElement typeElement = psiParameter.getTypeElement(); return null != typeElement && isPossibleValOrVar(typeElement.getText()) && isValOrVar(resolveQualifiedName(typeElement)); } return false; }
|
isValOrVarForEach
|
12,916
|
boolean (@Nullable String fullQualifiedName) { return isVal(fullQualifiedName) || isVar(fullQualifiedName); }
|
isValOrVar
|
12,917
|
boolean (@Nullable String shortName) { return isPossibleVal(shortName) || isPossibleVar(shortName); }
|
isPossibleValOrVar
|
12,918
|
boolean (@Nullable String shortName) { return LOMBOK_VAL_NAME.equals(shortName); }
|
isPossibleVal
|
12,919
|
boolean (@Nullable String fullQualifiedName) { return LombokClassNames.VAL.equals(fullQualifiedName); }
|
isVal
|
12,920
|
boolean (@Nullable String shortName) { return LOMBOK_VAR_NAME.equals(shortName); }
|
isPossibleVar
|
12,921
|
boolean (@Nullable String fullQualifiedName) { return LombokClassNames.VAR.equals(fullQualifiedName) || LombokClassNames.EXPERIMENTAL_VAR.equals(fullQualifiedName); }
|
isVar
|
12,922
|
String (@NotNull PsiTypeElement typeElement) { PsiJavaCodeReferenceElement reference = typeElement.getInnermostComponentReferenceElement(); if (reference == null) { return null; } return reference.getQualifiedName(); }
|
resolveQualifiedName
|
12,923
|
Collection<PsiAnnotation> (@NotNull PsiClass psiClass) { return Collections.emptyList(); }
|
collectProcessedAnnotations
|
12,924
|
Collection<LombokProblem> (@NotNull PsiAnnotation psiAnnotation) { return Collections.emptyList(); }
|
verifyAnnotation
|
12,925
|
void (@NotNull final PsiLocalVariable psiLocalVariable, @NotNull final ProblemsHolder holder) { final PsiTypeElement typeElement = psiLocalVariable.getTypeElement(); final String typeElementText = typeElement.getText(); boolean isVal = isPossibleVal(typeElementText) && isVal(resolveQualifiedName(typeElement)); boolean isVar = isPossibleVar(typeElementText) && isVar(resolveQualifiedName(typeElement)); final String ann = isVal ? "val" : "var"; if (isVal || isVar) { final PsiExpression initializer = psiLocalVariable.getInitializer(); if (initializer == null) { holder.registerProblem(psiLocalVariable, LombokBundle.message("inspection.message.on.local.variable.requires.initializer.expression", ann), ProblemHighlightType.ERROR); } else if (initializer instanceof PsiArrayInitializerExpression) { holder.registerProblem(psiLocalVariable, LombokBundle.message("inspection.message.not.compatible.with.array.initializer.expressions", ann), ProblemHighlightType.ERROR); } else if (initializer instanceof PsiLambdaExpression) { holder.registerProblem(psiLocalVariable, LombokBundle.message("inspection.message.not.allowed.with.lambda.expressions", ann), ProblemHighlightType.ERROR); } else if (isVal) { final PsiElement typeParentParent = psiLocalVariable.getParent(); if (typeParentParent instanceof PsiDeclarationStatement && typeParentParent.getParent() instanceof PsiForStatement) { holder.registerProblem(psiLocalVariable, LombokBundle.message("inspection.message.not.allowed.in.old.style.for.loops", ann), ProblemHighlightType.ERROR); } } } }
|
verifyVariable
|
12,926
|
void (@NotNull final PsiParameter psiParameter, @NotNull final ProblemsHolder holder) { final PsiTypeElement typeElement = psiParameter.getTypeElement(); final String typeElementText = null != typeElement ? typeElement.getText() : null; boolean isVal = isPossibleVal(typeElementText) && isVal(resolveQualifiedName(typeElement)); boolean isVar = isPossibleVar(typeElementText) && isVar(resolveQualifiedName(typeElement)); if (isVar || isVal) { PsiElement scope = psiParameter.getDeclarationScope(); boolean isForeachStatement = scope instanceof PsiForeachStatement; boolean isForStatement = scope instanceof PsiForStatement; if (isVal && !isForeachStatement) { holder.registerProblem(psiParameter, LombokBundle.message("inspection.message.val.works.only.on.local.variables"), ProblemHighlightType.ERROR); } else if (isVar && !(isForeachStatement || isForStatement)) { holder.registerProblem(psiParameter, LombokBundle.message("inspection.message.var.works.only.on.local.variables.on.for.foreach.loops"), ProblemHighlightType.ERROR); } } }
|
verifyParameter
|
12,927
|
boolean (@NotNull PsiTypeElement typeElement) { final PsiElement parent = typeElement.getParent(); return (parent instanceof PsiLocalVariable && isValOrVar((PsiLocalVariable) parent)) || (parent instanceof PsiParameter && isValOrVarForEach((PsiParameter) parent)); }
|
canInferType
|
12,928
|
PsiType (PsiTypeElement typeElement) { PsiType psiType = null; if (canInferType(typeElement)) { final PsiElement parent = typeElement.getParent(); if (parent instanceof PsiLocalVariable) { psiType = processLocalVariableInitializer(((PsiLocalVariable) parent).getInitializer()); } else { psiType = processParameterDeclaration(((PsiParameter) parent).getDeclarationScope()); } if (null == psiType) { psiType = PsiType.getJavaLangObject(typeElement.getManager(), typeElement.getResolveScope()); } } return psiType; }
|
inferType
|
12,929
|
PsiType (final PsiExpression psiExpression) { PsiType result = null; if (null != psiExpression && !(psiExpression instanceof PsiArrayInitializerExpression)) { result = RecursionManager.doPreventingRecursion(psiExpression, true, () -> { PsiType type = psiExpression.getType(); // This is how IntelliJ resolves intersection types. // This way auto-completion won't show unavailable methods. if (type instanceof final PsiIntersectionType psiIntersectionType) { PsiType[] conjuncts = psiIntersectionType.getConjuncts(); if (conjuncts.length > 0) { return conjuncts[0]; } } if (type != null) { //Get upward projection, so you don't get types with missing diamonds. return JavaVarTypeUtil.getUpwardProjection(type); } return null; }); } return result; }
|
processLocalVariableInitializer
|
12,930
|
PsiType (PsiElement parentDeclarationScope) { PsiType result = null; if (parentDeclarationScope instanceof PsiForeachStatement foreachStatement) { final PsiExpression iteratedValue = foreachStatement.getIteratedValue(); if (iteratedValue != null) { result = JavaGenericsUtil.getCollectionItemType(iteratedValue); } } return result; }
|
processParameterDeclaration
|
12,931
|
Collection<Processor> (String key, Supplier<Collection<Processor>> function) { return PROCESSOR_CACHE.computeIfAbsent(key, s -> function.get()); }
|
getWithCache
|
12,932
|
LombokProcessorManager () { return ApplicationManager.getApplication().getService(LombokProcessorManager.class); }
|
getInstance
|
12,933
|
AllArgsConstructorProcessor () { return myAllArgsConstructorProcessor; }
|
getAllArgsConstructorProcessor
|
12,934
|
NoArgsConstructorProcessor () { return myNoArgsConstructorProcessor; }
|
getNoArgsConstructorProcessor
|
12,935
|
RequiredArgsConstructorProcessor () { return myRequiredArgsConstructorProcessor; }
|
getRequiredArgsConstructorProcessor
|
12,936
|
LogProcessor () { return myLogProcessor; }
|
getLogProcessor
|
12,937
|
Log4jProcessor () { return myLog4jProcessor; }
|
getLog4jProcessor
|
12,938
|
Log4j2Processor () { return myLog4j2Processor; }
|
getLog4j2Processor
|
12,939
|
Slf4jProcessor () { return mySlf4jProcessor; }
|
getSlf4jProcessor
|
12,940
|
XSlf4jProcessor () { return myXSlf4jProcessor; }
|
getXSlf4jProcessor
|
12,941
|
CommonsLogProcessor () { return myCommonsLogProcessor; }
|
getCommonsLogProcessor
|
12,942
|
JBossLogProcessor () { return myJBossLogProcessor; }
|
getJBossLogProcessor
|
12,943
|
FloggerProcessor () { return myFloggerProcessor; }
|
getFloggerProcessor
|
12,944
|
CustomLogProcessor () { return myCustomLogProcessor; }
|
getCustomLogProcessor
|
12,945
|
DataProcessor () { return myDataProcessor; }
|
getDataProcessor
|
12,946
|
EqualsAndHashCodeProcessor () { return myEqualsAndHashCodeProcessor; }
|
getEqualsAndHashCodeProcessor
|
12,947
|
GetterProcessor () { return myGetterProcessor; }
|
getGetterProcessor
|
12,948
|
SetterProcessor () { return mySetterProcessor; }
|
getSetterProcessor
|
12,949
|
ToStringProcessor () { return myToStringProcessor; }
|
getToStringProcessor
|
12,950
|
WitherProcessor () { return myWitherProcessor; }
|
getWitherProcessor
|
12,951
|
BuilderPreDefinedInnerClassFieldProcessor () { return myBuilderPreDefinedInnerClassFieldProcessor; }
|
getBuilderPreDefinedInnerClassFieldProcessor
|
12,952
|
BuilderPreDefinedInnerClassMethodProcessor () { return myBuilderPreDefinedInnerClassMethodProcessor; }
|
getBuilderPreDefinedInnerClassMethodProcessor
|
12,953
|
BuilderClassProcessor () { return myBuilderClassProcessor; }
|
getBuilderClassProcessor
|
12,954
|
BuilderProcessor () { return myBuilderProcessor; }
|
getBuilderProcessor
|
12,955
|
BuilderClassMethodProcessor () { return myBuilderClassMethodProcessor; }
|
getBuilderClassMethodProcessor
|
12,956
|
BuilderMethodProcessor () { return myBuilderMethodProcessor; }
|
getBuilderMethodProcessor
|
12,957
|
SuperBuilderPreDefinedInnerClassFieldProcessor () { return mySuperBuilderPreDefinedInnerClassFieldProcessor; }
|
getSuperBuilderPreDefinedInnerClassFieldProcessor
|
12,958
|
SuperBuilderPreDefinedInnerClassMethodProcessor () { return mySuperBuilderPreDefinedInnerClassMethodProcessor; }
|
getSuperBuilderPreDefinedInnerClassMethodProcessor
|
12,959
|
SuperBuilderClassProcessor () { return mySuperBuilderClassProcessor; }
|
getSuperBuilderClassProcessor
|
12,960
|
SuperBuilderProcessor () { return mySuperBuilderProcessor; }
|
getSuperBuilderProcessor
|
12,961
|
ValueProcessor () { return myValueProcessor; }
|
getValueProcessor
|
12,962
|
UtilityClassProcessor () { return myUtilityClassProcessor; }
|
getUtilityClassProcessor
|
12,963
|
StandardExceptionProcessor () { return myStandardExceptionProcessor; }
|
getStandardExceptionProcessor
|
12,964
|
FieldNameConstantsOldProcessor () { return myFieldNameConstantsOldProcessor; }
|
getFieldNameConstantsOldProcessor
|
12,965
|
FieldNameConstantsFieldProcessor () { return myFieldNameConstantsFieldProcessor; }
|
getFieldNameConstantsFieldProcessor
|
12,966
|
FieldNameConstantsProcessor () { return myFieldNameConstantsProcessor; }
|
getFieldNameConstantsProcessor
|
12,967
|
FieldNameConstantsPredefinedInnerClassFieldProcessor () { return myFieldNameConstantsPredefinedInnerClassFieldProcessor; }
|
getFieldNameConstantsPredefinedInnerClassFieldProcessor
|
12,968
|
DelegateFieldProcessor () { return myDelegateFieldProcessor; }
|
getDelegateFieldProcessor
|
12,969
|
GetterFieldProcessor () { return myGetterFieldProcessor; }
|
getGetterFieldProcessor
|
12,970
|
SetterFieldProcessor () { return mySetterFieldProcessor; }
|
getSetterFieldProcessor
|
12,971
|
WitherFieldProcessor () { return myWitherFieldProcessor; }
|
getWitherFieldProcessor
|
12,972
|
DelegateMethodProcessor () { return myDelegateMethodProcessor; }
|
getDelegateMethodProcessor
|
12,973
|
CleanupProcessor () { return myCleanupProcessor; }
|
getCleanupProcessor
|
12,974
|
SynchronizedProcessor () { return mySynchronizedProcessor; }
|
getSynchronizedProcessor
|
12,975
|
JacksonizedProcessor () { return myJacksonizedProcessor; }
|
getJacksonizedProcessor
|
12,976
|
Collection<Processor> () { return Arrays.asList( myAllArgsConstructorProcessor, myNoArgsConstructorProcessor, myRequiredArgsConstructorProcessor, myLogProcessor, myLog4jProcessor, myLog4j2Processor, mySlf4jProcessor, myXSlf4jProcessor, myCommonsLogProcessor, myJBossLogProcessor, myFloggerProcessor, myCustomLogProcessor, myDataProcessor, myEqualsAndHashCodeProcessor, myGetterProcessor, mySetterProcessor, myToStringProcessor, myWitherProcessor, myBuilderPreDefinedInnerClassFieldProcessor, myBuilderPreDefinedInnerClassMethodProcessor, myBuilderClassProcessor, myBuilderProcessor, myBuilderClassMethodProcessor, myBuilderMethodProcessor, mySuperBuilderPreDefinedInnerClassFieldProcessor, mySuperBuilderPreDefinedInnerClassMethodProcessor, mySuperBuilderClassProcessor, mySuperBuilderProcessor, myValueProcessor, myUtilityClassProcessor, myStandardExceptionProcessor, myFieldNameConstantsOldProcessor, myFieldNameConstantsFieldProcessor, myFieldNameConstantsProcessor, myFieldNameConstantsPredefinedInnerClassFieldProcessor, myDelegateFieldProcessor, myGetterFieldProcessor, mySetterFieldProcessor, myWitherFieldProcessor, myDelegateMethodProcessor, myCleanupProcessor, mySynchronizedProcessor, myJacksonizedProcessor ); }
|
getAllProcessors
|
12,977
|
Collection<ModifierProcessor> () { return Arrays.asList(new FieldDefaultsModifierProcessor(), new UtilityClassModifierProcessor(), new ValModifierProcessor(), new ValueModifierProcessor()); }
|
getLombokModifierProcessors
|
12,978
|
Collection<Processor> (@NotNull Class<? extends PsiElement> supportedClass) { LombokProcessorManager manager = getInstance(); return manager.getWithCache("bySupportedClass_" + supportedClass.getName(), () -> ContainerUtil.filter(manager.getAllProcessors(), p -> p.isSupportedClass(supportedClass)) ); }
|
getProcessors
|
12,979
|
Collection<Processor> (@NotNull PsiAnnotation psiAnnotation) { LombokProcessorManager manager = getInstance(); PsiJavaCodeReferenceElement nameReferenceElement = psiAnnotation.getNameReferenceElement(); if (nameReferenceElement == null) { return Collections.emptyList(); } String referenceName = nameReferenceElement.getReferenceName(); if (referenceName == null || !manager.ourSupportedShortNames.contains(referenceName)) { return Collections.emptyList(); } final String qualifiedName = psiAnnotation.getQualifiedName(); if (StringUtil.isEmpty(qualifiedName) || !qualifiedName.contains("lombok")) { return Collections.emptyList(); } return manager.getWithCache("byAnnotationFQN_" + qualifiedName, () -> ContainerUtil.filter(manager.getAllProcessors(), p -> p.isSupportedAnnotationFQN(qualifiedName)) ); }
|
getProcessors
|
12,980
|
Collection<PsiAnnotation> (@NotNull PsiClass psiClass) { return Collections.emptyList(); }
|
collectProcessedAnnotations
|
12,981
|
Collection<LombokProblem> (@NotNull PsiAnnotation psiAnnotation) { final ProblemValidationSink validationSink = new ProblemValidationSink(); final PsiModifierListOwner psiModifierListOwner; final PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiAnnotation, PsiMethod.class); if (null != psiMethod) { psiModifierListOwner = psiMethod; } else { psiModifierListOwner = PsiTreeUtil.getParentOfType(psiAnnotation, PsiClass.class); } if (null != psiModifierListOwner) { validateAnnotationOwner(psiModifierListOwner, validationSink); } return validationSink.getProblems(); }
|
verifyAnnotation
|
12,982
|
boolean (@NotNull PsiModifierListOwner psiModifierListOwner, ProblemSink validationSink) { final boolean hasBuilder = PsiAnnotationSearchUtil.isAnnotatedWith(psiModifierListOwner, LombokClassNames.BUILDER); final boolean hasSuperBuilder = PsiAnnotationSearchUtil.isAnnotatedWith(psiModifierListOwner, LombokClassNames.SUPER_BUILDER); if (!hasBuilder && !hasSuperBuilder) { validationSink.addWarningMessage("inspection.message.jacksonized.requires.builder.superbuilder"); } if (hasBuilder && hasSuperBuilder) { validationSink.addErrorMessage("inspection.message.jacksonized.cannot.process.both.builder.superbuilder"); validationSink.markFailed(); } boolean isAbstract = psiModifierListOwner.hasModifierProperty(PsiModifier.ABSTRACT); if (isAbstract) { validationSink.addErrorMessage("inspection.message.jacksonized.builder.on.abstract.classes"); validationSink.markFailed(); } final boolean hasJsonDeserialize = PsiAnnotationSearchUtil.isAnnotatedWith(psiModifierListOwner, "com.fasterxml.jackson.databind.annotation.JsonDeserialize"); if (hasJsonDeserialize) { validationSink.addErrorMessage("inspection.message.jacksonized.jsondeserialize.already.exists"); validationSink.markFailed(); } return validationSink.success(); }
|
validateAnnotationOwner
|
12,983
|
boolean (@NotNull PsiAnnotation psiAnnotation) { return true; }
|
supportAnnotationVariant
|
12,984
|
void (@NotNull Collection<? extends PsiModifierListOwner> definedMethods) { definedMethods.removeIf(definedMethod -> PsiAnnotationSearchUtil.isAnnotatedWith(definedMethod, LombokClassNames.TOLERATE)); }
|
filterToleratedElements
|
12,985
|
boolean (@NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiClass, @NotNull String annotationParameter, @NotNull ConfigKey configKey) { final boolean result; final Boolean declaredAnnotationValue = PsiAnnotationUtil.getDeclaredBooleanAnnotationValue(psiAnnotation, annotationParameter); if (null == declaredAnnotationValue) { result = configDiscovery.getBooleanLombokConfigProperty(configKey, psiClass); } else { result = declaredAnnotationValue; } return result; }
|
readAnnotationOrConfigProperty
|
12,986
|
LombokPsiElementUsage (@NotNull PsiField psiField, @NotNull PsiAnnotation psiAnnotation) { return LombokPsiElementUsage.NONE; }
|
checkFieldUsage
|
12,987
|
BuilderInfo (@NotNull PsiParameter psiParameter) { final BuilderInfo result = new BuilderInfo(); result.variableInClass = psiParameter; result.fieldInBuilderType = psiParameter.getType(); result.deprecated = hasDeprecatedAnnotation(psiParameter); result.fieldInitializer = null; result.hasBuilderDefaultAnnotation = false; result.fieldInBuilderName = psiParameter.getName(); result.capitalizationStrategy = CapitalizationStrategy.defaultValue(); result.nullAnnotationLibrary = LombokNullAnnotationLibraryDefned.NONE; result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiParameter, LombokClassNames.SINGULAR); result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiParameter, null!=result.singularAnnotation); return result; }
|
fromPsiParameter
|
12,988
|
boolean (@NotNull PsiModifierListOwner modifierListOwner) { return PsiAnnotationSearchUtil.isAnnotatedWith(modifierListOwner, Deprecated.class.getName()); }
|
hasDeprecatedAnnotation
|
12,989
|
BuilderInfo (@NotNull PsiField psiField) { final BuilderInfo result = new BuilderInfo(); result.variableInClass = psiField; result.deprecated = isDeprecated(psiField); result.fieldInBuilderType = psiField.getType(); result.fieldInitializer = psiField.getInitializer(); result.hasBuilderDefaultAnnotation = PsiAnnotationSearchUtil.isAnnotatedWith(psiField, BUILDER_DEFAULT_ANNOTATION); final AccessorsInfo accessorsInfo = AccessorsInfo.buildFor(psiField); result.fieldInBuilderName = accessorsInfo.removePrefix(psiField.getName()); result.capitalizationStrategy = accessorsInfo.getCapitalizationStrategy(); result.nullAnnotationLibrary = LombokNullAnnotationLibraryDefned.NONE; result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, LombokClassNames.SINGULAR); result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiField, null!=result.singularAnnotation); return result; }
|
fromPsiField
|
12,990
|
BuilderInfo (@NotNull PsiRecordComponent psiRecordComponent) { final BuilderInfo result = new BuilderInfo(); result.variableInClass = psiRecordComponent; result.deprecated = hasDeprecatedAnnotation(psiRecordComponent); result.fieldInBuilderType = psiRecordComponent.getType(); result.fieldInitializer = psiRecordComponent.getInitializer(); result.hasBuilderDefaultAnnotation = PsiAnnotationSearchUtil.isAnnotatedWith(psiRecordComponent, BUILDER_DEFAULT_ANNOTATION); result.fieldInBuilderName = psiRecordComponent.getName(); result.capitalizationStrategy = CapitalizationStrategy.defaultValue(); result.nullAnnotationLibrary = LombokNullAnnotationLibraryDefned.NONE; result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiRecordComponent, LombokClassNames.SINGULAR); result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiRecordComponent, null!=result.singularAnnotation); return result; }
|
fromPsiRecordComponent
|
12,991
|
boolean (@NotNull PsiField psiField) { return PsiImplUtil.isDeprecatedByDocTag(psiField) || hasDeprecatedAnnotation(psiField); }
|
isDeprecated
|
12,992
|
BuilderInfo (@NotNull PsiSubstitutor builderSubstitutor) { fieldInBuilderType = builderSubstitutor.substitute(fieldInBuilderType); return this; }
|
withSubstitutor
|
12,993
|
BuilderInfo (String visibilityModifier) { this.visibilityModifier = visibilityModifier; return this; }
|
withVisibilityModifier
|
12,994
|
BuilderInfo (String setterPrefix) { this.setterPrefix = setterPrefix; return this; }
|
withSetterPrefix
|
12,995
|
BuilderInfo (@NotNull PsiClass builderClass) { this.builderClass = builderClass; this.builderClassType = PsiClassUtil.getTypeWithGenerics(builderClass); return this; }
|
withBuilderClass
|
12,996
|
BuilderInfo (@NotNull PsiClassType builderClassType) { this.builderClassType = builderClassType; return this; }
|
withBuilderClassType
|
12,997
|
BuilderInfo (@NotNull String builderChainResult) { this.builderChainResult = builderChainResult; return this; }
|
withBuilderChainResult
|
12,998
|
BuilderInfo () { obtainViaAnnotation = PsiAnnotationSearchUtil.findAnnotation(variableInClass, BUILDER_OBTAIN_VIA_ANNOTATION); if (null != obtainViaAnnotation) { viaFieldName = PsiAnnotationUtil.getStringAnnotationValue(obtainViaAnnotation, BUILDER_OBTAIN_VIA_FIELD, ""); viaMethodName = PsiAnnotationUtil.getStringAnnotationValue(obtainViaAnnotation, BUILDER_OBTAIN_VIA_METHOD, ""); viaStaticCall = PsiAnnotationUtil.getBooleanAnnotationValue(obtainViaAnnotation, BUILDER_OBTAIN_VIA_STATIC, false); } return this; }
|
withObtainVia
|
12,999
|
boolean () { boolean result = true; PsiModifierList modifierList = variableInClass.getModifierList(); if (null != modifierList) { //Skip static fields. result = !modifierList.hasModifierProperty(PsiModifier.STATIC); // skip initialized final fields unless annotated with @Builder.Default final boolean isInitializedFinalField = null != fieldInitializer && modifierList.hasModifierProperty(PsiModifier.FINAL); if (isInitializedFinalField && !hasBuilderDefaultAnnotation) { result = false; } } //Skip fields that start with $ result &= !fieldInBuilderName.startsWith(LombokUtils.LOMBOK_INTERN_FIELD_MARKER); return result; }
|
useForBuilder
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.