RFR 8203436: javac should fail early when emitting illegal signature attributes

Vicente Romero vicente.romero at oracle.com
Fri May 18 20:49:11 UTC 2018



On 05/18/2018 04:46 PM, Maurizio Cimadamore wrote:
> Thanks,
>
> I discovered another interesting test:
>
> interface A { }
> interface B { }
>
> class Outer<X> {
>    class Inner { }
>
>    <Z extends A & B> Outer<Z> m() { return null; }
>
>    void test(Outer<?> outer) {
>       m().new Inner() { };
>    }
> }

yep very interesting

>
>
> This time it attempts to create a signature attribute with an 
> intersection. This used to crash javac in 5-10, but with this patch a 
> regular error message is emitted:
>
> error: error while generating class <anonymous Outer$1>
>   (illegal signature attribute for type INT#1)
>   where INT#1 is an intersection type:
>     INT#1 extends Object,A,B
> 1 error
>
>
> I'll add this test to the patch.

sounds good
>
> Maurizio

Vicente

>
>
> On 18/05/18 19:28, Vicente Romero wrote:
>> looks good!
>> Vicente
>>
>> On 05/18/2018 02:12 PM, Maurizio Cimadamore wrote:
>>> Hi,
>>> this patch makes javac a bit stricter when it comes to generating 
>>> bytecode that has illegal signature attributes (which can happen in 
>>> case of non-denotable types). Instead of allowing compilation and 
>>> then fail at verify time, this patch issues an error message.
>>>
>>> I've refactored another generation-related diagnostic to share the 
>>> same 'header' - an example of the diagnostics involved is included 
>>> in the webrev.
>>>
>>> http://cr.openjdk.java.net/~mcimadamore/8203436/
>>>
>>> Cheers
>>> Maurizio
>>>
>>
>



More information about the compiler-dev mailing list