Annotations on return-overridden methods also end up on bridge methods
Alex Buckley
alex.buckley at oracle.com
Thu Nov 21 11:20:14 PST 2013
Hi Charlie,
On 11/21/2013 12:16 AM, Charles Oliver Nutter wrote:
> RubyBasicObject defines op_equal:
>
> @Override
> public IRubyObject op_equal(ThreadContext context, IRubyObject obj) {
>
> RubyMethod extends RubyObject which extends RubyBasicObject, and it
> also overrides op_equal with a more specific return type:
>
> @JRubyMethod(name = "==", required = 1)
> @Override
> public RubyBoolean op_equal(ThreadContext context, IRubyObject other) {
>
> However, on JDK8, we get an error like this:
>
> Exception in thread "main" java.lang.ClassFormatError: Duplicate
> method name&signature in class file
> org/jruby/RubyMethod$INVOKER$i$op_equal
>
> This is because JDK8's generated IRubyObject-returning bridge method
> also has the JRubyMethod annotation.
I'm perplexed about the ClassFormatError. A class file can have multiple
methods with the same name and signature as long as the return types are
different. Annotation attributes buried deep in method_info structures
shouldn't be relevant here.
I wonder if the error message says "signature" where it means to say
"descriptor". We all know that a class can't have multiple methods with
same name and _descriptor_. Can you list very concisely all the
method_info's in RubyBasicObject.class and RubyMethod.class ?
Alex
More information about the compiler-dev
mailing list