[java-highlighting] Remove unused code and properties

Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 801074fccdff129683089fa96c2f4a0d01f07bf3
This commit is contained in:
Tagir Valeev
2025-01-09 12:30:34 +00:00
committed by intellij-monorepo-bot
parent 5ebe849655
commit f036b08d09
2 changed files with 0 additions and 49 deletions
@@ -8,7 +8,6 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.intention.QuickFixFactory;
import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
import com.intellij.core.JavaPsiBundle;
import com.intellij.java.analysis.JavaAnalysisBundle;
@@ -20,7 +19,6 @@ import com.intellij.psi.*;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.impl.source.PsiImmediateClassType;
import com.intellij.psi.util.PsiTypesUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -28,7 +26,6 @@ import org.jetbrains.annotations.Nullable;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.RetentionPolicy;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@@ -139,33 +136,6 @@ public final class AnnotationsHighlightUtil {
return info;
}
static HighlightInfo.Builder checkCyclicMemberType(@NotNull PsiTypeElement typeElement, @NotNull PsiClass aClass) {
PsiType type = typeElement.getType();
Set<PsiClass> checked = new HashSet<>();
if (cyclicDependencies(aClass, type, checked)) {
String description = JavaErrorBundle.message("annotation.cyclic.element.type");
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(typeElement).descriptionAndTooltip(description);
}
return null;
}
private static boolean cyclicDependencies(@NotNull PsiClass aClass,
@Nullable PsiType type,
@NotNull Set<? super PsiClass> checked) {
PsiClass resolvedClass = PsiUtil.resolveClassInType(type);
if (resolvedClass != null && resolvedClass.isAnnotationType()) {
if (aClass == resolvedClass) {
return true;
}
if (!checked.add(resolvedClass) || !BaseIntentionAction.canModify(resolvedClass)) return false;
PsiMethod[] methods = resolvedClass.getMethods();
for (PsiMethod method : methods) {
if (cyclicDependencies(aClass, method.getReturnType(), checked)) return true;
}
}
return false;
}
static HighlightInfo.Builder checkRepeatableAnnotation(@NotNull PsiAnnotation annotation) {
String qualifiedName = annotation.getQualifiedName();
if (!CommonClassNames.JAVA_LANG_ANNOTATION_REPEATABLE.equals(qualifiedName)) return null;
@@ -1,20 +1,10 @@
# @interface (annotation) related messages
annotation.not.allowed.here=Annotations are not allowed here
annotation.unknown.method=Cannot find @interface method ''{0}()''
# suppress inspection "UnusedProperty"
annotation.missing.method=Cannot find @interface method ''{0}()''
annotation.illegal.array.initializer=Illegal initializer for ''{0}''
annotation.duplicate.annotation=Duplicate annotation
annotation.duplicate.attribute=Duplicate attribute ''{0}''
annotation.not.applicable=''@{0}'' not applicable to {1}
annotation.non.constant.attribute.value=Attribute value must be constant
annotation.non.class.literal.attribute.value=Attribute value must be a class literal
annotation.non.enum.constant.attribute.value=Attribute value must be an enum constant
annotation.invalid.annotation.member.type=Invalid type ''{0}'' for annotation member
annotation.cyclic.element.type=Cyclic annotation element type
annotation.annotation.type.expected=Annotation type expected
annotation.members.may.not.have.throws.list='throws' not allowed on @interface method
annotation.may.not.have.extends.list='extends' not allowed on @interface
annotation.container.no.value=Invalid container annotation ''{0}'': no ''value'' method declared
annotation.container.bad.type=Invalid container annotation ''{0}'': ''value'' method should have type ''{1}''
annotation.container.low.retention=Container annotation ''{0}'' has shorter retention (''{1}'') than the contained annotation
@@ -27,12 +17,6 @@ annotation.container.wrong.place=Container annotation ''{0}'' must not be presen
annotation.container.not.applicable=Container annotation ''@{0}'' is not applicable to {1}
annotation.not.allowed.in.permit.list=Annotations not allowed in 'permits' list
receiver.wrong.context=Receivers are not allowed outside of method parameter list
receiver.static.context=The receiver cannot be used in a static context
receiver.wrong.position=The receiver should be the first parameter
receiver.type.mismatch=The receiver type does not match the enclosing class type
receiver.name.mismatch=The receiver name does not match the enclosing class type
# generics related messages
generics.holder.type=Type
generics.holder.method=Method
@@ -154,7 +138,6 @@ missing.method.body.or.declare.abstract=Method body or 'abstract' modifier expec
missing.method.body=Method body expected
abstract.method.in.non.abstract.class=Abstract method in non-abstract class
missing.return.type=Invalid method declaration; return type required
duplicate.method=''{0}'' is already defined in ''{1}''
constructor.call.must.be.first.statement=Call to ''{0}'' must be first statement in constructor body
constructor.call.only.allowed.in.constructor=Call to ''{0}'' only allowed in constructor body
constructor.call.must.be.top.level.statement=Call to ''{0}'' must be a top level statement in constructor body
@@ -168,7 +151,6 @@ marked.for.removal.default.constructor=Default constructor in ''{0}'' is depreca
recursive.constructor.invocation=Recursive constructor call
wrong.constructor.arguments=''{0}'' cannot be applied to ''{1}''
cannot.resolve.constructor=Cannot resolve constructor ''{0}''
invalid.package.annotation.containing.file=Package annotations should be in file package-info.java
clash.methods.message=''{0}'' clashes with ''{1}''
clash.methods.message.show.classes=''{0}'' in ''{2}'' clashes with ''{1}'' in ''{3}''
@@ -538,7 +520,6 @@ static.method.referenced.through.receiver.method.reference.context=Static method
static.method.referenced.through.non.static.qualifier.method.reference.context=Static method referenced through non-static qualifier
non.static.method.cannot.be.referenced.from.a.static.context.method.reference.context=Non-static method cannot be referenced from a static context
abstract.method.0.cannot.be.accessed.directly.method.reference.context=Abstract method ''{0}'' cannot be accessed directly
error.interface.member.clashes=@interface member clashes with ''{0}'' in {1}
anonymous.class.implements.interface.cannot.have.type.arguments=Anonymous class implements interface; cannot have type arguments
formal.varargs.element.type.inaccessible.here=Formal varargs element type {0} is inaccessible here
unexpected.type.class.expected=Unexpected type: class is expected