Skip to content

java_send/java_alias and perhaps others are not finding the proper method #5631

@enebo

Description

@enebo

This is largely an issue with Java 9+ issue but if we call something like:

java_import java.awt.Canvas;
java_import java.awt.Graphics;
java_import javax.swing.JFrame;

class Drawing < Canvas
  def paint(g)
    g.fillOval(100, 100, 200, 200)
    g.java_send :translate, [::Java.int, ::Java.int], 10, 10
  end
end

frame = JFrame.new("My Drawing");
canvas = Drawing.new
canvas.setSize(400, 400)
frame.add(canvas);
frame.pack
frame.setVisible(true)

The java_send to translate will find the method from the object it represents. So it asks for its class and finds:
METHOD public void sun.java2d.SunGraphics2D.translate(int,int)
and this will fail in Java 9+ beacuse it is not exported. It should in fact call:
METHOD public abstract void java.awt.Graphics.translate(int,int) which is fine.

Ordinary method bindings on Java proxy classes appear to call the right method so it is unclear if there is an issue there.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions