You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since all classes implicitly inherit from java.lang.Object at run-time, we have to deal with name clashes. The following methods are final and have to be escaped:
Class<?> getClass()
void notify()
void notifyAll()
void wait(long timeout)
void wait(long timeout, int nanos)
void wait()
Note that the signature is relevant and we only have to escape if a method matches in both name and signature.
The following methods are not final and might be overridden:
int hashCode()
boolean equals(Object obj)
Object clone()
String toString()
void finalize()
The question here is what we want to do with those. We can treat toString as a separate case because it's defined in Haxe with the same semantics, so we always want to allow overriding it in classes. For the others, there are two options:
Escape by default, allow to not-escape (and thus override) with metadata.
Don't escape (and thus override) by default, allow to to escape with metadata.
Not sure which option is better. From a pragmatic point of view I'm leaning towards 2.
As for how to handle the escaping, I propose that we prefix with _hx_ and make sure reflection respects that. This should be a matter of stripping a leading _hx_ in some places, and adding it in some others. That's pretty annoying, but I don't think we can avoid it.
The text was updated successfully, but these errors were encountered:
Error: LinkageError occurred while loading main class haxe.root.Main
java.lang.VerifyError: class haxe.root.Main overrides final method java.lang.Object.wait()V
Error: Command failed with error 1
Since all classes implicitly inherit from java.lang.Object at run-time, we have to deal with name clashes. The following methods are
final
and have to be escaped:Class<?> getClass()
void notify()
void notifyAll()
void wait(long timeout)
void wait(long timeout, int nanos)
void wait()
Note that the signature is relevant and we only have to escape if a method matches in both name and signature.
The following methods are not final and might be overridden:
int hashCode()
boolean equals(Object obj)
Object clone()
String toString()
void finalize()
The question here is what we want to do with those. We can treat
toString
as a separate case because it's defined in Haxe with the same semantics, so we always want to allow overriding it in classes. For the others, there are two options:Not sure which option is better. From a pragmatic point of view I'm leaning towards 2.
As for how to handle the escaping, I propose that we prefix with
_hx_
and make sure reflection respects that. This should be a matter of stripping a leading_hx_
in some places, and adding it in some others. That's pretty annoying, but I don't think we can avoid it.The text was updated successfully, but these errors were encountered: