--- a/JavaClassRegistry.st Thu Oct 17 02:24:37 2013 +0100
+++ b/JavaClassRegistry.st Thu Oct 17 11:11:56 2013 +0100
@@ -313,7 +313,6 @@
self assert: (newClass binaryName includes: $.) not.
loaders keysAndValuesDo:[:loader :classesPerLoader|
-
(classesPerLoader includesKey: newClass binaryName) ifTrue:[
loader == newClass classLoader ifTrue:[
(oldClass := classesPerLoader at: newClass binaryName) ~~ newClass ifTrue:[
@@ -340,11 +339,16 @@
classes := loaders at: newClass classLoader put: Dictionary new.
].
classes at: newClass binaryName put: newClass.
+ "/ There may be classes already loaded with compile errors.
+ "/ Try to recompile all erroneous classes that depends on this one...
+ JavaCompiler notNil ifTrue:[
+ JavaCompiler recompileErroneousClassesReferringTo: newClass ignoring: newClass.
+ ].
self registerClassInSmalltalk: newClass notify: true.
"Created: / 23-10-2011 / 11:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 02-11-2011 / 18:40:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 16-09-2013 / 13:54:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-10-2013 / 10:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
registerClassInSmalltalk: javaclass notify: doNotify
@@ -431,22 +435,30 @@
(classes includesKey: oldClass binaryName) ifTrue:[
classes removeKey: oldClass binaryName.
"/ Now, invalidate references and unload all dependent clases
- "/ (JavaClassReloader will unload them bu recursively call #unregisterClass:
+ "/ (JavaClassReloader will unload them by recursively call #unregisterClass:
JavaClassReloader unload: oldClass.
]
].
"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>"
!
unregisterClassInSmalltalk: javaclass notify: doNotify
"Unregisters given class from Smalltalk system dictionary
so the class is no longer visible from Smalltalk"
- | nameInSmalltalk nameInSmalltalkSymbol |
+ | nameInSmalltalk nameInSmalltalkSymbol nameSpace |
+
+ "/ Must wait here - if classes are added and removed too fast,
+ "/ a race condition occur in stx:libbasic code (something is
+ "/ nilled menawhile and event handler does not handle this case.
+ "/ This can happen for example when running tests...
+ notifier waitUntilProcessed.
javaclass isSynthetic ifTrue:[ ^ self ].
+ nameSpace := javaclass nameSpace.
nameInSmalltalk := javaclass nameInSmalltalk.
nameInSmalltalkSymbol := nameInSmalltalk asSymbolIfInterned.
nameInSmalltalkSymbol notNil ifTrue:[
@@ -456,14 +468,24 @@
notifier add:(Array with: #classRemove with: javaclass).
].
+ [ nameSpace notNil and:[nameSpace ~~ JAVA and:[nameSpace allClasses size == 0]]] whileTrue:[
+ Smalltalk removeClass: nameSpace.
+ nameSpace := nameSpace nameSpace.
+ ].
+
"Created: / 04-04-2012 / 10:01:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 14-09-2013 / 23:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-10-2013 / 10:50:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
unregisterClassLoader: aJavaClassLoader
- loaders removeKey: aJavaClassLoader ifAbsent: nil.
+ | classes |
+
+ classes := loaders at: aJavaClassLoader ifAbsent:[ ^ self ].
+ self unregisterClasses: classes values.
+ loaders removeKey: aJavaClassLoader.
"Created: / 16-12-2012 / 16:39:45 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+ "Modified: / 17-10-2013 / 10:37:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
unregisterClasses: classes