diff options
Diffstat (limited to 'tests/bugs161/pr102733')
-rw-r--r-- | tests/bugs161/pr102733/C3.java | 6 | ||||
-rw-r--r-- | tests/bugs161/pr102733/Invoker.java | 27 | ||||
-rw-r--r-- | tests/bugs161/pr102733/Invoker3.java | 24 |
3 files changed, 44 insertions, 13 deletions
diff --git a/tests/bugs161/pr102733/C3.java b/tests/bugs161/pr102733/C3.java new file mode 100644 index 000000000..4f8ed164d --- /dev/null +++ b/tests/bugs161/pr102733/C3.java @@ -0,0 +1,6 @@ + +public class C3 { + public static void main(String[] argv) {} + + blahblahpackage pack; +} diff --git a/tests/bugs161/pr102733/Invoker.java b/tests/bugs161/pr102733/Invoker.java index bfa162de5..bc84365cd 100644 --- a/tests/bugs161/pr102733/Invoker.java +++ b/tests/bugs161/pr102733/Invoker.java @@ -1,14 +1,15 @@ -import java.lang.reflect.Method; - public class Invoker { - public static void main(String[] args) throws Throwable { - try { - C.main(null); - } catch (Throwable t) { - boolean failedCorrectly = t.toString().indexOf("Unresolved compilation")!=-1; - if (failedCorrectly) return; - throw t; - } - throw new RuntimeException("Call to main should have failed!"); - } -}
\ No newline at end of file + public static void main(String[] args) throws Throwable { + try { + new C(); + } + catch (Throwable t) { + boolean failedCorrectly = + t.toString().contains("Unresolved compilation problem") && + t.toString().contains("The method main cannot be declared static"); + if (failedCorrectly) + return; + throw new RuntimeException("Constructor call should have failed!", t); + } + } +} diff --git a/tests/bugs161/pr102733/Invoker3.java b/tests/bugs161/pr102733/Invoker3.java new file mode 100644 index 000000000..e7a0d461e --- /dev/null +++ b/tests/bugs161/pr102733/Invoker3.java @@ -0,0 +1,24 @@ +public class Invoker3 { + public static void main(String[] args) throws Throwable { + try { + C3.main(null); + } + catch (Throwable t) { + boolean failedCorrectly = t.toString().indexOf("Unresolved compilation") != -1; + if (failedCorrectly) + return; + throw new RuntimeException("Call to main should have failed!", t); + } + try { + new C3(); + } + catch (Throwable t) { + boolean failedCorrectly = + t.toString().contains("Unresolved compilation problem") && + t.toString().contains("blahblahpackage cannot be resolved to a type"); + if (failedCorrectly) + return; + throw new RuntimeException("Constructor call should have failed!", t); + } + } +} |