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 @@ -2,8 +2,8 @@

import com.intellij.java.language.impl.psi.impl.source.JavaLightTreeUtil;
import com.intellij.java.language.impl.psi.impl.source.tree.ElementType;
import com.intellij.java.language.psi.CommonClassNames;
import com.intellij.java.language.psi.JavaTokenType;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.ast.*;
import consulo.util.collection.ContainerUtil;
import jakarta.annotation.Nonnull;
Expand Down Expand Up @@ -183,10 +183,10 @@ else if (ElementType.JAVA_STATEMENT_BIT_SET.contains(type)) {
"Exception",
"RuntimeException",
"NullPointerException",
JavaClassNames.JAVA_LANG_THROWABLE,
JavaClassNames.JAVA_LANG_EXCEPTION,
JavaClassNames.JAVA_LANG_RUNTIME_EXCEPTION,
JavaClassNames.JAVA_LANG_NULL_POINTER_EXCEPTION
CommonClassNames.JAVA_LANG_THROWABLE,
CommonClassNames.JAVA_LANG_EXCEPTION,
CommonClassNames.JAVA_LANG_RUNTIME_EXCEPTION,
CommonClassNames.JAVA_LANG_NULL_POINTER_EXCEPTION
);

private static boolean canCatchNpe(LighterAST tree, @Nullable LighterASTNode type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import consulo.annotation.access.RequiredReadAction;
import consulo.application.util.registry.Registry;
import consulo.java.analysis.impl.localize.JavaInspectionsLocalize;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.editor.inspection.*;
import consulo.language.editor.inspection.localize.InspectionLocalize;
import consulo.language.psi.PsiElement;
Expand All @@ -38,10 +37,9 @@
import consulo.util.lang.ObjectUtil;
import consulo.util.lang.StringUtil;
import consulo.virtualFileSystem.VirtualFile;
import org.jetbrains.annotations.Contract;

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

import java.util.*;

Expand Down Expand Up @@ -175,7 +173,7 @@ private boolean hasStringConstructor(PsiClass aClass) {
for (PsiMethod method : aClass.getConstructors()) {
PsiParameterList list = method.getParameterList();
if (list.getParametersCount() == 1 &&
list.getParameters()[0].getType().equalsToText(JavaClassNames.JAVA_LANG_STRING)) {
list.getParameters()[0].getType().equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
return true;
}
}
Expand Down Expand Up @@ -329,8 +327,8 @@ private boolean isNullableNotNullCollectionConflict(
}

for (int i = 0; i <= 1; i++) {
PsiType expectedArg = PsiUtil.substituteTypeParameter(expectedType, JavaClassNames.JAVA_UTIL_MAP, i, false);
PsiType assignedArg = PsiUtil.substituteTypeParameter(assignedType, JavaClassNames.JAVA_UTIL_MAP, i, false);
PsiType expectedArg = PsiUtil.substituteTypeParameter(expectedType, CommonClassNames.JAVA_UTIL_MAP, i, false);
PsiType assignedArg = PsiUtil.substituteTypeParameter(assignedType, CommonClassNames.JAVA_UTIL_MAP, i, false);
if (isNullityConflict(expectedArg, assignedArg)
|| expectedArg != null && assignedArg != null
&& isNullableNotNullCollectionConflict(expectedArg, assignedArg, visited)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
import com.intellij.java.language.psi.util.MethodSignatureUtil;
import com.intellij.java.language.psi.util.PsiUtil;
import com.siyeh.HardcodedMethodConstants;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.psi.PsiElement;
import consulo.language.psi.scope.GlobalSearchScope;
import consulo.language.psi.util.PsiTreeUtil;
import consulo.util.collection.ArrayUtil;
import org.jetbrains.annotations.NonNls;

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

import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -209,7 +208,7 @@ public static boolean isCallToRegexMethod(PsiMethodCallExpression expression) {
return false;
}
final String className = containingClass.getQualifiedName();
return JavaClassNames.JAVA_LANG_STRING.equals(className) || "java.util.regex.Pattern".equals(className);
return CommonClassNames.JAVA_LANG_STRING.equals(className) || "java.util.regex.Pattern".equals(className);
}

public static boolean isCallDuringObjectConstruction(PsiMethodCallExpression expression) {
Expand Down Expand Up @@ -389,7 +388,7 @@ public static boolean callWithNonConstantString(@Nonnull PsiMethodCallExpression
return false;
}
final PsiType type = argument.getType();
if (type == null || !type.equalsToText(JavaClassNames.JAVA_LANG_STRING)) {
if (type == null || !type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
return false;
}
if (considerStaticFinalConstant && argument instanceof PsiReferenceExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@
import com.intellij.java.language.psi.util.PsiUtil;
import com.siyeh.HardcodedMethodConstants;
import consulo.application.util.query.Query;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.psi.PsiElement;
import consulo.language.util.IncorrectOperationException;
import consulo.project.Project;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -46,13 +45,13 @@ private MethodUtils() {

@Contract("null -> false")
public static boolean isComparatorCompare(@Nullable PsiMethod method) {
return method != null && methodMatches(method, JavaClassNames.JAVA_UTIL_COMPARATOR, PsiType.INT, "compare", null, null);
return method != null && methodMatches(method, CommonClassNames.JAVA_UTIL_COMPARATOR, PsiType.INT, "compare", null, null);
}

@Contract("null -> false")
public static boolean isCompareTo(@Nullable PsiMethod method) {
return method != null && methodMatches(method, null, PsiType.INT, HardcodedMethodConstants.COMPARE_TO, PsiType.NULL) && InheritanceUtil.isInheritor(method.getContainingClass(),
JavaClassNames.JAVA_LANG_COMPARABLE);
CommonClassNames.JAVA_LANG_COMPARABLE);
}

@Contract("null -> false")
Expand All @@ -61,7 +60,7 @@ public static boolean isCompareToIgnoreCase(@Nullable PsiMethod method) {
return false;
}
final PsiClassType stringType = TypeUtils.getStringType(method);
return methodMatches(method, JavaClassNames.JAVA_LANG_STRING, PsiType.INT, "compareToIgnoreCase", stringType);
return methodMatches(method, CommonClassNames.JAVA_LANG_STRING, PsiType.INT, "compareToIgnoreCase", stringType);
}

@Contract("null -> false")
Expand Down Expand Up @@ -98,7 +97,7 @@ public static boolean isEqualsIgnoreCase(@Nullable PsiMethod method) {
return false;
}
final PsiClassType stringType = TypeUtils.getStringType(method);
return methodMatches(method, JavaClassNames.JAVA_LANG_STRING, PsiType.BOOLEAN, HardcodedMethodConstants.EQUALS_IGNORE_CASE, stringType);
return methodMatches(method, CommonClassNames.JAVA_LANG_STRING, PsiType.BOOLEAN, HardcodedMethodConstants.EQUALS_IGNORE_CASE, stringType);
}

/**
Expand Down Expand Up @@ -424,6 +423,6 @@ public static boolean isStringLength(@Nullable PsiMethod method) {
return false;
}
PsiClass aClass = method.getContainingClass();
return aClass != null && JavaClassNames.JAVA_LANG_STRING.equals(aClass.getQualifiedName());
return aClass != null && CommonClassNames.JAVA_LANG_STRING.equals(aClass.getQualifiedName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
package com.siyeh.ig.psiutils;

import com.intellij.java.language.psi.*;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.ast.IElementType;
import consulo.language.psi.PsiElement;
import consulo.language.psi.util.PsiTreeUtil;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.jetbrains.annotations.Contract;

import jakarta.annotation.Nonnull;

import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -488,7 +486,7 @@ public static boolean areParenthesesNeeded(PsiExpression expression, PsiExpressi
if (!parentType.equals(childType)) {
return true;
}
if (childType.equalsToText(JavaClassNames.JAVA_LANG_STRING) && !PsiTreeUtil.isAncestor(parentPolyadicExpression.getOperands()[0], childPolyadicExpression, true)) {
if (childType.equalsToText(CommonClassNames.JAVA_LANG_STRING) && !PsiTreeUtil.isAncestor(parentPolyadicExpression.getOperands()[0], childPolyadicExpression, true)) {
final PsiExpression[] operands = childPolyadicExpression.getOperands();
for (PsiExpression operand : operands) {
if (!childType.equals(operand.getType())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.intellij.java.debugger.impl.ui.tree.render.*;
import com.intellij.java.debugger.localize.JavaDebuggerLocalize;
import com.intellij.java.language.impl.JavaFileType;
import com.intellij.java.language.psi.CommonClassNames;
import consulo.annotation.component.ComponentScope;
import consulo.annotation.component.ServiceAPI;
import consulo.annotation.component.ServiceImpl;
Expand All @@ -42,7 +43,6 @@
import consulo.disposer.Disposable;
import consulo.ide.ServiceManager;
import consulo.internal.com.sun.jdi.Value;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.psi.PsiElement;
import consulo.language.util.IncorrectOperationException;
import consulo.localize.LocalizeValue;
Expand Down Expand Up @@ -86,7 +86,7 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
private final NodeRenderer[] myAlternateCollectionRenderers = new NodeRenderer[]{
createCompoundReferenceRenderer(
"Map",
JavaClassNames.JAVA_UTIL_MAP,
CommonClassNames.JAVA_UTIL_MAP,
createLabelRenderer(" size = ", "size()", null),
createExpressionChildrenRenderer(
"entrySet().toArray()",
Expand All @@ -111,7 +111,7 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
new ListObjectRenderer(this),
createCompoundReferenceRenderer(
"Collection",
JavaClassNames.JAVA_UTIL_COLLECTION,
CommonClassNames.JAVA_UTIL_COLLECTION,
createLabelRenderer(" size = ", "size()", null),
createExpressionChildrenRenderer("toArray()", "!isEmpty()")
)
Expand Down Expand Up @@ -347,10 +347,10 @@ else if (rendererId.equals(ToStringRenderer.UNIQUE_ID)) {
return myToStringRenderer;
}
else if (rendererId.equals(CompoundNodeRenderer.UNIQUE_ID) || rendererId.equals(REFERENCE_RENDERER)) {
return createCompoundReferenceRenderer("unnamed", JavaClassNames.JAVA_LANG_OBJECT, null, null);
return createCompoundReferenceRenderer("unnamed", CommonClassNames.JAVA_LANG_OBJECT, null, null);
}
else if (rendererId.equals(CompoundTypeRenderer.UNIQUE_ID)) {
return createCompoundTypeRenderer("unnamed", JavaClassNames.JAVA_LANG_OBJECT, null, null);
return createCompoundTypeRenderer("unnamed", CommonClassNames.JAVA_LANG_OBJECT, null, null);
}
return null;
}
Expand Down Expand Up @@ -559,7 +559,7 @@ public ListObjectRenderer(NodeRendererSettings rendererSettings) {
createLabelRenderer(" size = ", "size()", null),
createExpressionChildrenRenderer("toArray()", "!isEmpty()")
);
setClassName(JavaClassNames.JAVA_UTIL_LIST);
setClassName(CommonClassNames.JAVA_UTIL_LIST);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import com.intellij.java.execution.runners.ProcessProxyFactory;
import com.intellij.java.language.impl.projectRoots.ex.JavaSdkUtil;
import com.intellij.java.language.projectRoots.JavaSdkVersion;
import com.intellij.java.language.psi.CommonClassNames;
import consulo.annotation.component.ServiceImpl;
import consulo.container.plugin.PluginManager;
import consulo.java.execution.configurations.OwnJavaParameters;
import consulo.java.language.module.util.JavaClassNames;
import consulo.java.rt.JavaRtClassNames;
import consulo.java.rt.execution.application.AppMainV2Constants;
import consulo.logging.Logger;
Expand Down Expand Up @@ -54,7 +54,7 @@ public ProcessProxy createCommandLineProxy(JavaCommandLine javaCmdLine) throws E
try {
ProcessProxyImpl proxy = new ProcessProxyImpl(StringUtil.getShortName(mainClass));
String port = String.valueOf(proxy.getPortNumber());
String binPath = new File(PluginManager.getPluginPath(JavaClassNames.class), "breakgen").getPath();
String binPath = new File(PluginManager.getPluginPath(CommonClassNames.class), "breakgen").getPath();

if (runtimeJarFile && JavaSdkUtil.isJdkAtLeast(javaParameters.getJdk(), JavaSdkVersion.JDK_1_5)) {
javaParameters.getVMParametersList().add("-javaagent:" + rtJarPath + '=' + port + ':' + binPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
package com.intellij.java.execution.impl.runners;

import com.intellij.java.execution.runners.ProcessProxy;
import com.intellij.java.language.psi.CommonClassNames;
import consulo.container.plugin.PluginManager;
import consulo.java.language.module.util.JavaClassNames;
import consulo.logging.Logger;
import consulo.platform.Platform;
import consulo.process.ProcessHandler;
Expand Down Expand Up @@ -90,7 +90,7 @@ public boolean canSendBreak() {
return false;
}
}
return new File(PluginManager.getPluginPath(JavaClassNames.class), "breakgen/breakgen.dll").exists();
return new File(PluginManager.getPluginPath(CommonClassNames.class), "breakgen/breakgen.dll").exists();
}

synchronized (myLock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.intellij.java.language.psi.*;
import com.intellij.java.language.psi.util.PsiFormatUtil;
import consulo.java.impl.intelliLang.JavaLanguageInjectionSupport;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.inject.advanced.BaseInjection;
import consulo.language.inject.advanced.InjectionPlace;
import consulo.language.inject.advanced.pattern.PatternCompiler;
Expand Down Expand Up @@ -220,10 +219,10 @@ public static boolean isInjectable(@Nullable final PsiType type, final Project p
if (project.isDefault()) {
@NonNls final String text = type.getPresentableText();
if (text == null) return false;
return text.equals(JavaClassNames.JAVA_LANG_STRING) || text.equals("java.lang.String...") || text.equals("java.lang.String[]");
return text.equals(CommonClassNames.JAVA_LANG_STRING) || text.equals("java.lang.String...") || text.equals("java.lang.String[]");
}
else {
return type.equalsToText(JavaClassNames.JAVA_LANG_STRING) || type.equalsToText("java.lang.String...") || type.equalsToText("java.lang.String[]");
return type.equalsToText(CommonClassNames.JAVA_LANG_STRING) || type.equalsToText("java.lang.String...") || type.equalsToText("java.lang.String[]");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.intellij.java.language.jvm.types.JvmType;
import com.intellij.java.language.jvm.types.JvmTypeResolveResult;
import com.intellij.java.language.psi.util.PsiUtil;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.psi.PsiElement;
import consulo.language.psi.scope.GlobalSearchScope;
import consulo.util.collection.ArrayFactory;
Expand Down Expand Up @@ -95,8 +94,8 @@ public boolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof PsiClassType)) {
return obj instanceof PsiCapturedWildcardType &&
((PsiCapturedWildcardType)obj).getLowerBound().equalsToText(JavaClassNames.JAVA_LANG_OBJECT) &&
equalsToText(JavaClassNames.JAVA_LANG_OBJECT);
((PsiCapturedWildcardType)obj).getLowerBound().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) &&
equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
}
PsiClassType otherClassType = (PsiClassType)obj;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.intellij.java.language.psi.*;
import com.intellij.java.language.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.java.language.psi.codeStyle.VariableKind;
import consulo.java.language.module.util.JavaClassNames;
import consulo.language.codeStyle.CodeStyleManager;
import consulo.language.psi.PsiElement;
import consulo.language.util.IncorrectOperationException;
Expand All @@ -29,11 +28,11 @@
import consulo.util.collection.ContainerUtil;
import consulo.util.lang.Comparing;
import consulo.util.lang.StringUtil;
import org.jetbrains.annotations.NonNls;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import kava.beans.Introspector;
import org.jetbrains.annotations.NonNls;

import java.util.*;

/**
Expand Down Expand Up @@ -174,7 +173,7 @@ private static boolean filterMethods(final PsiMethod method) {
return false;
}
final String className = psiClass.getQualifiedName();
return JavaClassNames.JAVA_LANG_OBJECT.equals(className);
return CommonClassNames.JAVA_LANG_OBJECT.equals(className);
}

@Nonnull
Expand Down Expand Up @@ -381,7 +380,7 @@ public static String[] getReadableProperties(@Nonnull PsiClass aClass, boolean i
PsiMethod[] methods = includeSuperClass ? aClass.getAllMethods() : aClass.getMethods();

for (PsiMethod method : methods) {
if (JavaClassNames.JAVA_LANG_OBJECT.equals(method.getContainingClass().getQualifiedName())) {
if (CommonClassNames.JAVA_LANG_OBJECT.equals(method.getContainingClass().getQualifiedName())) {
continue;
}

Expand All @@ -400,7 +399,7 @@ public static String[] getWritableProperties(@Nonnull PsiClass aClass, boolean i
PsiMethod[] methods = includeSuperClass ? aClass.getAllMethods() : aClass.getMethods();

for (PsiMethod method : methods) {
if (JavaClassNames.JAVA_LANG_OBJECT.equals(method.getContainingClass().getQualifiedName())) {
if (CommonClassNames.JAVA_LANG_OBJECT.equals(method.getContainingClass().getQualifiedName())) {
continue;
}

Expand Down
Loading
Loading