jdk/test/com/sun/jdi/RefTypes.java
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 2 90ce3da70b43
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/* /nodynamiccopyright/ hard coded linenumbers in other tests - DO NOT CHANGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Debuggee which exercises various reference types
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
abstract class AllAbstract {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
    abstract void a();
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
    abstract void b();
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
    abstract void c();
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
class AllNative {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
    native void a();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
    native void b();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
    native void c();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
abstract class Abstract {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
    abstract void a();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
    void b() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
        int x = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
        int y = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
        System.out.println("x + y = " + x + y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
class Native {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
    native void a();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
    void b() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
        int x = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
        int y = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
        System.out.println("x + y = " + x + y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
abstract class AbstractAndNative {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    abstract void a();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    native void b();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    void c() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        int x = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
        int y = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        System.out.println("x + y = " + x + y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
interface Interface {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    void a();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    void b();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    void c();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
interface InterfaceWithCode {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    String foo = new String("foo");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
public class RefTypes {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    static void loadClasses() throws ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        Class.forName("AllAbstract");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        Class.forName("AllNative");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        Class.forName("Abstract");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        Class.forName("Native");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        Class.forName("AbstractAndNative");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        Class.forName("Interface");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        Class.forName("InterfaceWithCode");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public static void main(String args[]) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        loadClasses();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
}