mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: create class from usage: fix for patterns expression (IDEA-253733)
GitOrigin-RevId: e135c45026fc852ace913a57689380c5175f766e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0e32179fc8
commit
dc51016e34
+3
-2
@@ -65,10 +65,11 @@ public abstract class CreateClassFromUsageBaseFix extends BaseIntentionAction {
|
||||
parent.getParent() instanceof PsiVariable ||
|
||||
parent.getParent() instanceof PsiMethod ||
|
||||
parent.getParent() instanceof PsiClassObjectAccessExpression ||
|
||||
parent.getParent() instanceof PsiTypeCastExpression ||
|
||||
(parent.getParent() instanceof PsiInstanceOfExpression && ((PsiInstanceOfExpression)parent.getParent()).getCheckType() == parent)) {
|
||||
parent.getParent() instanceof PsiTypeCastExpression) {
|
||||
return true;
|
||||
}
|
||||
PsiInstanceOfExpression instanceOfExpression = PsiTreeUtil.getParentOfType(parent, PsiInstanceOfExpression.class);
|
||||
if (instanceOfExpression != null && instanceOfExpression.getCheckType() == parent) return true;
|
||||
}
|
||||
else if (parent instanceof PsiReferenceList) {
|
||||
if (myKind == CreateClassKind.ENUM || myKind == CreateClassKind.RECORD) return false;
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create inner class 'Foo'" "true"
|
||||
public class Test {
|
||||
boolean foo(Object o) {
|
||||
return o instanceof Foo;
|
||||
}
|
||||
|
||||
private class Foo {
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create inner class 'Foo'" "true"
|
||||
public class Test {
|
||||
boolean foo(Object o) {
|
||||
return o instanceof F<caret>oo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user