mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java7 cast conventions
This commit is contained in:
@@ -470,7 +470,18 @@ public class TypeConversionUtil {
|
||||
|| ltypeRank == BOOL_RANK && rtypeRank == BOOL_RANK;
|
||||
}
|
||||
else {
|
||||
if (isPrimitiveAndNotNull(ltype) || isPrimitiveAndNotNull(rtype)) return false;
|
||||
if (isPrimitiveAndNotNull(ltype)) {
|
||||
if (rtype instanceof PsiClassType && ((PsiClassType)rtype).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_7)) {
|
||||
return areTypesConvertible(ltype, rtype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (isPrimitiveAndNotNull(rtype)) {
|
||||
if (ltype instanceof PsiClassType && ((PsiClassType)ltype).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_7)) {
|
||||
return areTypesConvertible(rtype, ltype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
isApplicable = areTypesConvertible(ltype, rtype) || areTypesConvertible(rtype, ltype);
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
Object o = null;
|
||||
if (o == 1) {}
|
||||
if (1 == o) {}
|
||||
}
|
||||
}
|
||||
+1
@@ -162,4 +162,5 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testMethodReferences() throws Exception { doTest(false, true, false); }
|
||||
public void testUsedMethodsByMethodReferences() throws Exception { doTest(true, true, false); }
|
||||
public void testLambdaExpressions() throws Exception { doTest(false, true, false); }
|
||||
public void testJava7CastConventions() throws Exception { doTest(false, true, false); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user