Skip to content
Permalink
Browse files

8236546: Yield with boolean expression and Object target type crashes…

… javac

The whenTrue and whenFalse sets need to be merged for non-boolean expressions.

Reviewed-by: mcimadamore
  • Loading branch information
Jan Lahoda
Jan Lahoda committed Jan 13, 2020
1 parent 6fc159f commit 8e2c1c68f6dcc4f281f9ee29f1c05d60cca4f3ee
@@ -2579,7 +2579,7 @@ void resolveJump() {
recordExit(exit);
return ;
} else {
scan(tree.value);
scanExpr(tree.value);
recordExit(new AssignPendingExit(tree, inits, uninits));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@

/*
* @test
* @bug 8214031 8214114
* @bug 8214031 8214114 8236546
* @summary Verify switch expressions embedded in various statements work properly.
* @compile ExpressionSwitchEmbedding.java
* @run main ExpressionSwitchEmbedding
@@ -321,6 +321,13 @@ yield switch (i) {
throw new IllegalStateException();
}
}
{
String s = "";
Object o = switch (s) { default -> s != null && s == s; };
if (!(Boolean) o) {
throw new IllegalStateException();
}
}
}

private void throwException() {

0 comments on commit 8e2c1c6

Please sign in to comment.