mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not fail on int,byte -> atomic long type migration
This commit is contained in:
+4
-4
@@ -40,15 +40,15 @@ public class AtomicConversionRule extends TypeConversionRule {
|
||||
}
|
||||
|
||||
private static boolean isAtomicTypeMigration(PsiType from, PsiClassType to, PsiExpression context) {
|
||||
if (PsiType.INT.equals(from) && to.getCanonicalText().equals(AtomicInteger.class.getName())) {
|
||||
if (PsiType.INT.isAssignableFrom(from) && to.getCanonicalText().equals(AtomicInteger.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
if (PsiType.LONG.isAssignableFrom(from) && to.getCanonicalText().equals(AtomicLong.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
if (from.equals(PsiType.INT.createArrayType()) && to.getCanonicalText().equals(AtomicIntegerArray.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
if (PsiType.LONG.equals(from) && to.getCanonicalText().equals(AtomicLong.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
if (from.equals(PsiType.LONG.createArrayType()) && to.getCanonicalText().equals(AtomicLongArray.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,4 +100,8 @@ public class TypeMigrationByAtomicRuleTest extends TypeMigrationTestBase{
|
||||
public void testChainedInitialization() {
|
||||
doTestFieldType("a", myJavaFacade.getElementFactory().createTypeFromText("java.util.concurrent.atomic.AtomicInteger", null));
|
||||
}
|
||||
|
||||
public void testLiteralMigration() {
|
||||
doTestFieldType("a", myJavaFacade.getElementFactory().createTypeFromText("java.util.concurrent.atomic.AtomicLong", null));
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Types:
|
||||
PsiField:a : java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
Conversions:
|
||||
100 -> new java.util.concurrent.atomic.AtomicLong($val$) $val$ 100
|
||||
|
||||
New expression type changes:
|
||||
Fails:
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
class Test {
|
||||
AtomicLong a = new AtomicLong(100);
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class Test {
|
||||
long a = 100;
|
||||
}
|
||||
Reference in New Issue
Block a user