RFR: JDK-8242629 Remove references to deprecated java.util.Observer and Observable

Chris Plummer chris.plummer at oracle.com
Tue Apr 14 19:13:27 UTC 2020


Hi Magnus,

Some minor mistakes below, but otherwise looks good. Also copyrights 
need updating. I don't need to see another webrev.

thanks,

Chris

--- 
old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/MethodHandlesAdapterBlob.java 
2020-04-14 12:47:05.098156117 +0200
+++ 
new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/MethodHandlesAdapterBlob.java 
2020-04-14 12:47:04.774156119 +0200
@@ -28,6 +28,10 @@
  import sun.jvm.hotspot.debugger.*;
  import sun.jvm.hotspot.runtime.*;
  import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;

--- 
old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java 
2020-04-14 12:48:16.314155591 +0200
+++ 
new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java 
2020-04-14 12:48:15.962155594 +0200
@@ -33,6 +33,12 @@
  import sun.jvm.hotspot.runtime.*;
  import sun.jvm.hotspot.types.*;
  import sun.jvm.hotspot.utilities.*;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;

--- 
old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java 
2020-04-14 12:49:58.998154834 +0200
+++ 
new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java 
2020-04-14 12:49:58.674154836 +0200
@@ -29,6 +29,10 @@
  import sun.jvm.hotspot.runtime.*;
  import sun.jvm.hotspot.oops.*;
  import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;
+import sun.jvm.hotspot.utilities.Observable;
+import sun.jvm.hotspot.utilities.Observer;

+++ 
new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/Observable.java 
2020-04-14 12:50:10.634154748 +0200
...
\ No newline at end of file


On 4/14/20 4:04 AM, Magnus Ihse Bursie wrote:
> As a first step towards fixing deprecation warnings in SA, all the 
> references (200+) to the deprecated java.util.Observer and Observable 
> needs to be fixed, otherwise all other changes will drown in this one.
>
> This solution is the result of the preceding discussions in 
> serviceability-dev. That means that most of the change consists of 
> adding an explicit import like this:
>
> import sun.jvm.hotspot.utilities.Observable;
> import sun.jvm.hotspot.utilities.Observer;
>
> to override the general java.util.* import that was already present in 
> all (or almost all) files, and make 
> sun.jvm.hotspot.utilities.Observable and Observer extend the java.util 
> versions but with deprecation warnings disabled.
>
> It turned out however, that this simplest approach did not work fully. 
> Since the interface java.util.Observer had the single method "void 
> update(java.util.Observable o, Object arg)" it did not help to create 
> a new interface sun.jvm.hotspot.utilities.Observer that extended 
> java.util.Observer. I did not observe this issue in my PoC webrev that 
> I posted during the discussion. :-(
>
> Instead, for Observer, I had just created a new interface with the 
> same method, but that uses sun.jvm.hotspot.utilities.Observable 
> instead of java.util.Observable.
>
> The end effect is the same -- the only change needed to most files is 
> an added import, we get rid of the deprecation warnings, and we did 
> not have to copy any significant amount of code from java.util.
>
> I now hope this is acceptable by all.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8242629
> WebRev: 
> http://cr.openjdk.java.net/~ihse/JDK-8242629-fix-SA-Observer/webrev.01
>
> (When reading the patch, I recommend looking at the patch file 
> http://cr.openjdk.java.net/~ihse/JDK-8242629-fix-SA-Observer/webrev.01/open.patch 
> instead of individually checking the files in the webrev.)
>
> /Magnus





More information about the build-dev mailing list