Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] allow enabling warnings wout changing $VERBOSE #7534

Merged
merged 1 commit into from Feb 6, 2023

Conversation

kares
Copy link
Member

@kares kares commented Dec 21, 2022

previously there was no way of "just enabling warnings", warnings were enabled with setVerbose(IRubyObject verbose)

to be able to consume warnings but not change $VERBOSE I've added a setWarningsEnabled.

also for Java consumers it's easier to deal with Java values thus setVerbose(Boolean verbose) overload is added ...

@kares kares added the feature label Dec 21, 2022
@kares kares added this to the JRuby 9.4.1.0 milestone Dec 21, 2022
@headius
Copy link
Member

headius commented Jan 4, 2023

This seems fine, but I wonder how much effect it will have after code has loaded and cached the current $VERBOSE value. We don't do much caching of global variables right now, but we probably will in the coming months. Also, there's a lot of code out there that makes verbosity decisions early on and never looks at this variable again.

@kares
Copy link
Member Author

kares commented Jan 5, 2023

This seems fine, but I wonder how much effect it will have after code has loaded and cached the current $VERBOSE value.

The actual use-case, this came from, is actually setting up the runtime early.
But yeah it's a valid point, Although there's already a few places (within JRuby itself) doing a setVerbose.
Also while there's the RubyInstanceConfig the verbosity level cat only be controlled on the runtime, atm.

@headius
Copy link
Member

headius commented Jan 5, 2023

@kares Yeah that makes sense. I think it's a good change. If someone gets confused we can just explain that these values are frequently cached during post-boot startup by some libraries.

@kares kares merged commit c0bde0b into jruby:master Feb 6, 2023
@kares kares deleted the set-warnings-enabled branch February 6, 2023 08:42
edipofederle pushed a commit to edipofederle/jruby that referenced this pull request Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants