Syntax for referencing

We’ve been using JRuby for years now. Throughout our code, I’ve always
used syntax like Java::org.aps.eop.model.Manuscript to reference java
classes outside of the standard lib. That has always seemed intuitive to
me. Just prepend Java:: and reference it just as you would in Java. On
the JRuby wiki
(https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby) it doesn’t
even mention that method. As a matter of fact, I could swear that I
remember one of the core JRuby maintainers mentioning on the mailing
list that the primary syntax described in the
wiki(Java::OrgApsEOP::Manuscript) was more an internal thing and not
guaranteed to stay around. Is the Java::org.aps.eop.model.Manuscript
syntax undesirable?

Thanks,
-lenny

On May 13, 2011, at 10:56 , Lenny M. wrote:

We’ve been using JRuby for years now. Throughout our code, I’ve always used
syntax like Java::org.aps.eop.model.Manuscript to reference java classes outside
of the standard lib. That has always seemed intuitive to me. Just prepend Java::
and reference it just as you would in Java. On the JRuby wiki
(https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby) it doesn’t even mention
that method. As a matter of fact, I could swear that I remember one of the core
JRuby maintainers mentioning on the mailing list that the primary syntax described
in the wiki(Java::OrgApsEOP::Manuscript) was more an internal thing and not
guaranteed to stay around. Is the Java::org.aps.eop.model.Manuscript syntax
undesirable?

Not at all. It’s probably a little less intuitive than plain
“org.aps.eop.model” but it certainly has the benefit of calling out
where you reference Java classes. Feel free to add a section to the
wiki.

Thanks,
/Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs