--- a/JavaClass.st Tue Aug 05 12:03:28 2014 +0100
+++ b/JavaClass.st Tue Aug 05 20:42:52 2014 +0100
@@ -621,9 +621,11 @@
!
annotations
- ^ annotations ifNil:[JavaClassAnnotationContainer empty].
-
- "Modified: / 03-03-2011 / 22:52:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ ^ annotations isNil ifTrue:[
+ JavaClassAnnotationContainer empty
+ ].
+
+ "Modified: / 04-08-2014 / 15:54:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
annotations:something
@@ -741,11 +743,14 @@
!
ensureHasAnnotations
- annotations ifNil: [ annotations := JavaAnnotationContainer for: self ].
+ annotations isNil ifTrue:[
+ annotations := JavaAnnotationContainer for:self
+ ].
^ annotations
"Created: / 25-02-2011 / 16:02:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-03-2011 / 17:13:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fields
@@ -888,11 +893,16 @@
!
runtimeVisibleAnnotationsAsBytesOrNil
- annotations ifNil:[ ^ nil ].
- annotations runtimeVisible ifNil:[ ^ nil ].
+ annotations isNil ifTrue:[
+ ^ nil
+ ].
+ annotations runtimeVisible isNil ifTrue:[
+ ^ nil
+ ].
^ annotations runtimeVisible bytes
"Created: / 25-02-2011 / 16:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:54:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setSignature: aSymbol
@@ -1619,7 +1629,17 @@
(((accessFlags bitAnd: ACX_INITIALIZED) == 0) and:[(accessFlags bitAnd: ACX_INITIALIZING) == 0]) ifTrue: [
accessFlags := accessFlags bitOr: ACX_INITIALIZING.
superclass ~~ JavaObject ifTrue: [ superclass classInit ].
- "JV@2011-12-03: Also call initializeStaticFields"
+
+ "JV@2014-08-04: Flush caches here."
+ "/ Class reader does not flush caches, instead caches are flushed
+ "/ here, at the very last moment, when a class is actually initialized. This should
+ "/ be sufficent as an object cannot be sent a message unless a class is
+ "/ initialized first. This saves us a little bit of time when reading classes
+ "/ but cost time when initializing the class, so normally this is not much
+ "/ of a saving. However, this helps in cases Java class is only read into memory
+ "/ and never initialized - that's what JBrowser Workspace does.
+ ObjectMemory flushCaches.
+ "JV@2011-12-03: Also call initializeStaticFields"
self initializeStaticFields.
m := self compiledMethodAt: #'<clinit>()V'.
m notNil ifTrue: [
@@ -1656,7 +1676,7 @@
"Modified: / 12-11-1998 / 15:41:11 / cg"
"Modified: / 18-08-2011 / 19:37:33 / jv"
"Modified: / 08-12-2011 / 21:05:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 08-12-2013 / 22:28:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 04-08-2014 / 17:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
classInitInternal