pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/jruby/jruby/discussions/8187

et" href="https://github.githubassets.com/assets/github-f825c0edd7ad57f8.css" /> Access Java enum with same name as static method · jruby/jruby · Discussion #8187 · GitHub
Skip to content
Discussion options

You must be logged in to vote

I've filed a bug for this in #8188.

A workaround for you for now would be to use reflection to access the enum values:

[] jruby $ cat Blah.java
public enum Blah {
    blah1, blah2;

    public static void blah1() {}
}
[] jruby $ jruby -e 'p Java::Blah.blah1, Java::Blah.blah2'
nil
blah2
[] jruby $ jruby -e 'p Java::Blah.java_class.get_field("blah1").get(nil), Java::Blah.blah2'
blah1
blah2

You should be able to take this further and define Ruby capitalized constants for those values, and just use the constants in your code.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@mrckzgl
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mrckzgl
Comment options

Answer selected by mrckzgl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy