1 // Test various reflection methods.
3 import java
.lang
.annotation
.Inherited
;
4 import java
.lang
.reflect
.Method
;
5 import java
.lang
.reflect
.Field
;
9 public class container
<T
>
11 // This class has a synthetic field...
13 public T
get(T v
) { return v
; }
16 public class concrete
extends container
<String
>
18 // This makes us have a synthetic bridge method.
19 public String
get(String v
) { return "hi" + v
; }
23 public static void va(Object
... args
)
27 public static void check(boolean x
, String m
)
30 System
.out
.println("fail: " + m
);
33 public static void main(String
[] args
) throws Throwable
35 check (Inherited
.class.isAnnotation(), "Inherited isAnnotation");
37 Method m
= PR29495
.class.getDeclaredMethod("va", new Class
[] { Object
[].class });
38 check (m
.isVarArgs(), "va isVarArgs");
40 m
= concrete
.class.getDeclaredMethod("get", new Class
[] { Object
.class });
41 check (m
.isSynthetic(), "get isSynthetic");
42 check (m
.isBridge(), "get isBridge");
44 Field
[] fs
= container
.class.getDeclaredFields();
46 for (int i
= 0; i
< fs
.length
; ++i
)
48 if (fs
[i
].isSynthetic())
54 check (ok
, "container has synthetic field");