"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
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.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
"{ Package: 'stx:libjava' }"
Object subclass:#JavaNameAndType2
instanceVariableNames:'constantPool nameIndex descriptorIndex nameCache descriptorCache'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
!
!JavaNameAndType2 class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
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.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
!
documentation
"
I represent NameAndTypeInfo structure found in java constant pool.
[author:]
Marcel Hlopko <hlopkmar@fel.cvut.cz>
[instance variables:]
name - string found in constant pool at nameIndex. Represents field or method name.
descriptor - string found in constant pool at descIndex. Represents field or method type.
[class variables:]
[see also:]
"
! !
!JavaNameAndType2 class methodsFor:'instance creation'!
in: aJavaConstantPool withNameAt: arg1 andDescriptorAt: arg2
"Create & return a new instance for arg."
^ self basicNew
initializeIn: aJavaConstantPool
withNameAt: arg1
andDescriptorAt: arg2
"Created: / 10-05-2011 / 15:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'accessing'!
constantPool
^constantPool.
"Created: / 10-05-2011 / 17:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
constantPool: aJavaConstantPool
constantPool := aJavaConstantPool.
"Created: / 10-05-2011 / 17:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
descriptor
^constantPool at: descriptorIndex.
"Created: / 08-04-2011 / 11:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 12-05-2011 / 18:51:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
name
^ constantPool at: nameIndex.
"Created: / 08-04-2011 / 11:55:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 12-05-2011 / 18:42:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
owner
^ constantPool owner.
"Created: / 12-05-2011 / 18:43:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
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: / 12-05-2011 / 18:51:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'backward compatibility'!
isUnresolved
^false.
"Created: / 13-05-2011 / 18:43:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
signature
^self descriptor.
"Created: / 13-05-2011 / 18:45:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'comparing'!
= aNameAndType
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
^ 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'!
initializeIn: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: descriptorCPIndex
nameIndex := nameCPIndex.
descriptorIndex := descriptorCPIndex.
constantPool := aJavaConstantPool.
super initialize.
"Created: / 10-05-2011 / 15:45:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'logging'!
info: arg
Transcript show: arg printString.
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
warning: arg
Transcript show: arg printString.
"Created: / 10-05-2011 / 15:01:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'printing'!
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'!
isJavaNameAndType
"return true, if given object represents name and type struct in java constant pool"
^ true.
"Created: / 10-05-2011 / 12:23:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
isNewJavaNameAndType
"only temporary, to know if name and type is old (claus' version) or new (m version)"
^ true.
"Created: / 10-05-2011 / 12:24:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 methodsFor:'resolving'!
resolve
nameCache := constantPool at: nameIndex.
descriptorCache := constantPool at: descriptorIndex.
(nameCache isNil or: [ descriptorCache isNil ])
ifTrue: [ self breakPoint: #mh ].
^self.
"Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
updateClassRefsFrom: oldOwner to: newOwner
self owner = oldOwner ifTrue: [
self owner: newOwner.
].
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 04-06-2011 / 18:40:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaNameAndType2 class methodsFor:'documentation'!
version_SVN
^ '$Id: JavaNameAndType2.st,v 1.1 2011-08-18 19:06:53 vrany Exp $'
! !