JavaClassRegistry.st
changeset 3217 261bad2a9657
parent 3216 1d977d2d3abb
child 3235 6a5d85f29c3a
--- a/JavaClassRegistry.st	Mon Aug 11 01:55:40 2014 +0100
+++ b/JavaClassRegistry.st	Mon Aug 11 09:46:49 2014 +0100
@@ -402,23 +402,26 @@
 unregisterClass: oldClass
     | classes |
 
-    "/ First. remove the class from system dictionary
-    "/ and from registry so nobody could resolve it.
-    self unregisterClassInSmalltalk: oldClass notify: true.
     classes := loaders at: oldClass classLoader ifAbsent: nil.
     classes notNil ifTrue:[
         "/ Check if the class is there, it could be removed meanwhile...
         (classes includesKey: oldClass binaryName) ifTrue:[
-            classes removeKey: oldClass binaryName.
             "/ Now, invalidate references and unload all dependent clases
             "/ (JavaClassReloader will unload them by recursively call #unregisterClass:
             JavaClassReloader unload: oldClass.
+            "/ Now remove it from class registry...
+            classes removeKey: oldClass binaryName.
+            "/ ...from class loader...
+            self unregisterClassInClassLoader: oldClass.  
+            "/ ...from reflection cache....
+            JavaVM reflection removeJavaClassObjectForClass: oldClass.
+            "/ ...and from Smalltalk dictionary
+            self unregisterClassInSmalltalk: oldClass notify: true.
         ]
     ].
 
     "Created: / 04-04-2012 / 02:43:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 14-09-2013 / 23:41:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 17-10-2013 / 02:25:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-08-2014 / 01:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 unregisterClassLoader: aJavaClassLoader