Skip to content

Clean up and modernize the JRuby extension#3478

Merged
flavorjones merged 2 commits intosparklemotion:mainfrom
headius:jruby_cleanup
Mar 23, 2025
Merged

Clean up and modernize the JRuby extension#3478
flavorjones merged 2 commits intosparklemotion:mainfrom
headius:jruby_cleanup

Conversation

@headius
Copy link
Copy Markdown
Contributor

@headius headius commented Mar 18, 2025

This PR will do some cleanup of the JRuby extension.

The first pass will be improvements recommended by IntelliJ plus some TODO comments for deprecated methods in JRuby 10.

Deprecated JRuby calls have replacements in 10 that will soon be backported to JRuby 9.4. These calls should not be updated to use the new API until it has been in the wild in a 9.4 release for at least a year.

Additional passes will update style to match modern JRuby and Java recommendations and include some minor performance improvements.

* Recommended changes from IntelliJ, including generic type
  cleanups, inner classes to lambdas, unused methods deprecated,
  redundant code eliminated, loops simplified, imports cleaned up,
  and more.
* Added TODOs to calls to JRuby methods deprecated in 10. These
  have replacements in 10 that will be backported after release.
  These calls should not be updated to the new versions for at
  least a year after they are available in JRuby 9.4 releases.

This commit should not contain any behavioral changes. All changes
here should be simple cleanup and Java style updates.
Comment thread ext/java/nokogiri/internals/NokogiriHelpers.java Outdated
This is the compilation error I'm trying to fix:

```
ext/java/nokogiri/internals/NokogiriHelpers.java:744: error: cannot find symbol
    if (str.isEmpty()) { return str; } // no need to convert
           ^
  symbol:   method isEmpty()
  location: variable str of type CharSequence
```
@headius
Copy link
Copy Markdown
Contributor Author

headius commented Mar 23, 2025

I don't think I'll get back to this for the additional style and form changes for a while (got to get JRuby 10 finished!), so you can merge this when it goes green.

@flavorjones flavorjones merged commit ba225a8 into sparklemotion:main Mar 23, 2025
275 of 277 checks passed
@flavorjones
Copy link
Copy Markdown
Member

@headius Thanks so much for spending some time cleaning this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants