Skip to content

Clean up compile warnings and deprecations on Java 14#6402

Merged
headius merged 10 commits intojruby:masterfrom
headius:java14_compile_cleanup
Sep 20, 2020
Merged

Clean up compile warnings and deprecations on Java 14#6402
headius merged 10 commits intojruby:masterfrom
headius:java14_compile_cleanup

Conversation

@headius
Copy link
Member

@headius headius commented Sep 19, 2020

Lots of deprecation cleanup and a few more notable changes:

  • The BigDecimal constants for rounding are now binding the ordinals of RoundingMode, since the integer values from java's BigDecimal are deprecated. Places that handle these constant values are updated to use values()[ordinal] instead of the legacy valueOf(int)
  • MulticastSocket.joinGroup(InetAddress) is replaced with a call to joinGroup(SocketAddress, NetworkInterface) that should be equivalent.
  • There are plans to make yield a reserved identifer, so bare calls to yield methods must be qualified.
  • Two packages that were marked deprecated to trick javac into emitting a class file (and therefore not recompiling every time) are undeprecated, due to the many deprecation warnings they produce on recent javac versions.

Deprecated in 9, replacement is to get no-arg constructor and call
that instead. Some additional exception-handling required (lack of
which was the reason newInstance is now deprecated).
The commit that deprecated this method, f64a3e0, also added code
that uses it. Since there's no obvious replacement and the method
itself just walks the trace and produces MRI formatted strings, I
am undeprecating it.
Switch to using RoundingMode ordinals.
Probably in prep for value types...
@headius headius added this to the JRuby 9.3.0.0 milestone Sep 19, 2020
newInstance was deprecated because it did not wrap exceptions
raised during instantiation, so we emulate that behavior here by
unwrapping.
backport9 library will now implement these using isAccessible on
Java 8 and module isOpen on Java 9.
@headius
Copy link
Member Author

headius commented Sep 19, 2020

The remaining deprecations include the following:

  • Object#finalize which should be replaced by using the Cleaner class in Java 9+. No equivalent replacement exists for Java 8.
  • Package.getPackage(String) is replaced by ClassLoader.getDefinedPackage but that is also Java 9+.
  • There are still calls to our own FileResource.inputStream which was deprecated without a replacement.

@headius headius merged commit e2256a8 into jruby:master Sep 20, 2020
@headius headius deleted the java14_compile_cleanup branch September 20, 2020 18:55
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.

1 participant