[java-decompiler] IDEA-246757 Add type annotation test sources

GitOrigin-RevId: 7a066131ee0893c98074f4e18c89f2cd577be533
This commit is contained in:
Bart van Helvert
2022-01-12 14:23:42 +00:00
committed by intellij-monorepo-bot
parent f5bc2db28a
commit f199980591
19 changed files with 221 additions and 3 deletions
@@ -0,0 +1,9 @@
package typeAnnotations;
public class ArrayNestedTypeAnnotations {
@A Z.Y.X.W[] w1;
Z.@B Y.X.W[] @E [] w2;
Z.Y.@C X.W @F [] @A [] @B [] w3;
Z.Y.X.@D W @D [] w4;
@A Z.@B Y.@C X.@D W[][] w5;
}
@@ -2,10 +2,10 @@ package typeAnnotations;
public class ArrayTypeAnnotations implements ParentInterface {
@A String[] s1 = new String[0];
String @B [] s2 = new String[0];
String @C [][] s3 = new String[0][0];
String [] @D [] s4 = new String[0][0];
@A String[] s5() { return null; }
String @B [] s6() { return null; }
@A String @B [] @C [] @D [] s7() { return null; }
}
@@ -0,0 +1,4 @@
package typeAnnotations;
public interface Bar {
}
@@ -0,0 +1,4 @@
package typeAnnotations;
public interface BarGeneric<T, U> {
}
@@ -0,0 +1,4 @@
package typeAnnotations;
public class ClassSuperTypeAnnotations extends @A Foo implements @B Bar, @B BarGeneric<@F String, @A String @B []> {
}
@@ -0,0 +1,8 @@
package typeAnnotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
public @interface E {
}
@@ -0,0 +1,8 @@
package typeAnnotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
public @interface F {
}
@@ -0,0 +1,4 @@
package typeAnnotations;
public abstract class Foo {
}
@@ -0,0 +1,9 @@
package typeAnnotations;
public class GenericArrayNestedTypeAnnotations {
@A V.U<String>.T<Boolean, Integer, Float> @A [] t1;
V.@B U<String>.T<Boolean, Integer, Float>[] t2;
V.U<String>.@C T<Boolean, Integer, Float> @B [] @D [] t3;
V.U<@D String>.T<Boolean, Integer, Float> @F [] t4;
@B V.@A U<@A String>.@A T<@E Boolean, @F Integer, Float>[] t5;
}
@@ -0,0 +1,30 @@
package typeAnnotations;
import java.util.List;
import java.util.Map;
public class GenericArrayTypeAnnotations {
@A List<Comparable<Object[][][]>> l1;
List<@B Comparable<Object[][][]>> l2;
List<Comparable<@F Object[][][]>> l3;
List<Comparable<Object @C [][][]>> l4;
List<Comparable<Object[] @D [][]>> l5;
List<Comparable<Object[][] @E []>> l6;
@A List<@B Comparable<@F Object @C [] @D [] @E []>> l7;
@A List<@A Comparable<@A Object @A [] @A [] @A []>> l8;
Map<Object @A @B [][], List<@E Map<Object @C [] @D [], @F Object>>> m1;
@B @A Map<@A Object @F [] @E [], @D List<@F @A Map<@B @D Object @A @D [] @D [], @A @B @D Object>>> m2;
@A @B Map<@B Map<@B Map<@B List<@F ? extends @A String @C [] @D [] @E @F []>, @A List<@B ? super @D String @E @A @F [] @F []>>, @A List<@C ?>>, @D List<@A Map<@E Object @F [] @D [], List<@D Object>> @A []> @B [] @C []> @D [] m3;
@A Map<@A Object, @B List<@C Object @D [] @E [] @F []>> m12() {
return null;
}
@A List<@B Object> @E [] @F [] l1() {
return null;
}
@A List<@B Object @C [] @D []> @E [] @F [] l2() {
return null;
}
}
@@ -0,0 +1,9 @@
package typeAnnotations;
public class GenericNestedTypeAnnotations {
@A V.U<String>.T<Boolean, Integer, Float> t1;
V.@B U<String>.T<Boolean, Integer, Float> t2;
V.U<String>.@C T<Boolean, Integer, Float> t3;
V.U<@D String>.T<Boolean, Integer, Float> t4;
V.U<String>.T<@E Boolean, @F Integer, Float> t5;
}
@@ -0,0 +1,20 @@
package typeAnnotations;
import java.util.List;
import java.util.Map;
public class GenericTypeAnnotations {
@A Map<? extends String, List<Object>> m1;
Map<@B ? extends String, List<Object>> m2;
Map<? extends @C String, List<Object>> m3;
Map<? extends String, @D List<Object>> m4;
Map<? extends String, List<@E Object>> m5;
@A @B Map<? extends String, List<Object>> m6;
Map<@A @B ? extends String, List<Object>> m7;
Map<? extends @C @D String, List<Object>> m8;
Map<? extends String, @D @E List<Object>> m9;
Map<? extends String, List<@E @F Object>> m10;
@A Map<@B ? extends @C String, @D List<@E Object>> m11;
@A Map<@A Object, @B List<@C Object>> m12() { return null; }
@A @B List<@C Object> l1() { return null; }
}
@@ -0,0 +1,4 @@
package typeAnnotations;
public interface InterfaceSuperTypeAnnotations extends @B Bar, @B BarGeneric<@F String, @A String @B []> {
}
@@ -0,0 +1,4 @@
package typeAnnotations;
public @interface K {
}
@@ -0,0 +1,53 @@
package typeAnnotations;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import java.util.function.BiFunction;
public class LocalTypeAnnotations {
// void simple() {
// @A String hello = "Hello";
// @B String space = " ";
// @C String world = "World";
// }
//
// void instanceOf() {
// boolean isobj = "Hello world!" instanceof @B Object;
// }
//
// void newArray() {
// @A String @B [] hw = new @C String @D [0];
// }
//
// void methodRef() {
// BiFunction<String, Integer, Character> stringIntegerCharacterBiFunction = @C String::charAt;
// }
//
// void typeArg() {
// BiFunction<@D String, @E Integer, @F Character> stringIntegerCharacterBiFunction = String::charAt;
// }
//
// void tryWithResources() {
// try (@A BufferedReader br = new @B BufferedReader(new @C FileReader("test"))) {
// } catch (@A FileNotFoundException e) {
// e.printStackTrace();
// } catch (@B IOException e) {
// e.printStackTrace();
// }
// }
void combined() {
@A String hello = "Hello!";
boolean isobj = hello instanceof @B Object;
@C String world = " World!";
BiFunction<String, Integer, Character> stringIntegerCharacterBiFunction = @D String::charAt;
try (BufferedReader br = new BufferedReader(new FileReader("test"))) {
} catch (@E IOException e) {
e.printStackTrace();
}
@F String test = " Test!";
}
}
@@ -0,0 +1,22 @@
package typeAnnotations;
import java.io.IOException;
import java.io.Serializable;
public class MemberDeclarationTypeAnnotations<@A P extends @B Number & @F Serializable> {
@B int f1 = 0;
@K
public @A MemberDeclarationTypeAnnotations() {
}
@K
public <@A T extends @B Number & @F Serializable> @C Number foo(@D T @E [] a) {
return 0;
}
@K
public <T> @C Number bar(@D T @E [] a) throws @A IOException, @B IllegalStateException {
return 0;
}
}
@@ -0,0 +1,9 @@
package typeAnnotations;
public class NestedTypeAnnotations {
@A Z.Y.X.W w1;
Z.@B Y.X.W w2;
Z.Y.@C X.W w3;
Z.Y.X.@D W w4;
@A Z.@B Y.@C X.@D W w5;
}
@@ -0,0 +1,7 @@
package typeAnnotations;
class V {
class U<J> {
class T<K, L, M> {}
}
}
@@ -0,0 +1,10 @@
package typeAnnotations;
public class Z {
class Y {
class X {
class W {
}
}
}
}