less isValid checks during java resolve

they're not exactly free, and we now have better ones
This commit is contained in:
peter
2018-11-12 10:41:43 +01:00
parent 8b298d1619
commit 1514583758
5 changed files with 0 additions and 23 deletions
@@ -239,8 +239,6 @@ public class AnnotationUtil {
}
private static boolean isAnnotated(@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN, @Flags int flags, @Nullable Set<? super PsiMember> processed) {
if (!listOwner.isValid()) return false;
PsiModifierList modifierList = listOwner.getModifierList();
if (modifierList == null) return false;
@@ -85,9 +85,6 @@ public class MethodSignatureBackedByPsiMethod extends MethodSignatureBase {
PsiParameter parameter = parameters[i];
PsiType type = parameter.getType();
parameterTypes[i] = isRaw ? TypeConversionUtil.erasure(substitutor.substitute(type)) : type;
if (parameterTypes[i] != null && !parameterTypes[i].isValid()) {
PsiUtil.ensureValidType(parameterTypes[i], "Method " + method + " of " + method.getClass() + "; param " + parameter + " of " + parameter.getClass());
}
}
return new MethodSignatureBackedByPsiMethod(method, substitutor, isRaw, parameterTypes, methodTypeParameters);
@@ -35,9 +35,6 @@ public abstract class MethodSignatureBase implements MethodSignature {
myParameterTypes = PsiType.createArray(parameterTypes.length);
for (int i = 0; i < parameterTypes.length; i++) {
PsiType type = parameterTypes[i];
if (type != null) {
PsiUtil.ensureValidType(type);
}
if (type instanceof PsiEllipsisType) type = ((PsiEllipsisType) type).toArrayType();
myParameterTypes[i] = substitutor.substitute(type);
}
@@ -37,7 +37,6 @@ import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -115,17 +114,6 @@ public class JavaResolveCache {
}
}
if (!type.isValid()) {
if (expr.isValid()) {
PsiJavaCodeReferenceElement refInside = type instanceof PsiClassReferenceType ? ((PsiClassReferenceType)type).getReference() : null;
@NonNls String typeinfo = type + " (" + type.getClass() + ")" + (refInside == null ? "" : "; ref inside: "+refInside + " ("+refInside.getClass()+") valid:"+refInside.isValid());
LOG.error("Type is invalid: " + typeinfo + "; expr: '" + expr + "' (" + expr.getClass() + ") is valid");
}
else {
LOG.error("Expression: '"+expr+"' is invalid, must not be used for getType()");
}
}
return type == TypeConversionUtil.NULL_TYPE ? null : type;
}
@@ -395,9 +395,6 @@ public class PsiReferenceExpressionImpl extends ExpressionPsiElement implements
if (resolve instanceof PsiVariable) {
PsiType type = ((PsiVariable)resolve).getType();
ret = type instanceof PsiEllipsisType ? ((PsiEllipsisType)type).toArrayType() : type;
if (ret != null && !ret.isValid()) {
LOG.error("invalid type of " + resolve + " of class " + resolve.getClass() + ", valid=" + resolve.isValid());
}
if (resolve instanceof PsiField && !((PsiField)resolve).hasModifierProperty(PsiModifier.STATIC)) {
owner = ((PsiField)resolve).getContainingClass();
}