mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
access static via instance: ensure type params are attached to the class reference (IDEA-139440)
This commit is contained in:
+5
-3
@@ -97,9 +97,11 @@ public class AccessStaticViaInstanceFix extends LocalQuickFixAndIntentionActionO
|
||||
if (!checkSideEffects(project, containingClass, qualifierExpression, factory, myExpression,editor)) return;
|
||||
PsiElement newQualifier = qualifierExpression.replace(factory.createReferenceExpression(containingClass));
|
||||
PsiElement qualifiedWithClassName = myExpression.copy();
|
||||
newQualifier.delete();
|
||||
if (myExpression.resolve() != myMember) {
|
||||
myExpression.replace(qualifiedWithClassName);
|
||||
if (myExpression.getTypeParameters().length == 0) {
|
||||
newQualifier.delete();
|
||||
if (myExpression.resolve() != myMember) {
|
||||
myExpression.replace(qualifiedWithClassName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// "Access static 'Bug.right(B)' via class 'Bug' reference" "true"
|
||||
|
||||
class Bug<A, B> {
|
||||
public A getLeft() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public B getRight() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isRight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static <A, B> Bug<A, B> left(A a) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <A, B> Bug<A, B> right(B b) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Bug<A, B> foo() {
|
||||
return isRight() ? Bug.<A, B>right(getRight()) : this.<A,B>left(getLeft());
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// "Access static 'Bug.right(B)' via class 'Bug' reference" "true"
|
||||
|
||||
class Bug<A, B> {
|
||||
public A getLeft() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public B getRight() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isRight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static <A, B> Bug<A, B> left(A a) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <A, B> Bug<A, B> right(B b) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Bug<A, B> foo() {
|
||||
return isRight() ? this.<A, B><caret>right(getRight()) : this.<A,B>left(getLeft());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user