Native methods in unnamed classes

Maurizio Cimadamore maurizio.cimadamore at
Thu Jul 20 09:20:45 UTC 2023

Good point Tagir.

IMHO this is something that needs to be looked at. While it's true that 
the compiler will have to come up with a name for the class, there's no 
guarantee anywhere that such a name will be stable. E.g. perhaps the 
Java compiler can change the name of the class depending on the contents 
it saw at the time of compiling (we don't do this, but JLS doesn't say 
it can't be done). Which then would leave you with a set of *unstable* 
native methods.


On 20/07/2023 10:17, Tagir Valeev wrote:
> Hello!
> A quick question about unnamed classes specification draft [1]. I
> don't see that native methods are explicitly forbidden inside unnamed
> classes. If they are allowed, it's not quite clear how to define the
> name of the corresponding method in the native library according to
> [2], as the binary name of an unnamed class can be arbitrarily defined
> by java compiler (JLS 13.1). Or is this not a problem?
> With best regards,
> Tagir Valeev
> [1]
> [2]

More information about the amber-spec-experts mailing list