[analysis] IDEA-241656 Provide a fix for "static member qualifying type may not be annotated"

This patch fixes notes from the code review, it includes:

1. moving MoveAnnotationOnStaticMemberQualifyingTypeFix to top level
2. reusing MoveAnnotationOnStaticMemberQualifyingTypeFix#getFamilyName in MoveAnnotationOnStaticMemberQualifyingTypeFix#getName
3. using PsiTreeUtil#findSiblingBackwards to find the rightmost dot token instead of custom code
4. removing redundant test data

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: a539ed96c3883947b621525fc4bd017eefd7b458
This commit is contained in:
Nikita Eshkeev
2020-06-08 15:31:57 +03:00
committed by intellij-monorepo-bot
parent 73835fbb74
commit d7ceab7d2d
26 changed files with 78 additions and 438 deletions
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data { }
static {
final /*1 */ /*2*/ /*5 *//*6 */ synchronized transient Main.@/* 3 */ /* 4*/ Meta Data var = null;
}
}
@@ -1,12 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data { }
void func(final /*1 */ /*2*/ /*5 *//*6 */ synchronized transient Main.@/* 3 */ /* 4*/ Meta Data var) { }
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
static {
final /*1 */ /*2*//*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.@/* 3 */ /* 4*/ First Data var = null;
}
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
static {
final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ /*5 *//*6 */ synchronized transient Main.@/*two*/Second Data var = null;
}
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
void func(final /*1 */ /*2*//*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.@/* 3 */ /* 4*/ First Data var) { }
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
void func(final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ /*5 *//*6 */ synchronized transient Main.@/*two*/Second Data var) { }
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data {
public static class Nested { }
}
static {
final /*1 */ /*2*/ /*5 *//*6 */ synchronized transient Main.Data.@/* 3 */ /* 4*/ Meta Nested var = null;
}
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data {
public static class Nested { }
}
void func(final /*1 */ /*2*/ /*5 *//*6 */ synchronized transient Main.Data.@/* 3 */ /* 4*/ Meta Nested var) { }
}
@@ -1,18 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
static {
final /*1 */ /*2*//*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.Data.@/* 3 */ /* 4*/ First Nested var = null;
}
}
@@ -1,18 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
static {
final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ /*5 *//*6 */ synchronized transient Main.Data.@/*two*/Second Nested var = null;
}
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
void func(final /*1 */ /*2*//*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.Data.@/* 3 */ /* 4*/ First Nested var) { }
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
void func(final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ /*5 *//*6 */ synchronized transient Main.Data.@/*two*/Second Nested var) { }
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data { }
static {
final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ Meta /*5 *//*6 */ synchronized transient Main.Data var = null;
}
}
@@ -1,12 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data { }
void func(final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ Meta /*5 *//*6 */ synchronized transient Main.Data var) { }
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
static {
final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ First/*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.Data var = null;
}
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
static {
final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ @/*two*/<caret>Second /*5 *//*6 */ synchronized transient Main.Data var = null;
}
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
void func(final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ First/*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.Data var) { }
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data { }
void func(final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ @/*two*/<caret>Second /*5 *//*6 */ synchronized transient Main.Data var) { }
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data {
public static class Nested { }
}
static {
final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ Meta /*5 *//*6 */ synchronized transient Main.Data.Nested var = null;
}
}
@@ -1,14 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Meta { }
class Main {
public static class Data {
public static class Nested { }
}
void func(final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ Meta /*5 *//*6 */ synchronized transient Main.Data.Nested var) { }
}
@@ -1,18 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
static {
final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ First/*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.Data.Nested var = null;
}
}
@@ -1,18 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
static {
final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ @/*two*/<caret>Second /*5 *//*6 */ synchronized transient Main.Data.Nested var = null;
}
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
void func(final /*1 */ /*2*/@<caret>/* 3 */ /* 4*/ First/*one*/ @/*two*/Second /*5 *//*6 */ synchronized transient Main.Data.Nested var) { }
}
@@ -1,16 +0,0 @@
// "Move type annotation" "true"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface First { }
@Target(ElementType.TYPE_USE)
@interface Second { }
class Main {
public static class Data {
public static class Nested { }
}
void func(final /*1 */ /*2*/@/* 3 */ /* 4*/ First/*one*/ @/*two*/<caret>Second /*5 *//*6 */ synchronized transient Main.Data.Nested var) { }
}