Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import consulo.annotation.component.ExtensionImpl;
import consulo.application.util.RecursionManager;
import consulo.java.language.module.extension.JavaModuleExtension;
import consulo.java.language.module.util.JavaClassNames;
import consulo.json.validation.NativeArray;
import consulo.json.validation.descriptionByAnotherPsiElement.DescriptionByAnotherPsiElementProvider;
import consulo.json.validation.descriptor.JsonObjectDescriptor;
Expand All @@ -37,7 +36,6 @@
import consulo.project.Project;
import consulo.ui.annotation.RequiredUIAccess;
import consulo.util.collection.ContainerUtil;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;

Expand Down Expand Up @@ -137,21 +135,21 @@ private static PropertyType toType(@Nonnull Project project, @Nullable PsiField
PsiClass psiClass = classResolveResult.getElement();
if (psiClass != null) {
String qualifiedName = psiClass.getQualifiedName();
if (JavaClassNames.JAVA_LANG_STRING.equals(qualifiedName)) {
if (CommonClassNames.JAVA_LANG_STRING.equals(qualifiedName)) {
return new PropertyType(String.class);
} else if (JavaClassNames.JAVA_LANG_BOOLEAN.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicBoolean".equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_BOOLEAN.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicBoolean".equals(qualifiedName)) {
return new PropertyType(Boolean.class);
} else if (JavaClassNames.JAVA_LANG_BYTE.equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_BYTE.equals(qualifiedName)) {
return new PropertyType(Number.class);
} else if (JavaClassNames.JAVA_LANG_SHORT.equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_SHORT.equals(qualifiedName)) {
return new PropertyType(Number.class);
} else if (JavaClassNames.JAVA_LANG_INTEGER.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicInteger".equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_INTEGER.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicInteger".equals(qualifiedName)) {
return new PropertyType(Number.class);
} else if (JavaClassNames.JAVA_LANG_LONG.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicLong".equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_LONG.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicLong".equals(qualifiedName)) {
return new PropertyType(Number.class);
} else if (JavaClassNames.JAVA_LANG_FLOAT.equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_FLOAT.equals(qualifiedName)) {
return new PropertyType(Number.class);
} else if (JavaClassNames.JAVA_LANG_DOUBLE.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicDouble".equals(qualifiedName)) {
} else if (CommonClassNames.JAVA_LANG_DOUBLE.equals(qualifiedName) || "java.util.concurrent.atomic.AtomicDouble".equals(qualifiedName)) {
return new PropertyType(Number.class);
} else if ("java.util.concurrent.atomic.AtomicIntegerArray".equals(qualifiedName)) {
return new PropertyType(new NativeArray(Number.class));
Expand All @@ -161,7 +159,7 @@ private static PropertyType toType(@Nonnull Project project, @Nullable PsiField
return new PropertyType(new NativeArray(Number.class));
}

PsiClass collectionClass = JavaPsiFacade.getInstance(project).findClass(JavaClassNames.JAVA_UTIL_COLLECTION, GlobalSearchScope.allScope(project));
PsiClass collectionClass = JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_UTIL_COLLECTION, GlobalSearchScope.allScope(project));
if (collectionClass != null) {
if (InheritanceUtil.isInheritorOrSelf(psiClass, collectionClass, true)) {
PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(collectionClass, psiClass, classResolveResult.getSubstitutor());
Expand All @@ -177,7 +175,7 @@ private static PropertyType toType(@Nonnull Project project, @Nullable PsiField
}
}

PsiClass mapClass = JavaPsiFacade.getInstance(project).findClass(JavaClassNames.JAVA_UTIL_MAP, GlobalSearchScope.allScope(project));
PsiClass mapClass = JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_UTIL_MAP, GlobalSearchScope.allScope(project));
if (mapClass != null) {
if (InheritanceUtil.isInheritorOrSelf(psiClass, mapClass, true)) {
PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(mapClass, psiClass, classResolveResult.getSubstitutor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
*/
package com.intellij.jam;

import com.intellij.java.language.psi.PsiAnnotation;
import com.intellij.java.language.psi.PsiAnnotationMemberValue;
import com.intellij.java.language.psi.PsiClassObjectAccessExpression;
import com.intellij.java.language.psi.PsiType;
import consulo.java.language.module.util.JavaClassNames;
import com.intellij.java.language.psi.*;
import consulo.language.psi.PsiElementRef;
import jakarta.annotation.Nonnull;

Expand Down Expand Up @@ -47,7 +43,7 @@ public PsiType getValue() {
if (psiAnnotationMemberValue instanceof PsiClassObjectAccessExpression) {
psiType = ((PsiClassObjectAccessExpression) psiAnnotationMemberValue).getOperand().getType();
}
if (psiType != null && JavaClassNames.JAVA_LANG_OBJECT.equals(psiType.getCanonicalText())) {
if (psiType != null && CommonClassNames.JAVA_LANG_OBJECT.equals(psiType.getCanonicalText())) {
return null;
}
return psiType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import consulo.application.util.function.Processor;
import consulo.dataContext.DataContext;
import consulo.java.jam.util.JamCommonService;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.editor.util.PsiUtilBase;
import consulo.language.pom.PomTarget;
import consulo.language.pom.PomTargetPsiElement;
Expand Down Expand Up @@ -69,10 +68,10 @@
import consulo.xml.psi.xml.XmlFile;
import consulo.xml.psi.xml.XmlTag;
import consulo.xml.util.xml.*;
import org.jetbrains.annotations.NonNls;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.jetbrains.annotations.NonNls;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.*;
Expand Down Expand Up @@ -136,7 +135,7 @@ public static boolean processSuperClassList(
@Nonnull final Collection<PsiClass> supers,
final Processor<PsiClass> processor
) {
for (PsiClass curClass = firstClass; curClass != null && !JavaClassNames.JAVA_LANG_OBJECT.equals(curClass.getQualifiedName()) && !supers.contains(curClass); curClass = curClass.getSuperClass()) {
for (PsiClass curClass = firstClass; curClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(curClass.getQualifiedName()) && !supers.contains(curClass); curClass = curClass.getSuperClass()) {
ProgressManager.checkCanceled();
if (!processor.process(curClass)) {
return false;
Expand Down Expand Up @@ -619,7 +618,7 @@ public static PsiClass getPsiClass(@Nullable PsiAnnotationMemberValue psiAnnotat
.findClass(className, psiAnnotationMemberValue.getResolveScope());
}
}
if (psiClass != null && JavaClassNames.JAVA_LANG_OBJECT.equals(psiClass.getQualifiedName())) {
if (psiClass != null && CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass.getQualifiedName())) {
return null;
}
return psiClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import consulo.application.dumb.IndexNotReadyException;
import consulo.document.util.TextRange;
import consulo.java.language.impl.localize.JavaErrorLocalize;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.content.FileIndexFacade;
import consulo.language.editor.intention.IntentionAction;
import consulo.language.editor.intention.QuickFixActionRegistrar;
Expand Down Expand Up @@ -318,7 +317,7 @@ private static HighlightInfo.Builder checkTypeParameterWithinItsBound(
PsiClassType[] bounds = classParameter.getSuperTypes();
for (PsiClassType type1 : bounds) {
PsiType bound = substitutor.substitute(type1);
if (!bound.equalsToText(JavaClassNames.JAVA_LANG_OBJECT)
if (!bound.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)
&& GenericsUtil.checkNotInBounds(type, bound, referenceParameterList)) {
PsiClass boundClass = bound instanceof PsiClassType boundClassType ? boundClassType.resolve() : null;

Expand Down Expand Up @@ -507,7 +506,7 @@ public static HighlightInfo checkDefaultMethodOverrideEquivalentToObjectNonPriva
for (HierarchicalMethodSignature methodSignature : sig.getSuperSignatures()) {
PsiMethod objectMethod = methodSignature.getMethod();
PsiClass containingClass = objectMethod.getContainingClass();
if (containingClass != null && JavaClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())
if (containingClass != null && CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())
&& objectMethod.isPublic()) {
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
.range(methodIdentifier)
Expand Down Expand Up @@ -1247,7 +1246,7 @@ public static HighlightInfo.Builder checkOverrideAnnotation(
PsiMethod psiMethod = superMethod.getMethod();
PsiClass containingClass = psiMethod.getContainingClass();
if (containingClass != null
&& JavaClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())
&& CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())
&& psiMethod.isProtected()) {
superMethod = null;
}
Expand Down Expand Up @@ -1279,7 +1278,7 @@ public static HighlightInfo.Builder checkOverrideAnnotation(
@RequiredReadAction
public static HighlightInfo.Builder checkSafeVarargsAnnotation(PsiMethod method, LanguageLevel languageLevel) {
PsiModifierList list = method.getModifierList();
PsiAnnotation safeVarargsAnnotation = list.findAnnotation(JavaClassNames.JAVA_LANG_SAFE_VARARGS);
PsiAnnotation safeVarargsAnnotation = list.findAnnotation(CommonClassNames.JAVA_LANG_SAFE_VARARGS);
if (safeVarargsAnnotation == null) {
return null;
}
Expand Down Expand Up @@ -1505,7 +1504,7 @@ else if (parent instanceof PsiCallExpression call) {
@Nullable
@RequiredReadAction
public static HighlightInfo.Builder checkCannotInheritFromEnum(PsiClass superClass, PsiElement elementToHighlight) {
if (JavaClassNames.JAVA_LANG_ENUM.equals(superClass.getQualifiedName())) {
if (CommonClassNames.JAVA_LANG_ENUM.equals(superClass.getQualifiedName())) {
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
.range(elementToHighlight)
.descriptionAndTooltip(JavaErrorLocalize.classesExtendsEnum());
Expand All @@ -1532,7 +1531,7 @@ public static HighlightInfo.Builder checkGenericCannotExtendException(PsiReferen
}
if (throwableClass == null) {
throwableClass = JavaPsiFacade.getInstance(aClass.getProject())
.findClass(JavaClassNames.JAVA_LANG_THROWABLE, aClass.getResolveScope());
.findClass(CommonClassNames.JAVA_LANG_THROWABLE, aClass.getResolveScope());
}
if (InheritanceUtil.isInheritorOrSelf(psiClass, throwableClass, true)) {
PsiClassType classType = JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import consulo.annotation.access.RequiredReadAction;
import consulo.document.util.TextRange;
import consulo.java.language.impl.localize.JavaErrorLocalize;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.editor.rawHighlight.HighlightInfo;
import consulo.language.editor.rawHighlight.HighlightInfoType;
import consulo.language.psi.*;
Expand Down Expand Up @@ -305,7 +304,7 @@ public static HighlightInfo.Builder checkPublicClassInRightFile(PsiClass aClass)
public static HighlightInfo.Builder checkClassAndPackageConflict(@Nonnull PsiClass aClass) {
String name = aClass.getQualifiedName();

if (JavaClassNames.DEFAULT_PACKAGE.equals(name)) {
if (CommonClassNames.DEFAULT_PACKAGE.equals(name)) {
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
.range(HighlightNamesUtil.getClassDeclarationTextRange(aClass))
.descriptionAndTooltip(JavaErrorLocalize.classClashesWithPackage(name));
Expand Down Expand Up @@ -667,7 +666,7 @@ public static PsiClass getCircularClass(PsiClass aClass, Collection<PsiClass> us
PsiClass[] superTypes = aClass.getSupers();
for (PsiElement superType : superTypes) {
while (superType instanceof PsiClass) {
if (!JavaClassNames.JAVA_LANG_OBJECT.equals(((PsiClass)superType).getQualifiedName())) {
if (!CommonClassNames.JAVA_LANG_OBJECT.equals(((PsiClass)superType).getQualifiedName())) {
PsiClass circularClass = getCircularClass((PsiClass)superType, usedClasses);
if (circularClass != null) {
return circularClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import consulo.document.util.TextRange;
import consulo.document.util.TextRangeUtil;
import consulo.java.language.impl.localize.JavaErrorLocalize;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.editor.inspection.LocalQuickFixOnPsiElementAsIntentionAdapter;
import consulo.language.editor.intention.IntentionAction;
import consulo.language.editor.intention.QuickFixActionRegistrar;
Expand Down Expand Up @@ -242,7 +241,7 @@ private static HighlightInfo.Builder checkSuperMethodSignature(
}
PsiClass superContainingClass = superMethod.getContainingClass();
if (superContainingClass != null
&& JavaClassNames.JAVA_LANG_OBJECT.equals(superContainingClass.getQualifiedName())
&& CommonClassNames.JAVA_LANG_OBJECT.equals(superContainingClass.getQualifiedName())
&& !superMethod.isPublic()) {
PsiClass containingClass = method.getContainingClass();
if (containingClass != null && containingClass.isInterface() && !superContainingClass.isInterface()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import consulo.annotation.access.RequiredReadAction;
import consulo.document.util.TextRange;
import consulo.java.language.impl.localize.JavaErrorLocalize;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.ast.IElementType;
import consulo.language.editor.CodeInsightUtilCore;
import consulo.language.editor.highlight.HighlightUsagesDescriptionLocation;
Expand Down Expand Up @@ -832,7 +831,7 @@ private static void registerCollectionToArrayFixAction(
PsiType arrayComponentType = arrayType.getComponentType();
if (!(arrayComponentType instanceof PsiPrimitiveType)
&& !(PsiUtil.resolveClassInType(arrayComponentType) instanceof PsiTypeParameter)
&& InheritanceUtil.isInheritor(fromType, JavaClassNames.JAVA_UTIL_COLLECTION)) {
&& InheritanceUtil.isInheritor(fromType, CommonClassNames.JAVA_UTIL_COLLECTION)) {
PsiType collectionItemType = JavaGenericsUtil.getCollectionItemType(fromType, expression.getResolveScope());
if (collectionItemType != null && arrayComponentType.isAssignableFrom(collectionItemType)) {
hlBuilder.registerFix(QuickFixFactory.getInstance().createCollectionToArrayFix(expression, arrayType));
Expand Down Expand Up @@ -1878,7 +1877,7 @@ private static SelectorKind getSwitchSelectorKind(@Nonnull PsiType type) {
if (psiClass.isEnum()) {
return SelectorKind.ENUM;
}
if (Comparing.strEqual(psiClass.getQualifiedName(), JavaClassNames.JAVA_LANG_STRING)) {
if (Comparing.strEqual(psiClass.getQualifiedName(), CommonClassNames.JAVA_LANG_STRING)) {
return SelectorKind.STRING;
}
}
Expand Down Expand Up @@ -2256,7 +2255,7 @@ public static HighlightInfo.Builder checkTryResourceIsAutoCloseable(@Nonnull Psi
}

PsiElementFactory factory = JavaPsiFacade.getInstance(resource.getProject()).getElementFactory();
PsiClassType autoCloseable = factory.createTypeByFQClassName(JavaClassNames.JAVA_LANG_AUTO_CLOSEABLE, resource.getResolveScope());
PsiClassType autoCloseable = factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_AUTO_CLOSEABLE, resource.getResolveScope());
if (TypeConversionUtil.isAssignable(autoCloseable, type)) {
return null;
}
Expand Down Expand Up @@ -3394,7 +3393,7 @@ public static HighlightInfo.Builder checkMustBeThrowable(
return null;
}
PsiElementFactory factory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
PsiClassType throwable = factory.createTypeByFQClassName(JavaClassNames.JAVA_LANG_THROWABLE, context.getResolveScope());
PsiClassType throwable = factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_THROWABLE, context.getResolveScope());
if (!TypeConversionUtil.isAssignable(throwable, type)) {
HighlightInfo.Builder hlBuilder = createIncompatibleTypeHighlightInfo(throwable, type, context.getTextRange(), 0);
if (addCastIntention && TypeConversionUtil.areTypesConvertible(type, throwable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import consulo.document.Document;
import consulo.document.util.TextRange;
import consulo.java.language.impl.localize.JavaErrorLocalize;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.editor.DaemonCodeAnalyzer;
import consulo.language.editor.Pass;
import consulo.language.editor.rawHighlight.HighlightInfo;
Expand Down Expand Up @@ -282,7 +281,7 @@ public void visitAnnotation(@Nonnull PsiAnnotation annotation) {
if (!myHolder.hasErrorResults()) {
add(AnnotationsHighlightUtil.checkRepeatableAnnotation(annotation));
}
if (JavaClassNames.JAVA_LANG_OVERRIDE.equals(annotation.getQualifiedName())) {
if (CommonClassNames.JAVA_LANG_OVERRIDE.equals(annotation.getQualifiedName())) {
PsiAnnotationOwner owner = annotation.getOwner();
PsiElement parent = owner instanceof PsiModifierList modifierList ? modifierList.getParent() : null;
if (parent instanceof PsiMethod method) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import consulo.application.util.CachedValueProvider;
import consulo.content.scope.SearchScope;
import consulo.document.util.TextRange;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.psi.*;
import consulo.language.psi.resolve.PsiElementProcessor;
import consulo.language.psi.resolve.PsiElementProcessorAdapter;
Expand Down Expand Up @@ -462,7 +461,7 @@ private static List<PsiElement> getPotentiallyAffectingElements(PsiExpression pl

private static class GuessTypeVisitor extends JavaElementVisitor {
private static final CallMatcher OBJECT_GET_CLASS =
CallMatcher.exactInstanceCall(JavaClassNames.JAVA_LANG_OBJECT, "getClass").parameterCount(0);
CallMatcher.exactInstanceCall(CommonClassNames.JAVA_LANG_OBJECT, "getClass").parameterCount(0);
@Nonnull
private final PsiExpression myPlace;
PsiType mySpecificType;
Expand Down
Loading
Loading