jrubyc --java fails to java_require when class and script are named the same
----------------------------------------------------------------------------
Key: JRUBY-4671
URL: http://jira.codehaus.org/browse/JRUBY-4671
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.5
Reporter: Charles Oliver Nutter
Assignee: Charles Oliver Nutter
Fix For: JRuby 1.5
This doesn't work:
foo.rb
{noformat}
require 'java'
java_require 'foo'
class Foo; end
{noformat}
The problem here is that on systems that aren't case-sensitive, the Foo class
gets generated into Foo.class with a require that looks for "foo". Our normal
search order tries to find "foo.class" before "foo.rb", and on a
non-case-sensitive filesystem it ends up finding Foo.class. This results in a
require error, since you can't require a Java class.
renaming the file solves the problem, or putting the class into a specific
package, but we need some way to address this (ranging from a nicer error
message to making it work...somehow).
Here's the error that results, FWIW:
{noformat}
~/projects/jruby ➔ jrubyc --java foo.rb
Generating Java class Foo to Foo.java
javac -d /Users/headius/projects/jruby -cp
/Users/headius/projects/jruby/lib/jruby.jar:. Foo.java
~/projects/jruby ➔ java -cp .:lib/jruby.jar Foo
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.jruby.exceptions.RaiseException: use `java_import' to load
normal Java classes
at (unknown).new(:1)
at (unknown).(unknown)(:1)
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
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