--- a/JavaBehavior.st Wed Nov 06 23:33:26 2013 +0000
+++ b/JavaBehavior.st Wed Nov 06 23:40:41 2013 +0000
@@ -199,9 +199,10 @@
"
return true if this class has multiple coexisting versions
"
- ^ (accessFlags bitAnd:ACX_HASMULTIVERS) ~~ 1
+ ^ ((accessFlags bitAnd:ACX_HASMULTIVERS) == 0) not.
"Created: / 02-10-2013 / 21:48:24 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+ "Modified: / 28-10-2013 / 13:01:32 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
!
makeObsolete
@@ -212,28 +213,28 @@
markMultipleVersions
"
- mark this class cacheable - references to this class don't have to be
- resolved over and over again, but can be cached."
+ mark this class non cacheable - references to this class have to be
+ resolved over and over again, cannot be cached."
- (accessFlags bitAnd: ACX_HASMULTIVERS) ~~ 1 ifTrue: [
+ self hasMultipleVersions not ifTrue: [
accessFlags := accessFlags bitXor: ACX_HASMULTIVERS
].
"Created: / 14-04-2013 / 14:17:38 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
- "Modified: / 02-10-2013 / 21:40:19 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+ "Modified (comment): / 28-10-2013 / 14:07:35 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
!
markNonMultipleVersions
"
- mark this class non cacheable - references to this class have to be
- resolved over and over again, because multiple versions of this class exist."
+ mark this class cacheable - references to this class dont have to be
+ resolved over and over again, can be cached."
- (accessFlags bitAnd: ACX_HASMULTIVERS) ~~ 0 ifTrue: [
+ self hasMultipleVersions ifTrue: [
accessFlags := accessFlags bitXor: ACX_HASMULTIVERS
].
"Created: / 14-04-2013 / 14:25:23 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
- "Modified (format): / 02-10-2013 / 21:47:26 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+ "Modified (comment): / 28-10-2013 / 14:07:59 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
!
markUninitialized
--- a/Make.proto Wed Nov 06 23:33:26 2013 +0000
+++ b/Make.proto Wed Nov 06 23:40:41 2013 +0000
@@ -21,7 +21,7 @@
INCLUDE_TOP=$(TOP)/..
# subdirectories where targets are to be made:
-SUBDIRS= experiments tools
+SUBDIRS= tools experiments
# subdirectories where Makefiles are to be made:
--- a/experiments/JavaClassReloaderTests.st Wed Nov 06 23:33:26 2013 +0000
+++ b/experiments/JavaClassReloaderTests.st Wed Nov 06 23:40:41 2013 +0000
@@ -267,6 +267,9 @@
return 1;
}
}'.
+
+ self assert: jclass1 hasMultipleVersions not message: 'java class should not have multiple versions initially'.
+
jinst1 := jclass1 new.
jclass2 := self
compileAndRegister: '
@@ -296,7 +299,7 @@
"Created: / 09-04-2013 / 15:00:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 09-04-2013 / 16:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 12-10-2013 / 18:16:50 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+ "Modified: / 28-10-2013 / 12:51:20 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
!
test_fields_00b
@@ -853,6 +856,81 @@
"Created: / 11-04-2013 / 10:41:52 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
"Modified (format): / 13-10-2013 / 21:05:17 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
"Modified: / 15-10-2013 / 00:03:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_fields_in_parent_01a
+ "
+ 1) compile Parent class with one public field
+ 2) subclass it by Child
+ 3) add field to parent
+ 4) check that Child has multivers
+ "
+
+ | parentClass parentClass2 childClass |
+
+ parentClass := self compileAndRegister:'
+public class test_fields_in_parent_01a {
+ public String foo = "foo";
+}'.
+
+ childClass := self compileAndRegister:'
+public class test_fields_in_parent_01a_child extends test_fields_in_parent_01a {
+}'.
+
+ self assert: childClass hasMultipleVersions not.
+
+ parentClass2 := self compileAndRegister:'
+public class test_fields_in_parent_01a {
+ public String bar = "bar";
+ public String foo = "foo";
+}'.
+
+ self assert: childClass hasMultipleVersions.
+
+ "Created: / 28-10-2013 / 12:41:18 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+! !
+
+!JavaClassReloaderTests methodsFor:'tests - garbage versions'!
+
+test_old_versions_cleaned_01
+ "
+ 1) compile simple class with one public field
+ 2) compile new version - add second field after the first one
+ 3) check that both versions exist after GC
+ 4) throw away the reference to the first version
+ 5) check only second version exists after GC
+ "
+
+ | jclass1 jinst1 jclass2 jinst2 |
+
+ jclass1 := self compileAndRegister:'
+public class test_old_versions_cleaned_01 {
+ public String foo = "foo";
+}'.
+ jinst1 := jclass1 new.
+
+ jclass2 := self compileAndRegister:'
+public class test_old_versions_cleaned_01 {
+ public String foo = "foo+bar";
+ public String bar = "foo+bar";
+}'.
+ jinst2 := jclass2 new.
+
+ObjectMemory garbageCollect.
+ObjectMemory scavenge.
+
+ self assert: jclass1 hasMultipleVersions.
+ self assert: jclass2 hasMultipleVersions.
+
+ jclass1 := nil.
+ jinst1 := nil.
+
+ ObjectMemory garbageCollect.
+ ObjectMemory scavenge.
+
+ self assert: jclass2 hasMultipleVersions not.
+
+ "Created: / 28-10-2013 / 12:28:50 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
! !
!JavaClassReloaderTests methodsFor:'tests - hierarchy'!
--- a/experiments/experiments.rc Wed Nov 06 23:33:26 2013 +0000
+++ b/experiments/experiments.rc Wed Nov 06 23:40:41 2013 +0000
@@ -3,7 +3,7 @@
// automagically generated from the projectDefinition: stx_libjava_experiments.
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,2,32767,32767
+ FILEVERSION 6,2,1,5
PRODUCTVERSION 6,2,3,0
#if (__BORLANDC__)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
BEGIN
VALUE "CompanyName", "eXept Software AG\0"
VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
- VALUE "FileVersion", "6.2.32767.32767\0"
+ VALUE "FileVersion", "6.2.1.5\0"
VALUE "InternalName", "stx:libjava/experiments\0"
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2013\nCopyright eXept Software AG 1998-2013\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.0\0"
- VALUE "ProductDate", "Wed, 16 Oct 2013 12:36:51 GMT\0"
+ VALUE "ProductDate", "Mon, 28 Oct 2013 14:36:21 GMT\0"
END
END
--- a/libjava.rc Wed Nov 06 23:33:26 2013 +0000
+++ b/libjava.rc Wed Nov 06 23:40:41 2013 +0000
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\n SWING Research Group, Czech Technical University In Prague\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.0\0"
- VALUE "ProductDate", "Tue, 05 Nov 2013 13:48:49 GMT\0"
+ VALUE "ProductDate", "Mon, 28 Oct 2013 13:08:32 GMT\0"
END
END
--- a/stx_libjava.st Wed Nov 06 23:33:26 2013 +0000
+++ b/stx_libjava.st Wed Nov 06 23:40:41 2013 +0000
@@ -193,8 +193,8 @@
for those, redefine requiredPrerequisites"
^ #(
+ #'stx:libjava/tools'
#'stx:libjava/experiments'
- #'stx:libjava/tools'
)
! !