MemberModel: detect possible out of class definitions and suggest to move them into class (IDEA-258839)

GitOrigin-RevId: 7708fdc7b3191bcd0ba46767160c4ec0b5a179da
This commit is contained in:
Artemiy Sartakov
2021-03-01 14:54:40 +07:00
committed by intellij-monorepo-bot
parent 49252c34ab
commit ccc5077467
36 changed files with 735 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
// "Move member into class" "true"
public abstract class beforeAbstractMethodNoClass {
public abstract void doSmth();
}

View File

@@ -0,0 +1,7 @@
// "Move member into class" "true"
public class beforeFieldNoModifiers {
int foo;
}

View File

@@ -0,0 +1,7 @@
// "Move member into class" "true"
public class beforeFieldQualifiedType {
public String foo;
}

View File

@@ -0,0 +1,10 @@
// "Move member into class" "true"
class Pair<T, V> {}
public class beforeFieldWithAnnos {
@NotNull
Pair<String, String> foo;
}

View File

@@ -0,0 +1,9 @@
// "Move member into class" "true"
class Pair<T, V> {}
public class beforeFieldWithTypeParams {
Pair<String, String> foo;
}

View File

@@ -0,0 +1,9 @@
// "Move member into class" "true"
class Pair<T, V> {}
public class beforeFieldWithTypeParamsWithAnnos {
Pair<@NotNull String, String> foo;
}

View File

@@ -0,0 +1,7 @@
// "Move member into class" "true"
public interface beforeMethodNoBodyNoClass {
void foo();
}

View File

@@ -0,0 +1,10 @@
// "Move member into class" "true"
public class beforeMethodNoModifiers {
void test() {
}
}

View File

@@ -0,0 +1,10 @@
// "Move member into class" "true"
public class beforeMethodWithAnnos {
@NotNull
String withQualifiedReturnType() {
}
}

View File

@@ -0,0 +1,10 @@
// "Move member into class" "true"
public class beforeMethodWithQualifiedReturnType {
final String withQualifiedReturnType() {
}
}

View File

@@ -0,0 +1,10 @@
// "Move member into class" "true"
public class beforeMethodWithQualifiedReturnTypeWithAnnos {
@NotNull String withQualifiedReturnType() {
}
}

View File

@@ -0,0 +1,11 @@
// "Move member into class" "true"
class Pair<T, V> {}
public class beforeMethodWithTypeParams {
Pair<String, String> doSmth() {
}
}

View File

@@ -0,0 +1,7 @@
// "Move member into class" "true"
public class beforeNativeMethodNoClass {
native void doSmth();
}

View File

@@ -0,0 +1,3 @@
// "Move member into class" "true"
public abs<caret>tract void doSmth();

View File

@@ -0,0 +1,6 @@
// "Move member into class" "true"
int f<caret>oo;
public class beforeFieldNoModifiers {
}

View File

@@ -0,0 +1,6 @@
// "Move member into class" "true"
public <caret>java.lang.String foo;
public class beforeFieldQualifiedType {
}

View File

@@ -0,0 +1,8 @@
// "Move member into class" "true"
class Pair<T, V> {}
@NotNull Pair<String<caret>, String> foo;
public class beforeFieldWithAnnos {
}

View File

@@ -0,0 +1,8 @@
// "Move member into class" "true"
class Pair<T, V> {}
Pair<String<caret>, String> foo;
public class beforeFieldWithTypeParams {
}

View File

@@ -0,0 +1,8 @@
// "Move member into class" "true"
class Pair<T, V> {}
Pair<@NotNull String<caret>, String> foo;
public class beforeFieldWithTypeParamsWithAnnos {
}

View File

@@ -0,0 +1,3 @@
// "Move member into class" "true"
void foo<caret>();

View File

@@ -0,0 +1,10 @@
// "Move member into class" "true"
void test() {
<caret>
}
public class beforeMethodNoModifiers {
}

View File

@@ -0,0 +1,8 @@
// "Move member into class" "true"
@NotNull String w<caret>ithQualifiedReturnType() {
}
public class beforeMethodWithAnnos {
}

View File

@@ -0,0 +1,9 @@
// "Move member into class" "true"
final ja<caret>va.lang.String withQualifiedReturnType() {
}
public class beforeMethodWithQualifiedReturnType {
}

View File

@@ -0,0 +1,9 @@
// "Move member into class" "true"
ja<caret>va.lang.@NotNull String withQualifiedReturnType() {
}
public class beforeMethodWithQualifiedReturnTypeWithAnnos {
}

View File

@@ -0,0 +1,9 @@
// "Move member into class" "true"
class Pair<T, V> {}
Pair<String, String> doS<caret>mth() {}
public class beforeMethodWithTypeParams {
}

View File

@@ -0,0 +1,3 @@
// "Move member into class" "true"
native void <caret>doSmth();