src/JavaStringRef2.st
author vranyj1
Wed, 22 Feb 2012 22:30:38 +0000
branchjk_new_structure
changeset 1376 c4b2cf1467c3
parent 1372 dea574a1b6b3
child 1378 9d64d8357509
permissions -rw-r--r--
Fixes for Groovy and class reloading

"
 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' }"

JavaRef2 subclass:#JavaStringRef2
	instanceVariableNames:'valueIndex'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Java-Reader-Support-new'
!

!JavaStringRef2 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

"
! !

!JavaStringRef2 class methodsFor:'instance creation'!

in: aJavaConstantPool withValueAt: valueIndex 
^ self basicNew initializeIn: aJavaConstantPool withValueAt: valueIndex.

"Created: / 10-05-2011 / 14:56:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !

!JavaStringRef2 methodsFor:'accessing'!

= another 
    another isJavaRef ifFalse: [ ^ false ].
    constantPool = another constantPool ifFalse: [ ^ false ].
    valueIndex = another valueIndex ifFalse: [ ^ false ].
    ^ true.

    "Created: / 13-05-2011 / 17:19:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!

findResolvedStaticValue
   ^ self findResolvedValue.

    "Created: / 13-05-2011 / 17:20:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!

findResolvedValue
    valueCache := JavaVM javaStringObjectForString:(constantPool at: valueIndex) interned: true. 
    ^ valueCache.

    "Created: / 13-05-2011 / 17:21:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
    "Modified: / 03-12-2011 / 12:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

hash
    ^ constantPool hash bitXor: valueIndex hash.

    "Created: / 13-05-2011 / 17:20:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!

invalidateForClass: internalJavaClassName
   "Invalidates receiver iff it refers (even indirectly)
    to a class ref that has been resolved to given class.
    Returns true, if the receiver has been invalidated,
    false otherwise"

    ^false

    "Created: / 13-05-2011 / 17:22:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
    "Modified: / 22-02-2012 / 20:52:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

name
    "dont use me, I'm here just because marcel was not sure he found and fixed all senders"
    self breakPoint: #mh.
    ^ constantPool at: valueIndex.

    "Created: / 13-05-2011 / 17:23:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!

value
    ^ constantPool at: valueIndex.

    "Created: / 13-05-2011 / 17:23:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !

!JavaStringRef2 methodsFor:'initialization'!

initializeIn: aJavaConstantPool withValueAt: valueCPIndex 
valueIndex := valueCPIndex.
constantPool := aJavaConstantPool.
    super initialize.
! !

!JavaStringRef2 methodsFor:'printing'!

displayString
    "superclass JavaRef2 says that I am responsible to implement this method"
    
    ^ 'StringRef: ' , (constantPool at: valueIndex).

    "Modified: / 03-11-2011 / 12:44:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !

!JavaStringRef2 methodsFor:'queries'!

isJavaClassOrStringRef
^ true.

"Created: / 11-04-2011 / 19:10:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !

!JavaStringRef2 methodsFor:'resolving'!

resolve:init
    "There is no notion of initialization of strings. do
     plain resolve here"
    ^self resolve.

    "Modified: / 03-12-2011 / 12:24:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaStringRef2 class methodsFor:'documentation'!

version_SVN
    ^ '$Id$'
! !