RFR: JDK-8242808 Fix all remaining deprecation warnings in jdk.hotspot.agent

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Apr 15 09:13:32 UTC 2020


After JDK-8242804, a few places remain which are using deprecated 
methods. They too should be fixed, and the deprecation warning should no 
longer be disabled.

This patch presupposes the fix for JDK-8242804 has been applied 
(otherwise we cannot turn the deprecation warning back on).

Some brief comments about each fix:

* In ConstantPool.java, there was a boxing deprecation that I missed in 
JDK-8242804 (sorry!)

* In HighPrecisionJScrollBar.java, there is a trivial replacement to use 
BigDecimal.divide with RoundingMode semantics.

* In SourceCodePanel.java, I settled for suppressing the warning. The 
issue here is that modelToView (which returns a Rectangle) is deprecated 
in favor of modelToView2D, which returns a Rectangle2D (which is a 
supertype of Rectangle). But we use the result in scrollRectToVisible, 
and there exist no version of that which accepts a Rectangle2D instead 
of a Rectangle, nor a way to created a Rectangle from a Rectangle2D 
(that I could find). In practice, this is just a game of types -- under 
the hood, modelToView2D still returns a Rectangle (even though it only 
promises a Rectangle2D). The alternative here would be to cast the 
result of modelToView2D to a Rectangle, but I found that less attractive.

* In JTreeTable.java, I've replaced the use of the old-style modifier 
mask with the new-style extended modifier mask. To the best of my 
understanding, this will just work the same for the code here (and for 
the MouseEvent constructor, using the extended mask is actually prescribed).

Bug: https://bugs.openjdk.java.net/browse/JDK-8242808
WebRev: 
http://cr.openjdk.java.net/~ihse/JDK-8242808-fix-all-SA-deprecation/webrev.01




More information about the build-dev mailing list