On Thu, 30 Apr 2026 09:55:13 GMT, Maurizio Cimadamore <[email protected]> 
wrote:

>> This is the proposed patch for Enhanced Local Variable Declarations 
>> (Preview).
>> 
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 2469:
> 
>> 2467:                     if (superSym.isSealed()
>> 2468:                             && permitted.size() == 1
>> 2469:                             && permitted.getFirst().tsym == 
>> current.tsym) {
> 
> I think this should help reject this:
> 
> 
> sealed interface Foo permits Bar { }
> final class Bar implements Foo {}
> class Test<X extends Foo> {
>     void test(Foo foo) {
>         X x = foo;
>     }
> }
> 
> But maybe let's add a test just in case.
> 
> (Note: unfortunately you can have a type parameter bound refer to an 
> unrelated sealed interface).

This is still rejected, with or without preview. Should I still include it in 
`EnhancedVariableDeclAssignmentNR1SRegressionErrors` as an error with&without 
`--enable preview`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30556#discussion_r3183504998

Reply via email to