mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
retrieve type from binary comparisons to detect applicable constants (IDEA-165557)
This commit is contained in:
@@ -78,6 +78,17 @@ abstract class StaticMembersProcessor<T extends PsiMember & PsiDocCommentOwner>
|
||||
return ((PsiAssignmentExpression)parent).getLExpression().getType();
|
||||
}
|
||||
}
|
||||
else if (parent instanceof PsiBinaryExpression && JavaTokenType.EQEQ.equals(((PsiBinaryExpression)parent).getOperationTokenType())) {
|
||||
if (myPlace.equals(PsiUtil.skipParenthesizedExprDown(((PsiBinaryExpression)parent).getROperand()))) {
|
||||
return ((PsiBinaryExpression)parent).getLOperand().getType();
|
||||
}
|
||||
if (myPlace.equals(PsiUtil.skipParenthesizedExprDown(((PsiBinaryExpression)parent).getLOperand()))) {
|
||||
PsiExpression rOperand = ((PsiBinaryExpression)parent).getROperand();
|
||||
if (rOperand != null) {
|
||||
return rOperand.getType();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (parent instanceof PsiReturnStatement) {
|
||||
return PsiTypesUtil.getMethodReturnType(parent);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Import static constant 'foo.B.aaaaaaa'" "true"
|
||||
package foo;
|
||||
|
||||
import static foo.B.aaaaaaa;
|
||||
|
||||
public class X {
|
||||
{
|
||||
if (1 == aaaaaaa);
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
public static Integer aaaaaaa = 1;
|
||||
}
|
||||
class B1 {
|
||||
public static String aaaaaaa = "";
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Import static constant 'foo.B.aaaaaaa'" "true"
|
||||
package foo;
|
||||
|
||||
public class X {
|
||||
{
|
||||
if (1 == <caret>aaaaaaa);
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
public static Integer aaaaaaa = 1;
|
||||
}
|
||||
class B1 {
|
||||
public static String aaaaaaa = "";
|
||||
}
|
||||
Reference in New Issue
Block a user