Skip to content

[Better error/notification message] "calling java_import on a non-Module object is deprecated" #6976

@rubyFeedback

Description

@rubyFeedback

I have some legacy jruby code, found on the www.

When I run it I get:

"calling java_import on a non-Module object is deprecated"

That's it.

I know ruby fairly well but I am still a semi java noob (but getting
better) and a semi jruby noob too.

My first gripe is ... I don't get the line of the error. I can figure
out indirectly, I suppose, by removing the faulty lines e. g.

import javax.swing.JFrame
import javax.swing.ImageIcon
import java.awt.Color

But it would be nice if we could see the error message such as
"line 5" or something. I think we get this via -w too in ruby.
Would be nice to have this for jruby by default too (I did not
yet run jruby via -w ... not sure if that works or not).

The second gripe, though, is more important: the message
does not tell me much. Ok, it is deprecated ... but so what,
what shall I do instead? Would it be possible to add some
more information, e. g. what to change, to make jruby
not complain about this? Both is not that important I
suppose, but it would be nice as it can save a bit developer
time when improving old legacy code in this regard. Right
now I don't know what else to do ... I may find out, but
then I may not add that information to the issue here since
I will forget, so it may be useful to solve that for other
people too in the long run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions