Forum: JRuby cannot reference Rectangle2D.Double class jruby seem to search for a method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
remgo (Guest)
on 2009-01-31 00:10
(Received via mailing list)
The following very simple case I cannot get to work.

require 'java'
class Test
  java.awt.geom.Rectangle2D.Double.new(20,40,40,20)
end

# => undefined method `Double' for Java::JavaAwtGeom::Rectangle2D:Class
(NoMethodError)

Possible reason:
I do understand that jruby is looking for a method instead of class. It
maybe has something to do with the fact that between the java and jruby
lookup of methods and functions in combination with the java type double
and
case transformations??

Does somebody has a solution

I used jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2008-12-17 rev 8388)
[i386-java]

Simple equivalent in java

import java.awt.geom.Rectangle2D;

public class test {
  public void testmethod() {
    new Rectangle2D.Double(10, 10, 10, 10);
  }
}

Javadoc of the class
# java.awt.geom
# Class Rectangle2D.Double
#
# java.lang.Object
#   extended by java.awt.geom.RectangularShape
#       extended by java.awt.geom.Rectangle2D
#           extended by java.awt.geom.Rectangle2D.Double


--
View this message in context:
http://www.nabble.com/cannot-reference-Rectangle2D...
Sent from the JRuby - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Serabe (Guest)
on 2009-01-31 00:16
(Received via mailing list)
2009/1/30 remgo <removed_email_address@domain.invalid>:
>
>
> The following very simple case I cannot get to work.
>
> require 'java'
> class Test
>  java.awt.geom.Rectangle2D.Double.new(20,40,40,20)
> end

require 'java'
class Test
  java.awt.geom.Rectangle2D::Double.new(20,40,40,20)
end

Cheers,

Serabe

--
http://www.serabe.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.