mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
type migration: to void: remove unused variables in simple cases IDEA-158196
This commit is contained in:
@@ -846,6 +846,22 @@ public class TypeMigrationTest extends TypeMigrationTestBase {
|
||||
doTestFieldsType("Test", myFactory.createTypeFromText(CommonClassNames.JAVA_LANG_OBJECT, null), "a", "b");
|
||||
}
|
||||
|
||||
public void testVoidMigrationInVarDecl() {
|
||||
doTestMethodType("migrationMethod", PsiType.VOID);
|
||||
}
|
||||
|
||||
public void testVoidMigrationInVarDeclFailed() {
|
||||
doTestMethodType("migrationMethod", PsiType.VOID);
|
||||
}
|
||||
|
||||
public void testVoidMigrationInAssignment() {
|
||||
doTestMethodType("migrationMethod", PsiType.VOID);
|
||||
}
|
||||
|
||||
public void testVoidMigrationInAssignmentFailed() {
|
||||
doTestMethodType("migrationMethod", PsiType.VOID);
|
||||
}
|
||||
|
||||
private void doTestReturnType(final String methodName, final String migrationType) {
|
||||
start(new RulesProvider() {
|
||||
@Override
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
Types:
|
||||
PsiMethod:migrationMethod : void
|
||||
PsiMethodCallExpression:migrationMethod() : void
|
||||
|
||||
Conversions:
|
||||
"" -> $
|
||||
migrationMethod() -> $
|
||||
|
||||
New expression type changes:
|
||||
Fails:
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
|
||||
static void migrationMethod() {
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss;
|
||||
migrationMethod();
|
||||
sss = "";
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
|
||||
static String migrationMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss;
|
||||
sss = migrationMethod();
|
||||
sss = "";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
Types:
|
||||
PsiMethod:migrationMethod : void
|
||||
PsiMethodCallExpression:migrationMethod() : void
|
||||
|
||||
Conversions:
|
||||
"" -> $
|
||||
|
||||
New expression type changes:
|
||||
Fails:
|
||||
migrationMethod()->void
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
|
||||
static void migrationMethod() {
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss;
|
||||
sss = migrationMethod();
|
||||
System.out.println(sss);
|
||||
sss = "";
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
|
||||
static String migrationMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss;
|
||||
sss = migrationMethod();
|
||||
System.out.println(sss);
|
||||
sss = "";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
Types:
|
||||
PsiMethod:migrationMethod : void
|
||||
PsiMethodCallExpression:migrationMethod() : void
|
||||
|
||||
Conversions:
|
||||
"" -> $
|
||||
migrationMethod() -> $
|
||||
|
||||
New expression type changes:
|
||||
Fails:
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
|
||||
static void migrationMethod() {
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss;
|
||||
migrationMethod();
|
||||
sss = "";
|
||||
System.out.println(sss);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
|
||||
static String migrationMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss = migrationMethod();
|
||||
sss = "";
|
||||
System.out.println(sss);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
Types:
|
||||
PsiMethod:migrationMethod : void
|
||||
PsiMethodCallExpression:migrationMethod() : void
|
||||
|
||||
Conversions:
|
||||
"" -> $
|
||||
|
||||
New expression type changes:
|
||||
Fails:
|
||||
migrationMethod()->void
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
|
||||
static void migrationMethod() {
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss = migrationMethod();
|
||||
System.out.println(sss);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
|
||||
static String migrationMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void m() {
|
||||
String sss = migrationMethod();
|
||||
System.out.println(sss);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user