mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-04 20:30:42 +07:00
[java-inspections] ReflectionForUnavailableAnnotation: provide fix if the @Retention annotation is presented
(IJ-CR-14614) GitOrigin-RevId: 39fe3f01bb989cfee948773cfabc748fbd0eeebd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
06369b2c81
commit
48d2830934
@@ -0,0 +1,17 @@
|
||||
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true"
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@interface Test {
|
||||
}
|
||||
|
||||
class Main {
|
||||
private static boolean hasTestAnnotation(Method method) {
|
||||
return method.getAnnotation(Test.class) != null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Annotate annotation 'Test' as @Retention" "true"
|
||||
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true"
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Annotate annotation 'Test' as @Retention" "false"
|
||||
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true"
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Annotate annotation 'NotNull' as @Retention" "false"
|
||||
// "Annotate annotation 'NotNull' as @Retention(RetentionPolicy.RUNTIME)" "false"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Annotate annotation 'Test' as @Retention" "true"
|
||||
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true"
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Annotate annotation 'Subst' as @Retention" "false"
|
||||
// "Annotate annotation 'Subst' as @Retention(RetentionPolicy.RUNTIME)" "false"
|
||||
import org.intellij.lang.annotations.Subst;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
Reference in New Issue
Block a user