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

Fix JRuby detection on JRuby 9.2 in cpu_counter.rb #265

Merged
merged 2 commits into from
Oct 6, 2018

Conversation

jeremyevans
Copy link
Contributor

Java::Java is no longer defined by default, it's not defined until it is accessed:

$ jruby -e 'p defined?(Java::Java)'
nil
$ jruby -e 'p Java::Java'
Java::Java

In earlier JRuby versions, defined?(Java::Java) returned "constant".

While this doesn't cause an test failures, it does result in the following warning when run on non-Windows systems: !!!! Missing jruby-win32ole gem: jruby -S gem install jruby-win32ole, because the first fallback code is to try to load win32ole, and on JRuby that prints the warning.

Java::Java is no longer defined by default, it's not defined
until it is accessed:

$ jruby -e 'p defined?(Java::Java)'
nil
$ jruby -e 'p Java::Java'
Java::Java

In earlier JRuby versions, defined?(Java::Java) returned
"constant".
@@ -32,7 +32,7 @@ def count
require 'rbconfig'

def count
if defined?(Java::Java)
if defined?(JRUBY_VERSION) && (Java::Java rescue nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about to use RUBY_PLATFORM == 'java' instead of current imprementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let me send another diff.

@colby-swandale
Copy link
Member

@hsbt is this waiting on anything more to merge?

@hsbt hsbt merged commit ddceed9 into ruby:master Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants