jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-2993

implementing java class causes exception

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.4
  • Fix Version/s: JRuby 1.1.5
  • Component/s: None
  • Labels:
    None
  • Environment:
    jruby 1.1.4 (ruby 1.8.6 patchlevel 114) (2008-08-28 rev 7570) [amd64-java]

Description

When I upgraded from 1.1.3 to 1.1.4, some stable code fails to start properly and produces the error message below. I believe the exception is thrown when I implement a Java interface. The interface that I am implementing also extends a Java class.
I wish I could share the code, but it is rather proprietary. If this bug report isn't enough to track it down completely, let me know, and I'll try to create a simple case that causes the error.

java.lang.class:-2:in `getDeclardMethods0`: java.lang.VerifyError: (class: InterfaceImpl-1933843205, method: realtimeBar signature: (IJDDDDJDI)V) Register pair 3/4 contains wrong type

Thanks,
Jon

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Charles Oliver Nutter added a comment - 11/Sep/08 4:00 PM

Please do try to come up with a simple case. Sounds like some crazy API to have a method like void foo(int, long, double, double, double, double, long, double int). My very rough guess would be that the interface impl we're generating is not mapping the types correctly. Sort out which function that is and see if you can imitate it with non-proprietary code we can use to reproduce the error.

Show
Charles Oliver Nutter added a comment - 11/Sep/08 4:00 PM Please do try to come up with a simple case. Sounds like some crazy API to have a method like void foo(int, long, double, double, double, double, long, double int). My very rough guess would be that the interface impl we're generating is not mapping the types correctly. Sort out which function that is and see if you can imitate it with non-proprietary code we can use to reproduce the error.
Hide
Permalink
Jonathan Beyer added a comment - 11/Sep/08 9:50 PM

It is indeed a crazy finance API that we are using. I have been able to replicate the error with a three-parameter function in the interface. The error disappears if the function has only the first two parameters. Let me know if I can provide any other help.

Thanks for all of your hard work Charles!!!

JavaInterface.java
------------------------
public interface JavaInterface
{
void someFunction( int param1, long param2, double param3 );
}

test.rb
------------------------
require 'java'

include_class 'JavaInterface'

class RubyClass
include JavaInterface

def initialize
end

def someFunction( param1, param2, param3 )
end
end

RubyClass.new( )

Show
Jonathan Beyer added a comment - 11/Sep/08 9:50 PM It is indeed a crazy finance API that we are using. I have been able to replicate the error with a three-parameter function in the interface. The error disappears if the function has only the first two parameters. Let me know if I can provide any other help. Thanks for all of your hard work Charles!!! JavaInterface.java ------------------------ public interface JavaInterface { void someFunction( int param1, long param2, double param3 ); } test.rb ------------------------ require 'java' include_class 'JavaInterface' class RubyClass include JavaInterface def initialize end def someFunction( param1, param2, param3 ) end end RubyClass.new( )
Hide
Permalink
Charles Oliver Nutter added a comment - 11/Oct/08 12:36 AM

I know it's been about a month, Jonathan, but can you give it a try with current code? I want to fix it but I have not had a chance to try to put together my own reproduction.

Show
Charles Oliver Nutter added a comment - 11/Oct/08 12:36 AM I know it's been about a month, Jonathan, but can you give it a try with current code? I want to fix it but I have not had a chance to try to put together my own reproduction.
Hide
Permalink
Charles Oliver Nutter added a comment - 11/Oct/08 12:37 AM

Reminder to self: try creating an interface with lots of ints and doubles and implementing it....

Show
Charles Oliver Nutter added a comment - 11/Oct/08 12:37 AM Reminder to self: try creating an interface with lots of ints and doubles and implementing it....
Hide
Permalink
Jonathan Beyer added a comment - 13/Oct/08 8:20 AM

Charles,

I'm having problems downloading the latest snapshot to test against. The wiki gives provides the following link, which hasn't been working for a few days: http://jruby.thresher.com/download/JRUBY-TRSNAPINST/artifacts/latest/jruby-bin-snapshot-tar

What am I doing wrong?

Thanks,
Jon

Show
Jonathan Beyer added a comment - 13/Oct/08 8:20 AM Charles, I'm having problems downloading the latest snapshot to test against. The wiki gives provides the following link, which hasn't been working for a few days: http://jruby.thresher.com/download/JRUBY-TRSNAPINST/artifacts/latest/jruby-bin-snapshot-tar What am I doing wrong? Thanks, Jon
Hide
Permalink
Charles Oliver Nutter added a comment - 13/Oct/08 12:55 PM

Jonathan: Where did you see that link? We don't use thresher anymore; try the jruby-dist build on http://jruby.headius.com:8080/hudson.

Show
Charles Oliver Nutter added a comment - 13/Oct/08 12:55 PM Jonathan: Where did you see that link? We don't use thresher anymore; try the jruby-dist build on http://jruby.headius.com:8080/hudson.
Hide
Permalink
Jonathan Beyer added a comment - 13/Oct/08 1:37 PM

Charles,

That link was here: http://wiki.jruby.org/wiki/Main_Page

Text of link is "Latest Snapshots".

I will try the latest build and let you know.

Cheers,
Jon

Show
Jonathan Beyer added a comment - 13/Oct/08 1:37 PM Charles, That link was here: http://wiki.jruby.org/wiki/Main_Page Text of link is "Latest Snapshots". I will try the latest build and let you know. Cheers, Jon
Hide
Permalink
Jonathan Beyer added a comment - 13/Oct/08 3:40 PM

The current code is still broken for the test case that I included in the bug report on Sept 11. I receive the following error:

java.lang.Class:-2:in `getDeclaredMethods0': java.lang.VerifyError: (class: InterfaceImpl772013509, method: someFunction signature: (IJD)V) Register pair 3/4 contains wrong type
from java.lang.Class:2427:in `privateGetDeclaredMethods'
from java.lang.Class:2670:in `getMethod0'
from java.lang.Class:1603:in `getMethod'
from org.jruby.java.MiniJava:684:in `populateOldStyleImplClass'
from org.jruby.java.MiniJava:194:in `createOldStyleImplClass'
from org.jruby.javasupport.Java:1547:in `new_proxy_instance2'
from org.jruby.java.proxies.JavaInterfaceTemplate:251:in `jcreateProxy'
from org.jruby.java.proxies.JavaInterfaceTemplate:23:in `access$000'
from org.jruby.java.proxies.JavaInterfaceTemplate$3:158:in `call'
from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock:62:in `call'
from org.jruby.RubyClass:353:in `finvoke'
from org.jruby.javasupport.util.RuntimeHelpers:297:in `invoke'
from org.jruby.java.proxies.JavaInterfaceTemplate$2:142:in `call'
from org.jruby.internal.runtime.methods.DynamicMethod:226:in `call'
from org.jruby.internal.runtime.methods.DynamicMethod:203:in `call'
from org.jruby.runtime.callsite.CachingCallSite:258:in `cacheAndCall'
from org.jruby.runtime.callsite.CachingCallSite:76:in `call'
from test:15:in `_file_'
from test:-1:in `_file_'
from test:-1:in `load'
from org.jruby.Ruby:556:in `runScript'
from org.jruby.Ruby:469:in `runNormally'
from org.jruby.Ruby:342:in `runFromMain'
from org.jruby.Main:214:in `run'
from org.jruby.Main:100:in `run'
from org.jruby.Main:84:in `main'

Show
Jonathan Beyer added a comment - 13/Oct/08 3:40 PM The current code is still broken for the test case that I included in the bug report on Sept 11. I receive the following error: java.lang.Class:-2:in `getDeclaredMethods0': java.lang.VerifyError: (class: InterfaceImpl772013509, method: someFunction signature: (IJD)V) Register pair 3/4 contains wrong type from java.lang.Class:2427:in `privateGetDeclaredMethods' from java.lang.Class:2670:in `getMethod0' from java.lang.Class:1603:in `getMethod' from org.jruby.java.MiniJava:684:in `populateOldStyleImplClass' from org.jruby.java.MiniJava:194:in `createOldStyleImplClass' from org.jruby.javasupport.Java:1547:in `new_proxy_instance2' from org.jruby.java.proxies.JavaInterfaceTemplate:251:in `jcreateProxy' from org.jruby.java.proxies.JavaInterfaceTemplate:23:in `access$000' from org.jruby.java.proxies.JavaInterfaceTemplate$3:158:in `call' from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock:62:in `call' from org.jruby.RubyClass:353:in `finvoke' from org.jruby.javasupport.util.RuntimeHelpers:297:in `invoke' from org.jruby.java.proxies.JavaInterfaceTemplate$2:142:in `call' from org.jruby.internal.runtime.methods.DynamicMethod:226:in `call' from org.jruby.internal.runtime.methods.DynamicMethod:203:in `call' from org.jruby.runtime.callsite.CachingCallSite:258:in `cacheAndCall' from org.jruby.runtime.callsite.CachingCallSite:76:in `call' from test:15:in `_file_' from test:-1:in `_file_' from test:-1:in `load' from org.jruby.Ruby:556:in `runScript' from org.jruby.Ruby:469:in `runNormally' from org.jruby.Ruby:342:in `runFromMain' from org.jruby.Main:214:in `run' from org.jruby.Main:100:in `run' from org.jruby.Main:84:in `main'
Hide
Permalink
Charles Oliver Nutter added a comment - 16/Oct/08 2:47 PM

Ok, I think I know what's wrong. The logic that implements an interface is probably not using the proper operations for two-dword primitives (long and double), and is not juggling the stack correctly. I can fix that pretty easily. Looking at it now.

Show
Charles Oliver Nutter added a comment - 16/Oct/08 2:47 PM Ok, I think I know what's wrong. The logic that implements an interface is probably not using the proper operations for two-dword primitives (long and double), and is not juggling the stack correctly. I can fix that pretty easily. Looking at it now.
Hide
Permalink
Charles Oliver Nutter added a comment - 16/Oct/08 2:53 PM

Reproduced with the following snippit:

➔ jruby -rjava -e "class Foo; include Java::Test; def foo(a, b); puts a; puts b; 'foo'; end; end; Foo.new.foo(1, 1)"
java.lang.Class:-2:in `getDeclaredMethods0': java.lang.VerifyError: (class: InterfaceImpl940412576, method: foo signature: (JD)V) Register pair 2/3 contains wrong type
	from java.lang.Class:2427:in `privateGetDeclaredMethods'
	from java.lang.Class:2670:in `getMethod0'
	from java.lang.Class:1603:in `getMethod'
	from org.jruby.java.MiniJava:684:in `populateOldStyleImplClass'

Seems to be related to having two 64-bit primitives, since we have other tests for single 64-bit primitive interfaces.

Show
Charles Oliver Nutter added a comment - 16/Oct/08 2:53 PM Reproduced with the following snippit:
➔ jruby -rjava -e "class Foo; include Java::Test; def foo(a, b); puts a; puts b; 'foo'; end; end; Foo.new.foo(1, 1)"
java.lang.Class:-2:in `getDeclaredMethods0': java.lang.VerifyError: (class: InterfaceImpl940412576, method: foo signature: (JD)V) Register pair 2/3 contains wrong type
	from java.lang.Class:2427:in `privateGetDeclaredMethods'
	from java.lang.Class:2670:in `getMethod0'
	from java.lang.Class:1603:in `getMethod'
	from org.jruby.java.MiniJava:684:in `populateOldStyleImplClass'
Seems to be related to having two 64-bit primitives, since we have other tests for single 64-bit primitive interfaces.
Hide
Permalink
Charles Oliver Nutter added a comment - 16/Oct/08 4:19 PM

Fixed with a spec in r7883. Sorry for the delay on this one; turned out to be 5 minutes of work.

Show
Charles Oliver Nutter added a comment - 16/Oct/08 4:19 PM Fixed with a spec in r7883. Sorry for the delay on this one; turned out to be 5 minutes of work.

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Jonathan Beyer
Vote (0)
Watch (1)

Dates

  • Created:
    11/Sep/08 3:38 PM
    Updated:
    12/Jan/09 4:28 PM
    Resolved:
    16/Oct/08 4:19 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.