Skip to content

Commit

Permalink
Reproduce issue #188 "Some expressions are failing without explicit c…
Browse files Browse the repository at this point in the history
…ast of null".
  • Loading branch information
aunkrig committed Nov 2, 2022
1 parent a41e7a4 commit 2b56972
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1634,4 +1634,29 @@ interface Nukable {
+ "}\n"
);
}

@Test public void
testIssue187() throws Exception {
this.assertCompilationUnitMainReturnsTrue((
""
+ "public class MyClass {\n"
+ " public static boolean main() {\n"
+ " boolean b;\n"
+ " if (false) {\n"
+ " b = true;\n"
+ " } else {\n"
+ " b = false;\n"
+ " }\n"
+ " return !b;\n"
+ " }\n"
+ "}"
), "MyClass");
}

@Test public void
testIssue188() throws Exception {
this.assertScriptExecutable("Object o = true ? (String) null : \"\";");
this.assertScriptExecutable("Object o = true ? (Object) null : \"\";");
this.assertScriptExecutable("Object o = true ? null : \"\";"); // <= InternalCompilerException
}
}

0 comments on commit 2b56972

Please sign in to comment.