RFR: 8322810: Lambda expression types can't be classes [v6]

Vicente Romero vromero at openjdk.org
Fri Apr 11 01:15:45 UTC 2025


On Fri, 11 Apr 2025 00:22:19 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> test/langtools/tools/javac/lambda/ClassInIntersectionTypeTest.java line 32:
>> 
>>> 30:     static Class<? extends Annotation> myAnnoType() { return null; }
>>> 31:     @interface Anno {}
>>> 32:     Anno a = (Anno & Serializable) ()-> null; // annotations not allowed
>> 
>> Actually, I wonder -- the annotation should not be allowed in any position right? Not just in the first type? E.g. since an annotation is an interface, you can also have:
>> 
>> `Runnable & Anno1 & Anno2`
>> 
>> Do we detect those?
>
> I will add a test

done

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24548#discussion_r2038650611


More information about the compiler-dev mailing list