[lombok] IDEA-333062 IDEA-255688 replaced isPhysical by SynteticElement check

GitOrigin-RevId: 4c5cdab364e926778332982e38c2933811016a35
This commit is contained in:
Michail Plushnikov
2023-12-11 19:15:59 +01:00
committed by intellij-monorepo-bot
parent b396d4c69f
commit 03da569fcd
2 changed files with 12 additions and 3 deletions

View File

@@ -125,8 +125,8 @@ public final class AnnotationsHighlightUtil {
} }
} }
PsiAnnotationMethod annotationMethod = ObjectUtils.tryCast(method, PsiAnnotationMethod.class); PsiAnnotationMethod annotationMethod = ObjectUtils.tryCast(method, PsiAnnotationMethod.class);
if (annotationMethod == null) return null; if (annotationMethod == null || annotationMethod instanceof SyntheticElement) return null;
if (!annotationMethod.isPhysical()) return null;
boolean fromDefaultValue = PsiTreeUtil.isAncestor(annotationMethod.getDefaultValue(), value, false); boolean fromDefaultValue = PsiTreeUtil.isAncestor(annotationMethod.getDefaultValue(), value, false);
if (value instanceof PsiAnnotation) { if (value instanceof PsiAnnotation) {
PsiJavaCodeReferenceElement nameRef = ((PsiAnnotation)value).getNameReferenceElement(); PsiJavaCodeReferenceElement nameRef = ((PsiAnnotation)value).getNameReferenceElement();

View File

@@ -35,9 +35,18 @@ public final class LombokAnnotationProcessor {
return Pair.pair(shortNamesList, fqnList); return Pair.pair(shortNamesList, fqnList);
} }
/**
* Processes the given PsiClass if it's a specific lombok annotation with onX functionality
* and returns a list of phantom underscored "onX_" methods
*
* @param psiClass the PsiClass to process
* @param nameHint the name hint to filter the results (optional)
* @return the list of augmented PsiMethods or empty list
* @see <a href="https://projectlombok.org/features/experimental/onX">Lombok onX</a>
*/
@NotNull @NotNull
public static List<PsiMethod> process(@NotNull PsiClass psiClass, @Nullable String nameHint) { public static List<PsiMethod> process(@NotNull PsiClass psiClass, @Nullable String nameHint) {
if (nameHint != null && !ContainerUtil.exists(config.keySet(), nameHint::startsWith)) { if (nameHint != null && !config.containsKey(nameHint)) {
return Collections.emptyList(); return Collections.emptyList();
} }