exception tests fixes..
--- a/JavaExceptionTests.st Sun Nov 18 15:22:21 2012 +0000
+++ b/JavaExceptionTests.st Sun Nov 18 17:09:25 2012 +0000
@@ -65,13 +65,14 @@
"Created: / 30-03-2012 / 13:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+
!JavaExceptionTests methodsFor:'callbacks'!
-call: trhower with: aBoolean
-
- aBoolean ifTrue:[signal raise].
+call: trhower with: aBoolean
+ aBoolean ifTrue: [ signal raise ].
"Created: / 03-04-2012 / 17:33:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-11-2012 / 18:04:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
throw_me: aBoolean
@@ -150,26 +151,24 @@
test_01b
"
- Scenario (method activation stack, last called at bottom)
+ Scenario (method activation stack, last called at bottom)
1) ST method, handles IllegalArgumentException
- 2) Java method, does not IllegalArgumentException.
- "
-
- | thrower caught |
+ 2) Java method, does not IllegalArgumentException."
+
+ | thrower caught |
thrower := JAVA stx libjava tests lang ExceptionTests new.
- [
- thrower throw_me: false.
+ [
+ self halt. thrower throw_me: false.
caught := false.
-
- ] on: JAVA java lang IllegalArgumentException do: [:ex|
- caught := true.
- ].
-
+ ] on: JAVA java lang IllegalArgumentException do: [:ex | caught := true. ].
self assert: caught == false.
- self assert: (JavaVM enteredMonitorsOfProcess: Processor activeProcess) isEmptyOrNil.
- self assert: (JavaVM acquiredMonitorsOfProcess: Processor activeProcess) isEmptyOrNil.
+ self assert: (JavaVM enteredMonitorsOfProcess: Processor activeProcess)
+ isEmptyOrNil.
+ self assert: (JavaVM acquiredMonitorsOfProcess: Processor activeProcess)
+ isEmptyOrNil.
"Created: / 18-03-2012 / 21:49:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-11-2012 / 18:05:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
test_01c
@@ -250,53 +249,50 @@
test_03a
"
- Scenario (method activation stack, last called at bottom)
+ Scenario (method activation stack, last called at bottom)
1) ST method, handles IllegalArgumentException
2) Java method with finally
- 3) Java method, throws IllegalArgumentException.
- "
-
- | thrower caught |
+ 3) Java method, throws IllegalArgumentException."
+
+ | thrower caught |
thrower := JAVA stx libjava tests lang ExceptionTests new.
- [
+ [
thrower test_03: true.
caught := false.
-
- ] on: JAVA java lang IllegalArgumentException do: [:ex|
- caught := true.
- ].
-
+ ] on: JAVA java lang IllegalArgumentException do: [:ex | caught := true. ].
self assert: caught == true.
self assert: (thrower instVarNamed: #token) == 3.
- self assert: (JavaVM enteredMonitorsOfProcess: Processor activeProcess) isEmptyOrNil.
- self assert: (JavaVM acquiredMonitorsOfProcess: Processor activeProcess) isEmptyOrNil.
+ self assert: (JavaVM enteredMonitorsOfProcess: Processor activeProcess)
+ isEmptyOrNil.
+ self assert: (JavaVM acquiredMonitorsOfProcess: Processor activeProcess)
+ isEmptyOrNil.
"Created: / 03-04-2012 / 15:39:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 18-11-2012 / 16:50:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
test_04a
"
- Scenario (method activation stack, last called at bottom)
+ Scenario (method activation stack, last called at bottom)
1) ST method, handles 'signal'
2) Java method with finally
- 3) Smalltak method, throws 'signal'
- "
-
- | thrower caught |
+ 3) Smalltak method, throws 'signal'"
+
+ | thrower caught |
thrower := JAVA stx libjava tests lang ExceptionTests new.
- [
+ [
thrower test_04: self with: true.
- caught := false.
- ] on: signal do: [:ex|
- caught := true.
- ].
-
+ caught := false.
+ ] on: signal do: [:ex | caught := true. ].
self assert: caught == true.
self assert: (thrower instVarNamed: #token) == 3.
- self assert: (JavaVM enteredMonitorsOfProcess: Processor activeProcess) isEmptyOrNil.
- self assert: (JavaVM acquiredMonitorsOfProcess: Processor activeProcess) isEmptyOrNil.
+ self assert: (JavaVM enteredMonitorsOfProcess: Processor activeProcess)
+ isEmptyOrNil.
+ self assert: (JavaVM acquiredMonitorsOfProcess: Processor activeProcess)
+ isEmptyOrNil.
"Created: / 03-04-2012 / 17:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-11-2012 / 18:04:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaExceptionTests class methodsFor:'documentation'!
--- a/JavaLookup.st Sun Nov 18 15:22:21 2012 +0000
+++ b/JavaLookup.st Sun Nov 18 17:09:25 2012 +0000
@@ -306,71 +306,78 @@
!JavaLookup::Smalltalk2Java methodsFor:'lookup'!
-lookupMethodForSelector:selector directedTo:initialSearchClass for:receiver withArguments:argArrayOrNil from:sendingContext ilc: ilc
+lookupMethodForSelector: selector directedTo: initialSearchClass for: receiver withArguments: argArrayOrNil from: sendingContext ilc: ilc
"
- As a courtesy to a Smalltalker, try to map smalltalk selectors to a java ones.
- Returns JavaMethodDescriptor or nil.
- "
- | name nameSizePlusOne candidates finder static cls m |
-
+ As a courtesy to a Smalltalker, try to map smalltalk selectors to a java ones.
+ Returns JavaMethodDescriptor or nil."
+
+ | name nameSizePlusOne candidates finder static cls m |
+ self halt.
name := selector upTo: $:.
nameSizePlusOne := name size + 1.
static := receiver isBehavior.
candidates := OrderedCollection new.
- finder := [:cls|
- cls methodDictionary keysAndValuesDo:[:sel :mthd|
- "candidates may contain a method with same selector ->
- do not add super-class's method"
- (candidates contains:[:each|each selector == sel]) ifFalse:[
- (mthd mclass ~~ ProxyMethod
- and:[((sel size >= nameSizePlusOne) and:[(sel at: nameSizePlusOne) == $( and:[(sel startsWith: name)]])
- and:[mthd descriptor numArgs == argArrayOrNil size]]) ifTrue:[
- candidates add: mthd
- ]
+ finder := [
+ :cls |
+ cls methodDictionary
+ keysAndValuesDo: [
+ :sel :mthd |
+ "candidates may contain a method with same selector ->
+ do not add super-class's method"
+ (candidates contains: [:each | each selector == sel ]) ifFalse: [
+ (mthd mclass ~~ ProxyMethod
+ and: [
+ ((sel size >= nameSizePlusOne)
+ and: [ (sel at: nameSizePlusOne) == $( and: [ (sel startsWith: name) ] ])
+ and: [ mthd descriptor numArgs == argArrayOrNil size ]
+ ])
+ ifTrue: [ candidates add: mthd ]
+ ]
]
- ]
].
-
- "Search class for method candidates"
+ "Search class for method candidates"
cls := initialSearchClass theNonMetaclass.
- static ifTrue:[
- finder value: cls
- ] ifFalse:[
- [ cls notNil and:[cls ~~ JavaObject] ] whileTrue:[
+ static ifTrue: [ finder value: cls ] ifFalse: [
+ [ cls notNil and: [ cls ~~ JavaObject ] ] whileTrue: [
finder value: cls.
cls := cls superclass.
- ]
- ].
-
- candidates notEmpty ifTrue:[
- m := self compileProxyWithSelector: selector in: receiver class calling: candidates.
- ilc notNil ifTrue:[ilc bindTo: m forClass: receiver class].
-
- "Install the proxy"
- self addSelector: selector withMethod: m toClass: receiver class.
-
- ^m.
- ].
-
- "Hmm, hmm, maybe a public field?"
- (argArrayOrNil size < 2) ifTrue:[
- | field |
-
- field := initialSearchClass theNonMetaclass
- lookupFieldFor: name
- static: initialSearchClass isMetaclass
- onlyPublic: true.
- field notNil ifTrue:[
- m := self compileProxyWithSelector: selector in: receiver class accessing: field.
- ilc notNil ifTrue:[ilc bindTo: m forClass: receiver class].
-
- "Install the proxy"
- self addSelector: selector withMethod: m toClass: receiver class.
-
- ^m.
]
].
- ^nil
+ candidates notEmpty ifTrue: [
+ m := self
+ compileProxyWithSelector: selector
+ in: receiver class
+ calling: candidates.
+ ilc notNil ifTrue: [ ilc bindTo: m forClass: receiver class ].
+ "Install the proxy"
+ self
+ addSelector: selector
+ withMethod: m
+ toClass: receiver class.
+ ^ m.
+ ].
+ "Hmm, hmm, maybe a public field?"
+ (argArrayOrNil size < 2) ifTrue: [
+ | field |
+ field := initialSearchClass theNonMetaclass
+ lookupFieldFor: name
+ static: initialSearchClass isMetaclass
+ onlyPublic: true.
+ field notNil ifTrue: [
+ m := self
+ compileProxyWithSelector: selector
+ in: receiver class
+ accessing: field.
+ ilc notNil ifTrue: [ ilc bindTo: m forClass: receiver class ].
+ "Install the proxy"
+ self
+ addSelector: selector
+ withMethod: m
+ toClass: receiver class.
+ ^ m.
+ ]
+ ].
+ ^ nil
"Created: / 21-02-2011 / 13:38:55 / kursjan <kursjan@fit.cvut.cz>"
"Modified: / 29-08-2011 / 20:38:21 / kursjan"
@@ -380,6 +387,7 @@
"Modified: / 01-01-2012 / 19:58:59 / kursjan <kursjan@fit.cvut.cz>"
"Modified (comment): / 02-01-2012 / 10:35:25 / kursjan <kursjan@fit.cvut.cz>"
"Modified: / 17-03-2012 / 17:22:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-11-2012 / 18:08:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaLookup::Smalltalk2Java methodsFor:'lookup (old)'!
--- a/JavaMonitorsTests.st Sun Nov 18 15:22:21 2012 +0000
+++ b/JavaMonitorsTests.st Sun Nov 18 17:09:25 2012 +0000
@@ -562,4 +562,3 @@
version_SVN
^ '$Id$'
! !
-
--- a/libjava.rc Sun Nov 18 15:22:21 2012 +0000
+++ b/libjava.rc Sun Nov 18 17:09:25 2012 +0000
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\n SWING Research Group, Czech Technical University In Prague\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.1\0"
- VALUE "ProductDate", "Sun, 18 Nov 2012 15:24:55 GMT\0"
+ VALUE "ProductDate", "Sun, 18 Nov 2012 17:12:01 GMT\0"
END
END
--- a/stx_libjava.st Sun Nov 18 15:22:21 2012 +0000
+++ b/stx_libjava.st Sun Nov 18 17:09:25 2012 +0000
@@ -155,7 +155,7 @@
exclude individual packages in the #excludedFromPrerequisites method."
^ #(
- #'stx:goodies/sunit' "TestCase - superclass of JavaByteCodeProcessorTests "
+ #'stx:goodies/sunit' "TestCase - superclass of JavaLookupTests "
#'stx:libbasic' "Collection - superclass of JavaLocalVariableTable "
#'stx:libbasic2' "BitArray - superclass of extended BooleanArray "
#'stx:libbasic3' "MessageTracer - referenced by JavaMethod>>setBreakPoint "