"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
New code and modifications done at SWING Research Group [1]:
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
[1] Code written at SWING Research Group contains a signature
of one of the above copright owners. For exact set of such code,
see the differences between this version and version stx:libjava
as of 1.9.2010
"
"{ Package: 'stx:libjava' }"
JavaClassContentRef2 subclass:#JavaFieldRef2
instanceVariableNames:'offset type'
classVariableNames:'T_LONG T_DOUBLE'
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
!
!JavaFieldRef2 class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
New code and modifications done at SWING Research Group [1]:
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
[1] Code written at SWING Research Group contains a signature
of one of the above copright owners. For exact set of such code,
see the differences between this version and version stx:libjava
as of 1.9.2010
"
! !
!JavaFieldRef2 class methodsFor:'initialization'!
initialize
T_LONG := 1.
T_DOUBLE := 2.
"Created: / 15-05-2011 / 22:31:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaFieldRef2 methodsFor:'accessing'!
isJavaFieldRef
^true.
"Created: / 11-04-2011 / 21:47:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
offset
^ offset.
"Created: / 15-05-2011 / 22:26:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
type
type == T_LONG ifTrue: [ ^ #long. ].
type == T_DOUBLE ifTrue: [ ^ #double ].
^ type.
"Created: / 15-05-2011 / 22:29:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaFieldRef2 methodsFor:'private - resolving'!
findInstOffset
"fieldRef must be resolved before calling me"
self assert: classCache notNil.
self assert: valueCache notNil.
^ classCache instVarOffsetOf: self name.
"Created: / 07-12-2011 / 13:44:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
findResolvedStaticValue
self findResolvedValue.
"Created: / 28-04-2011 / 22:05:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 03-12-2011 / 12:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-12-2011 / 13:37:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
findResolvedValue: doClassInit
valueCache := JavaResolver uniqueInstance
resolveFieldIndentifiedByRef: self.
valueCache isStatic ifTrue: [ classCache := valueCache javaClass ] ifFalse: [
classCache := (constantPool at: classRefIndex) resolve: doClassInit.
].
classCache isNil ifTrue: [ self breakPoint: #mh ].
self resolveOffset.
nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
self resolveType.
nameAndTypeCache isNil ifTrue: [ self breakPoint: #mh ].
"Modified: / 07-12-2011 / 21:52:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Created: / 09-02-2012 / 23:09:18 / mh <hlopik@gmail.com>"
"Modified: / 16-10-2012 / 10:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
findStaticOffset
"fieldRef must be resolved before calling me"
self assert: classCache notNil.
self assert: valueCache notNil.
^ classCache class instVarOffsetOf: self name.
"Created: / 07-12-2011 / 13:45:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
preResolve
self resolveType
"Created: / 16-10-2012 / 10:45:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
resolveOffset
"fieldRef must be resolved before calling me"
self assert: valueCache notNil.
self assert: classCache isJavaClass.
valueCache isStatic ifTrue: [ offset := self findStaticOffset. ] ifFalse: [
offset := self findInstOffset.
].
self assert: offset notNil.
"Modified: / 07-12-2011 / 21:47:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
resolveStaticOffset
"fieldRef must be resolved before calling me"
| currentClass |
currentClass := classCache.
self assert: (currentClass class instVarNames includes: self name).
offset := currentClass class instVarOffsetOf: self name.
"Modified: / 07-12-2011 / 13:38:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
resolveType
type := JavaMethod typeFromSignature:((constantPool at: nameAndTypeIndex) descriptor) in:nil.
type == #long ifTrue:[
type := T_LONG.
] ifFalse:[
type == #double ifTrue:[
type := T_DOUBLE
]
].
"Created: / 15-05-2011 / 22:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaFieldRef2 class methodsFor:'documentation'!
version_CVS
^ '$Header$'
!
version_HG
^ '$Changeset: <not expanded> $'
!
version_SVN
^ '§Id§'
! !
JavaFieldRef2 initialize!