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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
import java.lang.reflect.*;
2
 
3
interface one
4
{
5
  int n(int N);
6
}
7
 
8
interface two
9
{
10
  int nn(int N);
11
}
12
 
13
interface three
14
{
15
  int nnn(int N);
16
}
17
 
18
class arse implements one, two
19
{
20
  public int n(int N) { return N; }
21
  public int nn(int N) { return N*2; }
22
}
23
 
24
class arsey implements two, one, three
25
{
26
  public int n(int N) { return N*4; }
27
  public int nn(int N) { return N*8; }
28
  public int nnn(int N) { return N*16; }
29
}
30
 
31
public class InvokeInterface extends arse
32
{
33
  int f ()
34
  {
35
        return flunk.nn(1);
36
  }
37
  static two flunk = new arse();
38
  static three flunkey = new arsey();
39
  public static void main(String[] s) throws Throwable
40
  {
41
        Class[] argtypes = {Integer.TYPE};
42
        Method m = two.class.getMethod("nn", argtypes);
43
        Object[] args = {new Integer(1)};
44
        System.out.println(flunk.nn(1));
45
        System.out.println(m.invoke(new arse(), args));
46
        m = arse.class.getMethod("nn", argtypes);
47
        System.out.println(m.invoke(new arse(), args));
48
        m = two.class.getMethod("nn", argtypes);
49
        System.out.println(m.invoke(new arsey(), args));
50
        m = three.class.getMethod("nnn", argtypes);
51
        System.out.println(m.invoke(new arsey(), args));
52
        m = arsey.class.getMethod("nnn", argtypes);
53
        System.out.println(m.invoke(new arsey(), args));
54
  }
55
}

powered by: WebSVN 2.1.0

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