mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 13:20:53 +07:00
type migration: fix type parameter migration for invalid code EA-100944
This commit is contained in:
@@ -166,6 +166,7 @@ public class RootTypeConversionRule extends TypeConversionRule {
|
||||
}
|
||||
throw new AssertionError(" migrationType: " + migrationType + ", paramId: " + paramId + ", actualParameters: " + Arrays.toString(actualParams));
|
||||
} else {
|
||||
if (paramId >= actualParams.length) return true;
|
||||
return TypeConversionUtil.areTypesAssignmentCompatible(migrationType, actualParams[paramId]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,6 +870,10 @@ public class TypeMigrationTest extends TypeMigrationTestBase {
|
||||
doTestFieldType("migrationField", myJavaFacade.getElementFactory().createTypeFromText("Test<Short>", null));
|
||||
}
|
||||
|
||||
public void testTypeParameterMigrationInInvalidCode() {
|
||||
doTestFieldType("migrationField", myJavaFacade.getElementFactory().createTypeFromText("Test<Short>", null));
|
||||
}
|
||||
|
||||
private void doTestReturnType(final String methodName, final String migrationType) {
|
||||
start(new RulesProvider() {
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Types:
|
||||
PsiField:migrationField : Test<java.lang.Short>
|
||||
PsiMethodCallExpression:migrationField.method() : void
|
||||
PsiReferenceExpression:migrationField : Test<java.lang.Short>
|
||||
|
||||
Conversions:
|
||||
migrationField.method() -> $
|
||||
|
||||
New expression type changes:
|
||||
Fails:
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test<X> {
|
||||
private static Test<Short> migrationField;
|
||||
|
||||
private static void m(Short x1, Short x2) {
|
||||
migrationField.method();
|
||||
}
|
||||
|
||||
void method(X[] xes) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test<X> {
|
||||
private static Test<Number> migrationField;
|
||||
|
||||
private static void m(Short x1, Short x2) {
|
||||
migrationField.method();
|
||||
}
|
||||
|
||||
void method(X[] xes) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user