diff options
Diffstat (limited to 'tests/pureJava/conflictingPackageNames')
-rw-r--r-- | tests/pureJava/conflictingPackageNames/Java.java | 14 | ||||
-rw-r--r-- | tests/pureJava/conflictingPackageNames/Main.java | 27 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/pureJava/conflictingPackageNames/Java.java b/tests/pureJava/conflictingPackageNames/Java.java new file mode 100644 index 000000000..77114f170 --- /dev/null +++ b/tests/pureJava/conflictingPackageNames/Java.java @@ -0,0 +1,14 @@ +public class Java { + public String lang() { + throw new RuntimeException("String lang(): shouldn't have been called"); + } + + public static class lang { + public static class String { + public String() { + throw new RuntimeException("new String(): shouldn't have been called"); + } + } + static String String() { return null; } + } +} diff --git a/tests/pureJava/conflictingPackageNames/Main.java b/tests/pureJava/conflictingPackageNames/Main.java new file mode 100644 index 000000000..06eb6763f --- /dev/null +++ b/tests/pureJava/conflictingPackageNames/Main.java @@ -0,0 +1,27 @@ +import org.aspectj.testing.*; + +public class Main { + public static void main(String[] args) { + new Main().go(); + Tester.checkAllEvents(); + } + + public void go() { + + String str0 = new String("String:String"); + java.lang.String str1 = new String("java.lang.String:String"); + String str2 = new java.lang.String("String:java.lang.String"); + java.lang.String str3 = new java.lang.String("String:java.lang.java.lang.String"); + + Tester.checkEqual(str0, "String:String"); + Tester.checkEqual(str1, "java.lang.String:String"); + Tester.checkEqual(str2, "String:java.lang.String"); + Tester.checkEqual(str3, "String:java.lang.java.lang.String"); + + Tester.event("Driver.go"); + } + + static { + Tester.expectEvent("Driver.go"); + } +} |