Ignore tests in MemberVisibilityTests (package-private methods not yet supported)
"{ Package: 'stx:libjava/experiments' }"!
!Class methodsFor:'method lookup'!
box: sObj toType: type
^ (JavaTypeBox typeBoxForJava: type) box: sObj.
"Created: / 06-09-2011 / 22:12:59 / Jan Kurs <kursjan@fit.cvut.cz>"
! !
!Class methodsFor:'method lookup'!
unbox: javaArgumentsCollection to: typesCollection
" box smalltalk arguments collection to Java arguments "
"/ ^ stArgumentsCollection with: typesCollection collect: [ :stObject :javaType |
"/ (JavaTypeBox javaTypeAt: javaType) box: stObject.
"/ ]
^ javaArgumentsCollection.
"Created: / 25-09-2011 / 20:22:59 / Jan Kurs <kursjan@fit.cvut.cz>"
! !
!JavaClass methodsFor:'queries'!
javaWrappedClass
"Returns true, iff receiver is one of the Java wrapper classes or String"
name == #'java/lang/Byte' ifTrue:[^JavaByte].
name == #'java/lang/Short' ifTrue:[^JavaShort].
name == #'java/lang/Integer' ifTrue:[^SmallInteger].
name == #'java/lang/Long' ifTrue:[^LargeInteger].
name == #'java/lang/Character' ifTrue:[^Character].
name == #'java/lang/Boolean' ifTrue:[^Boolean].
name == #'java/lang/String' ifTrue:[^String].
^nil.
"Created: / 03-01-2012 / 22:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaClass methodsFor:'message sending'!
lookupMethodFor:selector
|method cls sel queue |
sel := selector asSymbolIfInterned.
sel notNil ifTrue:[
queue := OrderedCollection with: self.
[ queue isEmpty ] whileFalse:[
cls := queue removeFirst.
method := cls compiledMethodAt:sel.
method notNil ifTrue:[ ^ method ].
cls isInterface ifFalse:[
cls superclass ~~ JavaObject ifTrue:[queue add: cls superclass]
].
queue addAll: cls interfaces.
].
].
"/cls ifNotNil:[^super lookupMethodFor: selector].
^ nil
"Modified: / 19-10-2011 / 17:19:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaClass methodsFor:'message sending'!
performStatic:selector
"send a static message, without args."
|javaMethod sel|
sel := selector asSymbolIfInterned.
sel notNil ifTrue:[
javaMethod := methodDictionary at:sel.
javaMethod notNil ifTrue:[
javaMethod isStatic ifTrue:[
^ javaMethod
valueWithReceiver:self
arguments:#()
]
].
].
^ self doesNotUnderstand:(Message selector:selector)
"Modified: / 15.1.1998 / 00:31:27 / cg"
"Created: / 12.11.1998 / 16:29:20 / cg"
! !
!JavaClass methodsFor:'message sending'!
performStatic:selector with:arg
"send a static message, with one args."
|javaMethod sel|
sel := selector asSymbolIfInterned.
sel notNil ifTrue:[
javaMethod := methodDictionary at:sel.
javaMethod notNil ifTrue:[
javaMethod isStatic ifTrue:[
^ javaMethod
valueWithReceiver:self
arguments:(Array with:arg)
selector:selector
search:nil
sender:nil
]
].
].
^ self doesNotUnderstand:(Message selector:selector argument:arg)
"Modified: / 15.1.1998 / 00:31:27 / cg"
"Created: / 10.12.1998 / 21:50:29 / cg"
! !
!JavaMethodDescriptor methodsFor:'accessing'!
guardCondition
"Answers a condition usable in guard that checks if all types of all arguments matches"
| g |
self assert: parameters size ~~ 0. "/Should not be called in that case..."
g := ProxyMethodJavaTypeCheckNode type: parameters first javaClass argument: 1.
parameters size > 1 ifTrue:[
2 to: parameters size do:[:i|
g := g and: (ProxyMethodJavaTypeCheckNode type: (parameters at: i) javaClass argument: i)
].
].
^g
"Created: / 06-12-2011 / 22:27:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaObject methodsFor:'message sending'!
doesNotUnderstand:aMessage
| sender |
sender := thisContext sender.
^ self class perform: aMessage onReceiver: self from: sender ifNotFound: [ ^ super doesNotUnderstand: aMessage ].
"Modified: / 16-11-1998 / 16:50:56 / cg"
"Modified: / 19-09-2011 / 23:43:56 / Jan Kurs <kursjan@fit.cvut.cz>"
"Modified: / 15-12-2011 / 23:43:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 01-01-2012 / 19:49:35 / kursjan <kursjan@fit.cvut.cz>"
! !
!stx_libjava_experiments class methodsFor:'documentation'!
extensionsVersion_SVN
^ '$Id:: $'
! !