* sr.po: Update.
[official-gcc.git] / libjava / testsuite / libjava.lang / PR29495.java
blob7df00e80d9d6a241c80255db08a6693ed3f59edc
1 // Test various reflection methods.
3 import java.lang.annotation.Inherited;
4 import java.lang.reflect.Method;
5 import java.lang.reflect.Field;
7 public class PR29495
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; }
22 // varargs method
23 public static void va(Object... args)
27 public static void check(boolean x, String m)
29 if (! x)
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();
45 boolean ok = false;
46 for (int i = 0; i < fs.length; ++i)
48 if (fs[i].isSynthetic())
50 ok = true;
51 break;
54 check (ok, "container has synthetic field");