Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0.pre2, JRuby 1.6.8
Assignee: Unassigned
Components: Java Integration
Created: 22/Sep/12 1:53 PM
Description:

When you create a Ruby class that includes a Java interface, instances of that class throw an NPE when calling #java_class or #java_kind_of? except when calling #java_kind_of? on the included interface itself.

Unable to find source-code formatter for language: ruby. Available languages are: _javascript_, sql, xhtml, actionscript, none, html, xml, java
require 'java'

class Foo
  include Java::JavaIo::Serializable
end

Foo.new.java_class                                # -> NPE
Foo.new.java_kind_of?(Java::JavaIo::Serializable) # -> true
Foo.new.java_kind_of?(Java::JavaLang::String)     # -> NPE
Foo.new.java_kind_of?(Java::JavaLang::Comparable) # -> NPE

The issue shows up on 1.6.8 and 1.7.0preview2. Here's the trace for 1.7.0preview2:

jruby-1.7.0.preview2 :028 > Foo.new.java_kind_of?(Java::JavaLang::String)
Java::JavaLang::NullPointerException: 
	from org.jruby.java.proxies.JavaInterfaceTemplate$5.call(JavaInterfaceTemplate.java:191)
	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:133)
	from org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:63)
	from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
	from org.jruby.ast.ReturnNode.interpret(ReturnNode.java:92)
	from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
	from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
	from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
	from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
	from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:192)
	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
	from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
	from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
	from org.jruby.ast.RootNode.interpret(RootNode.java:129)
	from org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:96)
... 124 levels...
	from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
	from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
	from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:192)
	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
	from Users.eiong.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_0_dot_preview2.bin.irb.__file__(/Users/eiong/.rvm/rubies/jruby-1.7.0.preview2/bin/irb:17)
	from Users.eiong.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_0_dot_preview2.bin.irb.load(/Users/eiong/.rvm/rubies/jruby-1.7.0.preview2/bin/irb)
	from org.jruby.Ruby.runScript(Ruby.java:780)
	from org.jruby.Ruby.runScript(Ruby.java:773)
	from org.jruby.Ruby.runNormally(Ruby.java:650)
	from org.jruby.Ruby.runFromMain(Ruby.java:499)
	from org.jruby.Main.doRunFromMain(Main.java:376)
	from org.jruby.Main.internalRun(Main.java:265)
	from org.jruby.Main.run(Main.java:231)
	from org.jruby.Main.run(Main.java:215)
	from org.jruby.Main.main(Main.java:195)jruby-1.7.0.preview2 :029 >
Environment: OSX 10.6.8, Java 1.6.0_35
Project: JRuby
Priority: Major Major
Reporter: Emil Ong
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to