diff --git a/Examples/test-suite/java/director_string_runme.java b/Examples/test-suite/java/director_string_runme.java index 00d165f8b..a6ed67100 100644 --- a/Examples/test-suite/java/director_string_runme.java +++ b/Examples/test-suite/java/director_string_runme.java @@ -14,16 +14,21 @@ public class director_string_runme { public static void main(String argv[]) { - director_string_B b = new director_string_B("hello"); - String s; + director_string_A c = new director_string_A("hi"); + for (int i=0; i<3; i++) { + s = c.call_get(i); + if (!s.equals(new Integer(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s); + } + + director_string_B b = new director_string_B("hello"); + s = b.call_get_first(); if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed"); s = b.call_get(0); - if (!s.equals("director_string_B.get")) throw new RuntimeException("get(0) failed"); -// if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed"); + if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed"); } } @@ -36,9 +41,16 @@ class director_string_B extends A { } public String get(int n) { - return "director_string_B.get"; -// recursive call problem (needs fixing) -// return "director_string_B.get: " + super.get(n); + return "director_string_B.get: " + super.get(n); + } +} + +class director_string_A extends A { + public director_string_A(String first) { + super(first); + } + public String get(int n) { + return new Integer(n).toString(); } }