RFR: 8264696: Multi-catch clause causes compiler exception because it uses the package-private supertype
Vicente Romero
vromero at openjdk.java.net
Thu Apr 8 02:46:17 UTC 2021
On Wed, 7 Apr 2021 12:26:34 GMT, Guoxiong Li <github.com+13688759+lgxbslgx at openjdk.org> wrote:
> Hi all,
>
> The method `isAccessible(Env<AttrContext> env, Type t, boolean checkInner)` should take `UnionClassType` as a special type to do some corresponding work. If not, the problem will occur. This patch fixes it and adds a test case.
>
> Thank you for taking the time to review.
>
> Best Regards.
> -- Guoxiong
Changes requested by vromero (Reviewer).
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java line 390:
> 388: if (t.hasTag(ARRAY)) {
> 389: return isAccessible(env, types.cvarUpperBound(types.elemtype(t)));
> 390: } else if (!t.isUnion()) {
I would change the code a bit, like in:
} else if (t.isUnion()) {
return StreamSupport.stream(((UnionClassType) t).getAlternativeTypes().spliterator(), false)
.allMatch(alternative -> isAccessible(env, alternative.tsym, checkInner));
} else {
return isAccessible(env, t.tsym, checkInner);
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/3374
More information about the compiler-dev
mailing list