[llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/VTable.java

Alkis Evlogimenos alkis at cs.uiuc.edu
Wed Sep 15 13:27:30 PDT 2004



Changes in directory llvm-java/test/Programs/SingleSource/UnitTests:

VTable.java updated: 1.2 -> 1.3
---
Log message:

Modify test to include dynamic dispatch through an interface vtable.


---
Diffs of the changes:  (+14 -4)

Index: llvm-java/test/Programs/SingleSource/UnitTests/VTable.java
diff -u llvm-java/test/Programs/SingleSource/UnitTests/VTable.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/VTable.java:1.3
--- llvm-java/test/Programs/SingleSource/UnitTests/VTable.java:1.2	Wed Sep 15 15:16:12 2004
+++ llvm-java/test/Programs/SingleSource/UnitTests/VTable.java	Wed Sep 15 15:27:20 2004
@@ -1,12 +1,18 @@
 class VTableBase
 {
-    int foo() { return 0; }
-    int bar() { return 0; }
+    public int foo() { return 0; }
+    public int bar() { return 0; }
 }
 
-public class VTable extends VTableBase
+interface VTableInterface
 {
-    int foo() { return 1; }
+    public int baz();
+}
+
+public class VTable extends VTableBase implements VTableInterface
+{
+    public int foo() { return 1; }
+    public int baz() { return 2; }
 
     public static void main(String[] args) {
         VTableBase a = new VTableBase();
@@ -16,5 +22,9 @@
         a = new VTable();
         a.foo();
         a.bar();
+        ((VTableInterface)a).baz();
+
+        VTableInterface i = new VTable();
+        i.baz();
     }
 }






More information about the llvm-commits mailing list