mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
applyGetClassRelation: minor simplification; test for new object (IDEA-CR-50564)
GitOrigin-RevId: 439a327d7276a0d28e3ebc41f01646a828305022
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e77596602d
commit
f9be4584e5
+5
-8
@@ -1124,15 +1124,12 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
DfaPsiType dfaType = myFactory.createDfaType(value);
|
||||
TypeConstraint constraint = TypeConstraint.exact(dfaType);
|
||||
PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(value);
|
||||
if (!negated) {
|
||||
if (psiClass != null && (psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT))) {
|
||||
// getClass() result cannot be an interface or an abstract class
|
||||
return ThreeState.NO;
|
||||
}
|
||||
return ThreeState.fromBoolean(applyFact(qualifier, DfaFactType.TYPE_CONSTRAINT, constraint));
|
||||
}
|
||||
if (psiClass != null && (psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT))) {
|
||||
return ThreeState.YES;
|
||||
// getClass() result cannot be an interface or an abstract class
|
||||
return ThreeState.fromBoolean(negated);
|
||||
}
|
||||
if (!negated) {
|
||||
return ThreeState.fromBoolean(applyFact(qualifier, DfaFactType.TYPE_CONSTRAINT, constraint));
|
||||
}
|
||||
TypeConstraint existingConstraint = getValueFact(qualifier, DfaFactType.TYPE_CONSTRAINT);
|
||||
if (existingConstraint != null && existingConstraint.isExact()) {
|
||||
|
||||
@@ -20,6 +20,11 @@ class GetClass {
|
||||
|
||||
}
|
||||
|
||||
void testNew() {
|
||||
Object x = new HashSet();
|
||||
if (<warning descr="Condition 'x.getClass() == HashSet.class' is always 'true'">x.getClass() == HashSet.class</warning>) {}
|
||||
}
|
||||
|
||||
void testInstanceOfInterop(Object obj) {
|
||||
if (obj instanceof CharSequence) {
|
||||
if (<warning descr="Condition 'obj.getClass() == Integer.class' is always 'false'">obj.getClass() == Integer.class</warning>) {}
|
||||
|
||||
Reference in New Issue
Block a user