refactoring tests.. and more needed
--- a/src/AbstractJavaTestCase.st Thu May 12 17:22:54 2011 +0000
+++ b/src/AbstractJavaTestCase.st Fri May 13 06:55:55 2011 +0000
@@ -38,6 +38,12 @@
"Created: / 10-05-2011 / 15:03:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
+getClassRefIn: aJavaConstantPool withNameAt: nameCPIndex
+^ JavaClassRef2 in: aJavaConstantPool withNameAt: nameCPIndex.
+
+ "Created: / 12-05-2011 / 19:14:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
getCrateClassReadStream
^ ((Filename named: UserPreferences current javaTestsDirectory)
/ 'libjava' / 'bin'
@@ -56,18 +62,32 @@
andDescriptorAt: 2.
"Created: / 10-05-2011 / 16:01:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getNameAndTypeIn: aJavaConstantPool nameAt: nameCPIndex typeAt: typeCPIndex
+ ^ JavaNameAndType2 in: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: typeCPIndex.
+
+ "Created: / 12-05-2011 / 19:15:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+javaLangObject
+^Java classForName:'java.lang.Object'.
+
+ "Created: / 12-05-2011 / 19:09:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!AbstractJavaTestCase methodsFor:'running'!
setUp
JavaClassReader useNewClassReader.
+ self enableMockedExceptionThrowing.
"Created: / 12-05-2011 / 17:30:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
tearDown
JavaClassReader useOldClassReader.
+ self disableMockedExceptionThrowing.
"Created: / 12-05-2011 / 17:30:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
--- a/src/JavaClassContentRef2.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaClassContentRef2.st Fri May 13 06:55:55 2011 +0000
@@ -1,7 +1,7 @@
"{ Package: 'stx:libjava' }"
JavaRef2 subclass:#JavaClassContentRef2
- instanceVariableNames:'classRef nameAndType'
+ instanceVariableNames:'classRefIndex nameAndTypeIndex'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
@@ -10,42 +10,49 @@
!JavaClassContentRef2 class methodsFor:'instance creation'!
-in: aJavaConstantPool namedAndTyped: arg1 inClassIdentifiedByRef: arg2
- "Create & return a new instance for arg."
-
- ^ self basicNew initializeIn: aJavaConstantPool namedAndTyped: arg1 inClassIdentifiedByRef: arg2
+in: aJavaConstantPool withNameAndTypeAt: nameAndTypeCPIndex andClassAt: classRefCPIndex
+ ^ self basicNew
+ initializeIn: aJavaConstantPool
+ withNameAndTypeAt: nameAndTypeCPIndex
+ andClassAt: classRefCPIndex.
- "Created: / 10-05-2011 / 16:18:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-05-2011 / 18:36:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassContentRef2 methodsFor:'accessing'!
classRef
- ^ classRef
+ ^ constantPool at: classRefIndex.
+
+ "Modified: / 12-05-2011 / 18:38:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
descriptor
- ^ nameAndType descriptor.
+ ^ self nameAndType descriptor.
"Created: / 08-04-2011 / 15:08:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
name
- ^ nameAndType name.
+ ^ self nameAndType name.
"Created: / 08-04-2011 / 13:54:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
nameAndType
-^ nameAndType.
+ ^ constantPool at: nameAndTypeIndex.
"Created: / 11-04-2011 / 19:57:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
selector
- ^ nameAndType selector.
+ ^ self nameAndType selector.
"Created: / 11-04-2011 / 20:38:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassContentRef2 methodsFor:'comparing'!
@@ -64,44 +71,47 @@
!JavaClassContentRef2 methodsFor:'initialization'!
-initializeIn: aJavaConstantPool namedAndTyped: aNameAndType inClassIdentifiedByRef: aJavaClassRef
-constantPool := aJavaConstantPool.
-classRef := aJavaClassRef.
- nameAndType := aNameAndType.
+initializeIn: aJavaConstantPool withNameAndTypeAt: nameAndTypeCPIndex andClassAt: classRefCPIndex
+ constantPool := aJavaConstantPool.
+ classRefIndex := classRefCPIndex.
+ nameAndTypeIndex := nameAndTypeCPIndex.
super initialize.
- "Created: / 10-05-2011 / 16:18:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-05-2011 / 18:37:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassContentRef2 methodsFor:'printing'!
printString
- ^ 'JavaClassContentRef: class=[' , classRef printString , '] name=['
- , nameAndType printString , ']'.
+ ^ 'JavaClassContentRef: class=[' , self classRef printString , '] name=['
+ , self nameAndType printString , ']'.
"Created: / 10-05-2011 / 14:15:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:40:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassContentRef2 methodsFor:'resolving'!
invalidate
- classRef invalidate.
- nameAndType invalidate.
+ self classRef invalidate.
+ self nameAndType invalidate.
super invalidate.
"Created: / 13-04-2011 / 12:21:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 17:22:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:40:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
invalidateForClass: internalJavaClassName
"Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
Return true, if reference was invalidated."
- (classRef invalidateForClass: internalJavaClassName)
- ifTrue: [ self invalidate. ^ true ].
- ^ false.
+ (self classRef invalidateForClass: internalJavaClassName)
+ ifTrue:
+ [ self invalidate.
+ ^ true ].
+ ^ false.
- "Modified: / 08-04-2011 / 16:05:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:40:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassContentRef2 class methodsFor:'documentation'!
--- a/src/JavaClassReader2.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaClassReader2.st Fri May 13 06:55:55 2011 +0000
@@ -34,63 +34,52 @@
!
readConstant_Fieldref
- | classIndex nameAndTypeIndex class nameAndType |
-
- classIndex := inStream nextUnsignedShortMSB: msb.
- nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
- class := constants at: classIndex.
- nameAndType := constants at: nameAndTypeIndex.
- self
- info: 'reading fieldref; classindex=' , classIndex printString , ' class='
- , class printString , ' nameAndTypeIndex='
- , nameAndTypeIndex printString , ' nameAndType='
- , nameAndType printString.
- ^ JavaFieldRef2
- in: constants
- namedAndTyped: nameAndType
- inClassIdentifiedByRef: class.
-
- "Modified: / 10-05-2011 / 17:09:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-readConstant_InterfaceMethodref
- | classIndex nameAndTypeIndex class nameAndType |
+ | classIndex nameAndTypeIndex |
classIndex := inStream nextUnsignedShortMSB: msb.
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
- class := constants at: classIndex.
- nameAndType := constants at: nameAndTypeIndex.
self
- info: 'reading interface methodref; classindex=' , classIndex printString
- , ' class=' , class printString
- , ' nameAndTypeIndex=' , nameAndTypeIndex printString
- , ' nameAndType=' , nameAndType printString.
+ info: 'reading fieldref; classindex=' , classIndex printString , ' nameAndTypeIndex='
+ , nameAndTypeIndex printString.
+ ^ JavaFieldRef2
+ in: constants
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classIndex.
+
+ "Modified: / 12-05-2011 / 18:55:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+readConstant_InterfaceMethodref
+ | classIndex nameAndTypeIndex |
+
+ classIndex := inStream nextUnsignedShortMSB: msb.
+ nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
+ self
+ info: 'reading interface methodref; classindex=' , classIndex printString
+ , ' nameAndTypeIndex=' , nameAndTypeIndex printString.
^ JavaInterfaceMethodRef2
- in: constants
- namedAndTyped: nameAndType
- inClassIdentifiedByRef: class.
+ in: constants
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classIndex.
- "Modified: / 10-05-2011 / 17:09:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:57:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Methodref
- | classIndex nameAndTypeIndex class nameAndType |
+ | classIndex nameAndTypeIndex |
classIndex := inStream nextUnsignedShortMSB: msb.
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
- class := constants at: classIndex.
- nameAndType := constants at: nameAndTypeIndex.
+
self
- info: 'reading methodref; classindex=' , classIndex printString , ' class='
- , class printString , ' nameAndTypeIndex='
- , nameAndTypeIndex printString , ' nameAndType='
- , nameAndType printString.
- ^ JavaMethodRef2
- in: constants
- namedAndTyped: nameAndType
- inClassIdentifiedByRef: class.
+ info: 'reading methodref; classindex=' , classIndex printString , ' nameAndTypeIndex='
+ , nameAndTypeIndex printString.
+ ^ JavaMethodRef2
+ in: constants
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classIndex.
- "Modified: / 10-05-2011 / 17:09:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:58:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_NameAndType
--- a/src/JavaClassReader2Tests.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaClassReader2Tests.st Fri May 13 06:55:55 2011 +0000
@@ -11,6 +11,7 @@
!JavaClassReader2Tests methodsFor:'tests'!
testJavaInitializationWithNewReader
+ self assert: false.
JavaClassReader useNewClassReader.
Java flushAllJavaResources.
Java initialize.
@@ -18,7 +19,7 @@
JavaClassReader useOldClassReader.
"Created: / 09-05-2011 / 23:17:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 13:43:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:21:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testJavaInitializationWithOldReader
@@ -52,34 +53,49 @@
| reader constantPool result |
reader := JavaClassReader2 new.
- constantPool := JavaConstantPool new: 4.
- constantPool at: 1 put: (self getClassRefFor: 'class').
- constantPool at: 2 put: (self getName: 'foo' descriptor: 'bar').
+ constantPool := JavaConstantPool new: 5.
+ constantPool at: 1 put: 'class'.
+ constantPool at: 2 put: (self getClassRefIn: constantPool withNameAt: 1).
+ constantPool at: 3 put: (self
+ getNameAndTypeIn: constantPool
+ nameAt: 4
+ typeAt: 5).
+ constantPool at: 4 put: 'name'.
+ constantPool at: 5 put: 'type'.
+ constantPool owner: self javaLangObject.
reader constants: constantPool.
- reader stream: (ReadStream on: #( 1 0 2 0 )).
+ reader stream: (ReadStream on: #( 2 0 3 0 )).
result := reader readConstant_Fieldref.
self assertTrue: (result notNil).
self assertTrue: (result isJavaRef).
self assertTrue: (result isNewJavaRef).
- self assertTrue: (result classRef isNewJavaRef).
- self assertTrue: (result classRef isNewJavaRef).
+ self assertTrue: (result classRef isJavaRef).
self assertTrue: (result nameAndType isNewJavaNameAndType).
- self assertTrue: (result nameAndType name = 'foo').
- self assertTrue: (result nameAndType descriptor = 'bar').
+ self assertTrue: (result nameAndType name = 'name').
+ self assertTrue: (result nameAndType descriptor = 'type').
+ self assertTrue: (result owner = self javaLangObject).
"Created: / 10-05-2011 / 14:12:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 16:14:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 19:22:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testReadingInterfaceMethod
| reader constantPool result |
reader := JavaClassReader2 new.
- constantPool := JavaConstantPool new: 4.
- constantPool at: 1 put: (self getClassRefFor: 'class').
- constantPool at: 2 put: (self getName: 'foo' descriptor: 'bar').
+ constantPool := JavaConstantPool new: 5.
+ constantPool at: 1 put: 'class'.
+ constantPool at: 2 put: (self getClassRefIn: constantPool withNameAt: 1).
+ constantPool at: 3
+ put: (self
+ getNameAndTypeIn: constantPool
+ nameAt: 4
+ typeAt: 5).
+ constantPool at: 4 put: 'name'.
+ constantPool at: 5 put: 'type'.
+ constantPool owner: self javaLangObject.
reader constants: constantPool.
- reader stream: (ReadStream on: #( 1 0 2 0 )).
+ reader stream: (ReadStream on: #( 2 0 3 0 )).
result := reader readConstant_InterfaceMethodref.
self assertTrue: (result notNil).
self assertTrue: (result isJavaRef).
@@ -87,22 +103,32 @@
self assertTrue: (result classRef isNewJavaRef).
self assertTrue: (result classRef isNewJavaRef).
self assertTrue: (result nameAndType isNewJavaNameAndType).
- self assertTrue: (result nameAndType name = 'foo').
- self assertTrue: (result nameAndType descriptor = 'bar').
+ self assertTrue: (result nameAndType name = 'name').
+ self assertTrue: (result nameAndType descriptor = 'type').
+ self assertTrue: (result owner = self javaLangObject).
+ self assertTrue: (result owner = self javaLangObject).
"Created: / 10-05-2011 / 14:12:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 16:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 19:24:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testReadingMethod
| reader constantPool result |
reader := JavaClassReader2 new.
- constantPool := JavaConstantPool new: 4.
- constantPool at: 1 put: (self getClassRefFor: 'class').
- constantPool at: 2 put: (self getName: 'foo' descriptor: 'bar').
+ constantPool := JavaConstantPool new: 5.
+ constantPool at: 1 put: 'class'.
+ constantPool at: 2 put: (self getClassRefIn: constantPool withNameAt: 1).
+ constantPool at: 3
+ put: (self
+ getNameAndTypeIn: constantPool
+ nameAt: 4
+ typeAt: 5).
+ constantPool at: 4 put: 'name'.
+ constantPool at: 5 put: 'type'.
+ constantPool owner: self javaLangObject.
reader constants: constantPool.
- reader stream: (ReadStream on: #( 1 0 2 0 )).
+ reader stream: (ReadStream on: #( 2 0 3 0 )).
result := reader readConstant_Methodref.
self assertTrue: (result notNil).
self assertTrue: (result isJavaRef).
@@ -110,11 +136,12 @@
self assertTrue: (result classRef isNewJavaRef).
self assertTrue: (result classRef isNewJavaRef).
self assertTrue: (result nameAndType isNewJavaNameAndType).
- self assertTrue: (result nameAndType name = 'foo').
- self assertTrue: (result nameAndType descriptor = 'bar').
+ self assertTrue: (result nameAndType name = 'name').
+ self assertTrue: (result nameAndType descriptor = 'type').
+ self assertTrue: (result owner = self javaLangObject).
"Created: / 10-05-2011 / 14:10:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 16:14:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 19:24:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testReadingNameAndType
--- a/src/JavaClassRef2.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaClassRef2.st Fri May 13 06:55:55 2011 +0000
@@ -21,9 +21,10 @@
!JavaClassRef2 methodsFor:'accessing'!
classLoader
-owner ifNil:[^nil] ifNotNil:[^owner classLoader].
+ self owner ifNil: [ ^ nil ] ifNotNil: [ ^ self owner classLoader ].
"Created: / 11-04-2011 / 21:52:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:32:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
javaClassName
--- a/src/JavaClassRefTests.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaClassRefTests.st Fri May 13 06:55:55 2011 +0000
@@ -8,7 +8,7 @@
!
-!JavaClassRefTests methodsFor:'permissions tests'!
+!JavaClassRefTests methodsFor:'permission tests'!
testAccessingNonPublicFromInside
| javaClassRef initString throwedException |
--- a/src/JavaFieldRefTests.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaFieldRefTests.st Fri May 13 06:55:55 2011 +0000
@@ -330,9 +330,8 @@
initString := 'Ljava/lang/String;'.
javaClassRef := self getClassRefFor: initString.
javaClassRef owner: (Java classForName: 'java.lang.Object').
- javaFieldRef := JavaFieldRef2 in: nil
- namedAndTyped: (self getName: 'value' descriptor: '[C')
- inClassIdentifiedByRef: javaClassRef.
+ javaFieldRef := self getFieldRefwithNameAndType: (self getName: 'value' descriptor: '[C')
+ andWithClassRef: javaClassRef.
self assertTrue: (javaFieldRef isResolved not).
self assertTrue: (javaFieldRef valueCache isNil).
self assertTrue: (javaFieldRef name = 'value').
@@ -340,7 +339,7 @@
self assertTrue: (javaFieldRef classRef name = 'Ljava/lang/String;').
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 16:20:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 19:02:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testCorrectResolving
--- a/src/JavaNameAndType2.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaNameAndType2.st Fri May 13 06:55:55 2011 +0000
@@ -1,7 +1,7 @@
"{ Package: 'stx:libjava' }"
Object subclass:#JavaNameAndType2
- instanceVariableNames:'nameIndex descriptorIndex name descriptor constantPool owner'
+ instanceVariableNames:'nameIndex descriptorIndex constantPool'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
@@ -55,50 +55,53 @@
!
descriptor
- descriptor ifNil: [self resolve].
- ^ descriptor.
+ ^constantPool at: descriptorIndex.
"Created: / 08-04-2011 / 11:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 15:46:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:51:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
name
- name ifNil: [self resolve].
- ^ name.
+ ^ constantPool at: nameIndex.
"Created: / 08-04-2011 / 11:55:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 15:49:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:42:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
owner
- ^ owner
-!
+ ^ constantPool owner.
-owner:something
- owner := something.
+ "Created: / 12-05-2011 / 18:43:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
-selector
- self isResolved ifFalse: [ self resolve ].
- ^ (name , descriptor) asSymbol.
+owner: javaClass
+ constantPool owner: javaClass.
+
+ "Created: / 12-05-2011 / 18:43:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+selector
+ ^ (self name , self descriptor) asSymbol.
"Created: / 11-04-2011 / 21:31:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 17:29:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:51:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'comparing'!
= aNameAndType
- name ~= aNameAndType name ifTrue: [ ^ false ].
- ^ descriptor = aNameAndType descriptor.
+ self name ~= aNameAndType name ifTrue: [ ^ false ].
+ ^ self descriptor = aNameAndType descriptor.
"Created: / 08-04-2011 / 11:56:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:44:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
hash
- ^ name hash bitXor: descriptor hash.
+ ^ self name hash bitXor: self descriptor hash.
"Created: / 08-04-2011 / 11:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:44:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'initialization'!
@@ -129,9 +132,11 @@
!JavaNameAndType2 methodsFor:'printing'!
printString
-^ 'JavaNameAndType name=' , name printString , ' descriptor= ' , descriptor printString.
+ ^ 'JavaNameAndType name=' , self name printString , ' descriptor= '
+ , self descriptor printString.
"Created: / 10-05-2011 / 14:17:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:44:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'queries'!
@@ -150,66 +155,17 @@
^ true.
"Created: / 10-05-2011 / 12:24:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-isResolved
- name ifNil: [^ false].
- descriptor ifNil: [^ false].
- ^ true.
-
- "Created: / 10-05-2011 / 17:27:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'resolving'!
-findResolvedStaticValue
- self halt: 'should not need - ask mh'.
-
- "Created: / 10-05-2011 / 17:26:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-findResolvedValue
- name := constantPool at: nameIndex.
- descriptor := constantPool at: descriptorIndex.
- name ifNil: [ self warning: 'name nil in ' , self printString ].
- descriptor
- ifNil: [ self warning: 'descriptor nil in ' , self printString ].
-
- "Created: / 10-05-2011 / 17:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-invalidate
- name := nil.
- descriptor := nil.
-
- "Created: / 10-05-2011 / 17:28:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-invalidateForClass: arg
- self halt: 'should not need - tell mh'.
-
- "Created: / 10-05-2011 / 17:28:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-resolve
- (name isNil or: [descriptor isNil]) ifTrue: [self findResolvedValue].
-
- "Created: / 10-05-2011 / 15:46:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 10-05-2011 / 17:28:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-resolveStatic
- ^ self resolve.
-
- "Created: / 10-05-2011 / 17:25:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
updateClassRefsFrom: oldOwner to: newOwner
- owner = oldOwner ifTrue: [ owner := newOwner. ].
+ self owner = oldOwner ifTrue: [ self owner: newOwner. ].
self info: 'updating class refs from: ' , oldOwner printString , ' to '
, newOwner printString.
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:43:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 class methodsFor:'documentation'!
--- a/src/JavaRef2.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaRef2.st Fri May 13 06:55:55 2011 +0000
@@ -1,7 +1,7 @@
"{ Package: 'stx:libjava' }"
Object subclass:#JavaRef2
- instanceVariableNames:'valueCache constantPool owner'
+ instanceVariableNames:'valueCache constantPool'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
@@ -69,11 +69,15 @@
!
owner
- ^ owner
+ ^ constantPool owner.
+
+ "Modified: / 12-05-2011 / 18:31:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
-owner:something
- owner := something.
+owner: javaClass
+ constantPool owner: javaClass.
+
+ "Modified: / 12-05-2011 / 18:32:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
valueCache
@@ -196,11 +200,12 @@
!
updateClassRefsFrom: oldOwner to: newOwner
- owner = oldOwner ifTrue: [ owner := newOwner. ].
+ self owner = oldOwner ifTrue: [ self owner: newOwner. ].
self info: 'updating class refs from: ' , oldOwner printString , ' to '
, newOwner printString.
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:31:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaRef2 class methodsFor:'documentation'!
--- a/src/JavaRuntimeConstantPoolTests.st Thu May 12 17:22:54 2011 +0000
+++ b/src/JavaRuntimeConstantPoolTests.st Fri May 13 06:55:55 2011 +0000
@@ -8,20 +8,6 @@
!
-!JavaRuntimeConstantPoolTests methodsFor:'infrastructure'!
-
-setUp
-self enableMockedExceptionThrowing.
-
- "Created: / 10-05-2011 / 16:00:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-tearDown
- self disableMockedExceptionThrowing.
-
- "Created: / 10-05-2011 / 16:00:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-! !
-
!JavaRuntimeConstantPoolTests methodsFor:'tests'!
testInvalidateAll
--- a/src/stx_libjava.st Thu May 12 17:22:54 2011 +0000
+++ b/src/stx_libjava.st Fri May 13 06:55:55 2011 +0000
@@ -364,7 +364,7 @@
"Return a SVN revision number of myself.
This number is updated after a commit"
- ^ "$SVN-Revision:"'1119M'"$"
+ ^ "$SVN-Revision:"'1119'"$"
! !
!stx_libjava class methodsFor:'file generation'!