OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [PR29495.java] - Blame information for rev 781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// Test various reflection methods.
2
 
3
import java.lang.annotation.Inherited;
4
import java.lang.reflect.Method;
5
import java.lang.reflect.Field;
6
 
7
public class PR29495
8
{
9
  public class container<T>
10
  {
11
    // This class has a synthetic field...
12
 
13
    public T get(T v) { return v; }
14
  }
15
 
16
  public class concrete extends container<String>
17
  {
18
    // This makes us have a synthetic bridge method.
19
    public String get(String v) { return "hi" + v; }
20
  }
21
 
22
  // varargs method
23
  public static void va(Object... args)
24
  {
25
  }
26
 
27
  public static void check(boolean x, String m)
28
  {
29
    if (! x)
30
      System.out.println("fail: " + m);
31
  }
32
 
33
  public static void main(String[] args) throws Throwable
34
  {
35
    check (Inherited.class.isAnnotation(), "Inherited isAnnotation");
36
 
37
    Method m = PR29495.class.getDeclaredMethod("va", new Class[] { Object[].class });
38
    check (m.isVarArgs(), "va isVarArgs");
39
 
40
    m = concrete.class.getDeclaredMethod("get", new Class[] { Object.class });
41
    check (m.isSynthetic(), "get isSynthetic");
42
    check (m.isBridge(), "get isBridge");
43
 
44
    Field[] fs = container.class.getDeclaredFields();
45
    boolean ok = false;
46
    for (int i = 0; i < fs.length; ++i)
47
      {
48
        if (fs[i].isSynthetic())
49
          {
50
            ok = true;
51
            break;
52
          }
53
      }
54
    check (ok, "container has synthetic field");
55
  }
56
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.