RFR: 8361499: Intersection type cast causes javac crash with -Xjcov
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Jul 9 10:32:39 UTC 2025
On Tue, 8 Jul 2025 21:08:27 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> After TransTypes decomposes an intersection type in its components, there is no point keeping the intersection AST around. This could lead to errors in the backend. This PR is proposing lowering the intersection AST to it's first component,
>
> TIA
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java line 1145:
> 1143:
> 1144: public void visitTypeIntersection(JCTypeIntersection tree) {
> 1145: result = translate(tree.bounds, null).head;
Are we 100% sure that the type of the new result is the same as the old one? I'm trying to locate what `erasure(tree.type)` might have done -- but I can't see any code in `Types.erasure` that deals with intersections??
test/langtools/tools/javac/NoTypeIntersectionASTAfterTransTypesTest.java line 73:
> 71: }
> 72:
> 73: static class MyTransTypes extends TransTypes {
I suppose another possible way to test would have been to register a task listener onto the compiler, and run that after the desugaring step. That way you don't have to extend TransTypes and use preRegister
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26203#discussion_r2194665449
PR Review Comment: https://git.openjdk.org/jdk/pull/26203#discussion_r2194663315
More information about the compiler-dev
mailing list