Java 7 -> Java8 code breakage scenarios

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Feb 28 10:02:41 PST 2013


On 28/02/13 17:53, Boaz Nahum wrote:
> On my site, indeed both crashes were replaced by compiler error message.
> But the message so unrelated to the location of error (but still it helps
> quickly solve the error).
> let me explain, assume the below hierarchy
I'm glad the fix got rid of both crashes!

As for the location of the error message, I think this is one of those 
cases where the error message is too cryptic. The rationale about the 
message being generated there is that the logic for scanning supertypes 
is lazy - you only get there if you need it - and in your case the 
method call is triggering it. However I agree that the error message 
doesn't give much info in order to understand what's going on. If it 
said something like:

    [javac] Test.java:26: error: cannot access supertype of C2
    [javac]         label.setText(module.getName());
    [javac]                                       ^
    [javac]   class file for interface I1 not found


I think it'd be more helpful, even with current location.

Maurizio
>
> I1 {}
> I2 extends I1 {}
>
> C1 implement I2 {
>    String getName();
> }
>
> C2 extends C1 {}
>
> Test {
>     test(C2 module) {
>
>       label.setText(module.getName());
>
>     }
> }
> ---------------------------
> When compiling Test and I1 is missing then I got error message
>
>     [javac] Test.java:26: error: cannot access I1
>     [javac]         label.setText(module.getName());
>     [javac]                                       ^
>     [javac]   class file for I1 not found
>
> Don't get me wrong. I'm happy, What I have done in two days, takes me 15
> minutes with the new fix.
>
>
> Btw - to clarify; the fix doesn't remove the need for the extra dependency
>> - but it allows the compiler to fail gracefully with the 'class file for
>> XYZ not found' message.
>>
> Good enough for me.
>
> SO MANY THANKS
> Boaz
>



More information about the lambda-dev mailing list