On Thu, Feb 6, 2020 at 2:45 PM Kingsquare.nl - Robin Speekenbrink <
robin@kingsquare.nl> wrote:
> Nikita,
>
> Just to chime in here: would it be wise to add an interface instead? (this
> would automatically be added by the engine) so that the consumer of a
> generated class could *really* know based on the interface that it's a
> generated anonymous class instead of string type checking the classname?
> Relying on some interface seems te be more future proof than just
> changing the string to look up ;)
>
"Being an anonymous class" is not a contract, so it should not be
represented by an interface. We already have a reliable way to detect
anonymous classes via isAnonymous() in reflection -- people who do string
matching probably do so specifically because they are dealing with class
strings, which may require special post-processing for anonymous classes
(in particular, dropping everything after the "\0").
Nikita