mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
Java: Don't handle annotations in the inspection "Non-accessible type is exposed" (IDEA-162768)
This commit is contained in:
-80
@@ -264,86 +264,6 @@ public class Highlighted {
|
||||
""")
|
||||
}
|
||||
|
||||
fun testPublicAnnotation() {
|
||||
add("apiPkg", "MyAnnotation", "public @interface MyAnnotation {}")
|
||||
highlight("""package apiPkg;
|
||||
@MyAnnotation
|
||||
public class Highlighted {
|
||||
@MyAnnotation public PublicApi field;
|
||||
@MyAnnotation public Highlighted() {}
|
||||
public Highlighted(@MyAnnotation PublicApi s) {field=s;}
|
||||
@MyAnnotation protected void init() {}
|
||||
protected @MyAnnotation PublicApi peek() {return field;}
|
||||
public void set(@MyAnnotation PublicApi s) {field=s;}
|
||||
}
|
||||
""")
|
||||
}
|
||||
|
||||
fun testPackageLocalAnnotation() {
|
||||
add("apiPkg", "MyAnnotation", "@interface MyAnnotation {}")
|
||||
highlight("""package apiPkg;
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning>
|
||||
public class Highlighted {
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning> public PublicApi field;
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning> public Highlighted() {}
|
||||
public Highlighted(@<warning descr="The class is not exported from the module">MyAnnotation</warning> PublicApi s) {field=s;}
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning> protected void init() {}
|
||||
protected @<warning descr="The class is not exported from the module">MyAnnotation</warning> PublicApi peek() {return field;}
|
||||
public void set(@<warning descr="The class is not exported from the module">MyAnnotation</warning> PublicApi s) {field=s;}
|
||||
}
|
||||
""")
|
||||
}
|
||||
|
||||
fun testNotExportedAnnotation() {
|
||||
add("implPkg", "MyAnnotation", "public @interface MyAnnotation {}")
|
||||
highlight("""package apiPkg;
|
||||
import implPkg.MyAnnotation;
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning>
|
||||
public class Highlighted {
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning> public PublicApi field;
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning> public Highlighted() {}
|
||||
public Highlighted(@<warning descr="The class is not exported from the module">MyAnnotation</warning> PublicApi s) {field=s;}
|
||||
@<warning descr="The class is not exported from the module">MyAnnotation</warning> protected void init() {}
|
||||
protected @<warning descr="The class is not exported from the module">MyAnnotation</warning> PublicApi peek() {return field;}
|
||||
public void set(@<warning descr="The class is not exported from the module">MyAnnotation</warning> PublicApi s) {field=s;}
|
||||
}
|
||||
""")
|
||||
}
|
||||
|
||||
fun testTypeParameterAndUseAnnotation() {
|
||||
highlight("""package apiPkg;
|
||||
import java.lang.annotation.*;
|
||||
import java.util.*;
|
||||
@Highlighted.PublicAnnotation
|
||||
@<warning descr="The class is not exported from the module">Highlighted.PackageLocalAnnotation</warning>
|
||||
public class Highlighted {
|
||||
@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) public @interface PublicAnnotation {}
|
||||
@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) @interface PackageLocalAnnotation {}
|
||||
|
||||
public class C1<@PublicAnnotation T> {
|
||||
public List<@PublicAnnotation String> text;
|
||||
public void foo(Set<@PublicAnnotation String> s) {}
|
||||
protected <@PublicAnnotation X> void bar(X x) {}
|
||||
protected Set<@PublicAnnotation T> baz() {return new HashSet<@PublicAnnotation T>();}
|
||||
public List<@PublicAnnotation String> text() {return new ArrayList<@PublicAnnotation String>();}
|
||||
}
|
||||
public class C2<@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> T> {
|
||||
public List<@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> String> text;
|
||||
public void foo(Set<@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> String> s) {}
|
||||
protected <@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> X> void bar(X x) {}
|
||||
protected Set<@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> T> baz() {
|
||||
return new HashSet<@PackageLocalAnnotation T>();
|
||||
}
|
||||
public List<@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> String> text() {
|
||||
return new ArrayList<@PackageLocalAnnotation String>();
|
||||
}
|
||||
}
|
||||
public interface I1 extends List<@PublicAnnotation Highlighted> {}
|
||||
public interface I2 extends List<@<warning descr="The class is not exported from the module">PackageLocalAnnotation</warning> Highlighted> {}
|
||||
}
|
||||
""")
|
||||
}
|
||||
|
||||
fun testGenericPublic() {
|
||||
add("apiPkg", "MyInterface", "public interface MyInterface {}")
|
||||
add("apiPkg", "MyClass", "public class MyClass implements MyInterface {}")
|
||||
|
||||
Reference in New Issue
Block a user