An anonymous class appearing in JShell is rewritten to something that gets interpreted as a member class:
jshell> new Object(){}.getClass()
$1 ==> class $0
jshell> $1.isAnonymousClass()
$2 ==> false
jshell> $1.isLocalClass()
$3 ==> false
jshell> $1.isMemberClass()
$4 ==> true
This affects the behavior of other methods like 'getSimpleName' and 'getCanonicalName'.
I don't know the translation strategy, but perhaps it could be adjusted to give javac a true anonymous class?
jshell> new Object(){}.getClass()
$1 ==> class $0
jshell> $1.isAnonymousClass()
$2 ==> false
jshell> $1.isLocalClass()
$3 ==> false
jshell> $1.isMemberClass()
$4 ==> true
This affects the behavior of other methods like 'getSimpleName' and 'getCanonicalName'.
I don't know the translation strategy, but perhaps it could be adjusted to give javac a true anonymous class?