[Nestmates] Error message when MemberOfNest is not found

forax at univ-mlv.fr forax at univ-mlv.fr
Tue Aug 22 18:43:18 UTC 2017

----- Mail original -----
> De: "David Holmes" <david.holmes at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Mardi 22 Août 2017 04:41:17
> Objet: Re: [Nestmates] Error message when MemberOfNest is not found

> Hi Remi,

Hi David,

> On 22/08/2017 12:11 AM, Remi Forax wrote:
>> While testing the implementation of nestmates in ASM,
>> i've mess up with one of my test and insert the wrong name in MemberOfNest.
>> So it get a ClassNotFoundError, that's Ok, but i get an unexpected stacktrace,
>> it reference the first line of the main(), which is disturbing.
>> Exception in thread "main" java.lang.NoClassDefFoundError: $A
>> 	at Foo.main(Foo.java:15)
>> Caused by: java.lang.ClassNotFoundException: $A
>> 	at
>> 	java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
>> 	at
>> 	java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
>> 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:495)
>> 	... 1 more
>> Is it normal ?
> In the existing code nestmate validation occurs at link-time, so if your
> class needed to be linked by the start of main then it is as expected.
> I'm currently working on a change to only do nestmate validation at the
> time an actual nestmate access is needed. That should put the exception
> at a less surprising place. This allows for more cases where the
> nest-top, I mean nest-host, class may not be present and is not needed.

It seems a better semantics.

>> Is there a way to improve the error message ?
> There is an action item to look at the exceptions that can come from
> nestmate validation and ensure we throw reasonable exceptions at
> reasonable places with reasonable error messages. Currently
> LinkageErrors just propagate and the NCDFE messages can be somewhat
> unhelpful.
> This is all WIP.

thanks for working on this.

> Thanks,
> David
>> Rémi


More information about the valhalla-dev mailing list