Basic tests to JavaLookup jk_new_structure
authorkursjan
Mon, 29 Aug 2011 15:40:57 +0000
branchjk_new_structure
changeset 931 d32ca9769733
parent 930 f93aa207f0d4
child 932 7122121c9fa0
Basic tests to JavaLookup
JavaLookupTestsResource.st
LookupTests.st
extensions.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLookupTestsResource.st	Mon Aug 29 15:40:57 2011 +0000
@@ -0,0 +1,208 @@
+"
+ 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' }"
+
+TestResource subclass:#JavaLookupTestsResource
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Lookup-Tests'
+!
+
+JavaLookupTestsResource class instanceVariableNames:'projectDir projectBuilded'
+
+"
+ The following class instance variables are inherited by this class:
+
+	TestResource - current
+	TestAsserter - 
+	Object - 
+"
+!
+
+!JavaLookupTestsResource 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.
+
+"
+! !
+
+!JavaLookupTestsResource class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "/ please change as required (and remove this comment)
+
+    projectDir := 
+        (Smalltalk packageDirectoryForPackageId: 'stx:libjava') asFilename
+            / 'java' / 'libjava-projects/MethodLookupTests' .
+
+    projectBuilded := false.
+
+    "Modified: / 16-03-2011 / 14:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-04-2011 / 19:30:29 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!JavaLookupTestsResource class methodsFor:'accessing'!
+
+projectBuilded:aBoolean
+
+    "
+        JavaTestsResource projectBuilded: true.
+        JavaTestsResource projectBuilded: false.
+    "
+
+    projectBuilded := aBoolean.
+
+    "Modified: / 16-03-2011 / 15:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+projectDir
+    ^ projectDir
+! !
+
+!JavaLookupTestsResource class methodsFor:'running'!
+
+buildProject
+
+    "
+        JavaTestsResource projectBuilded: true.
+        JavaTestsResource projectBuilded: false.
+    "
+
+
+    projectBuilded == true ifFalse:[ 
+        "Check for ant"
+        self assert: (OperatingSystem canExecuteCommand:'ant')
+             description: 'Cannot execute ant'.
+
+        self assert: (self projectDir / 'build.xml') exists
+             description: 'No build.xml in ' , self projectDir asString.
+
+
+        "Launch ant"
+        Transcript show:'Running ant in '; showCR: self projectDir asString.
+        OperatingSystem
+                executeCommand:'ant -f build.xml' 
+                inputFrom:nil 
+                outputTo:Stdout 
+                errorTo:Stderr 
+                inDirectory: self projectDir
+                onError:
+                    [:status | 
+                    Transcript showCR:'ANT FAILED!!!!!!'.
+                    self error:'ant failed'.
+                    ^self].
+
+        Transcript show:'Ant finished'].
+    ^ projectBuilded
+
+    "Modified: / 16-03-2011 / 15:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLookupTestsResource methodsFor:'running'!
+
+setUp
+    self class buildProject.
+    Java addToClassPath: (self class projectDir / 'bin') asString.
+    JavaObject lookupObject: JavaLookup instance.
+
+    "Created: / 06-03-2011 / 14:50:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-03-2011 / 14:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-04-2011 / 20:15:15 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+tearDown
+    JavaObject lookupObject: nil
+
+    "Modified: / 16-03-2011 / 14:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 11-04-2011 / 20:15:28 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!JavaLookupTestsResource class methodsFor:'documentation'!
+
+version_SVN
+    ^ '$Id$'
+! !
+
+JavaLookupTestsResource initialize!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LookupTests.st	Mon Aug 29 15:40:57 2011 +0000
@@ -0,0 +1,150 @@
+"
+ 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' }"
+
+TestCase subclass:#LookupTests
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Lookup-Tests'
+!
+
+!LookupTests 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.
+
+"
+! !
+
+!LookupTests class methodsFor:'resources'!
+
+resources
+    ^ Array with: JavaLookupTestsResource.
+
+    "Created: / 11-04-2011 / 19:38:11 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!LookupTests methodsFor:'running'!
+
+test1
+    self shouldnt: [(Java classForName: 'java.lang.Object') new hash] raise: Exception.
+    self shouldnt: [(Java classForName: 'java.lang.Object') new toString] raise: Exception.
+
+    "Created: / 11-04-2011 / 19:22:07 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+test2
+    self assert: (Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') staticSayHello = 'static hello'.
+    self assert: (Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new sayHello = 'hello'.
+
+    "Created: / 11-04-2011 / 19:32:51 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+test3
+    "I am not sure with this test :)"
+    self shouldnt: [(Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new isNumber] raise: Exception.
+    self assert: (Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new isNumber = false.
+
+    "Created: / 11-04-2011 / 19:43:37 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+test4
+    "test multiple parameters"
+    self assert: ((Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new sayHello: 'Pepo' with: 10) = 'hello Pepo in age 10'.
+
+    "Created: / 11-04-2011 / 19:48:54 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+test5
+    "test type overloading"
+    self assert: ((Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new sayHello: 'Pepo' with: 10) = 'hello Pepo in age 10'.
+    self shouldnt: [(Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new sayHello: 'Pepo' with: 'Tyno'] raise: Exception.
+    self assert: ((Java classForName: 'cz.cvut.fit.swing.methodLookup.Object') new sayHello: 'Pepo' with: 'Tyno') = 'hello Pepo and Tyno'.
+
+    "Created: / 11-04-2011 / 20:02:54 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!LookupTests class methodsFor:'documentation'!
+
+version_SVN
+    ^ '$Id$'
+! !
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extensions.st	Mon Aug 29 15:40:57 2011 +0000
@@ -0,0 +1,881 @@
+"{ Package: 'stx:libjava' }"
+
+!
+
+!BooleanArray methodsFor:'queries'!
+
+isInterface
+
+    ^false
+
+    "Created: / 31-05-2011 / 16:07:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object methodsFor:'testing'!
+
+isJavaArray
+
+    ^self class isJavaArrayClass
+
+    "Created: / 19-12-2010 / 17:05:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object methodsFor:'testing'!
+
+isJavaNameAndType
+    "return true, if given object represents name and type struct in java constant pool"
+    
+    ^ false.
+
+    "Created: / 10-05-2011 / 12:21:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+!Object methodsFor:'testing'!
+
+isJavaPackage
+    "return true, if this is a java package.
+     false is returned here - the method is only redefined in JavaPackage."
+
+    ^ false
+
+    "Created: / 09-08-2011 / 09:35:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object methodsFor:'testing'!
+
+isJavaRef
+"return true, if given object represents reference in java constant pool"
+^ false.
+
+    "Created: / 08-04-2011 / 16:12:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+!Object methodsFor:'autoboxing support'!
+
+javaBox: anObject
+
+    ^anObject
+
+    "Created: / 15-08-2011 / 10:52:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object methodsFor:'autoboxing support'!
+
+javaUnbox: anObject
+
+    ^anObject
+
+    "Created: / 15-08-2011 / 10:52:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!String methodsFor:'converting'!
+
+asArrayOfSubstringsSeparatedBy:aSeparator 
+    "Modified version of asArrayOfSubstrings"
+    
+    |substrings start end|
+
+    substrings := OrderedCollection new.
+    start := 1.
+    [start <= self size] whileTrue:[
+        (self at:start) = aSeparator ifFalse:[
+            end := start + 1.
+            [
+                end <= self size and:[(self at:end) ~= aSeparator]
+            ] whileTrue:[end := end + 1].
+            substrings add:(self copyFrom:start to:end - 1).
+            start := end - 1
+        ].
+        start := start + 1
+    ].
+    ^ substrings asArray
+
+    "Created: / 07-02-2011 / 11:18:03 / Marcel Hlopko <hlopik@gmail.com>"
+    "Modified: / 08-02-2011 / 01:08:15 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+!UserPreferences methodsFor:'accessing-java-devel'!
+
+javaTestsDirectory
+    ^ self at: #javaTestsDirectory
+        ifAbsent: 
+            [ | nm |
+
+            nm := OperatingSystem getLoginName.
+             "Default path for Jan"
+            (nm = 'jv' and:[OperatingSystem isUNIXlike])
+                ifTrue: 
+                    [ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/tests' ]
+                ifFalse: 
+                    [ "Default path for Jan (the other one :-)"
+                    nm = 'jk' 
+                        ifTrue: [ 'path for Jan' ]
+                        ifFalse: 
+                            [ "Default path for Marcel"
+                            nm = 'm' 
+                                ifTrue: [ '/home/m/Projects/libjava/branches/jk_new_structure/tests' ]
+                                ifFalse: 
+                                    [ | "Look into package dir" p |
+
+                                    (p := (Smalltalk getPackageDirectoryForPackage: 'stx:libjava') asFilename 
+                                                / 'tests') exists 
+                                        ifTrue: [ p pathName ]
+                                        ifFalse: 
+                                            [ | "Try the environment variable (used by Hudson)" p |
+
+                                            (p := OperatingSystem getEnvironment: 'LIBJAVA_TESTS') notNil 
+                                                ifTrue: [ p ]
+                                                ifFalse: 
+                                                    [ "No default, trigger an error"
+                                                    self error: 'No tests path specified' ] ] ] ] ] ]
+
+    "
+        UserPreferences current javaTestsDirectory"
+
+    "Created: / 07-05-2011 / 17:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-05-2011 / 20:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-05-2011 / 15:54:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+!UserPreferences methodsFor:'accessing-java-devel'!
+
+javaTestsDirectory: aStringOrFilename
+
+    self at:#javaTestsDirectory put: aStringOrFilename asString.
+
+    "Created: / 07-05-2011 / 17:45:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ZipArchive methodsFor:'reading - java support'!
+
+nextBytes: bytesToRead of: zmember startingAt: pos into: b startingAt: off
+
+    file position0Based: zmember fileStart + startOfArchive + pos.
+    ^ file nextBytes: bytesToRead into: b startingAt: off.
+
+    "Created: / 01-05-2011 / 16:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Boolean class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^true
+
+    "Created: / 25-02-2011 / 08:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Boolean class methodsFor:'queries'!
+
+javaArrayClass
+    ^ BooleanArray
+
+    "Created: / 25-02-2011 / 08:27:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Boolean class methodsFor:'autoboxing support'!
+
+javaBox:anObject 
+
+    | wrapper |
+
+    wrapper := (Java classForName: 'java.lang.Boolean') new.
+    wrapper perform: #'<init>(Z)V' with: anObject.
+    ^wrapper
+
+    "Created: / 14-08-2011 / 22:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Boolean class methodsFor:'accessing'!
+
+javaName
+
+    ^'boolean'.
+
+    "Modified: / 25-02-2011 / 18:58:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!BooleanArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!BooleanArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 20-12-2010 / 22:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!BooleanArray class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    "Java arrays are reference types"
+    ^true
+
+    "Created: / 20-12-2010 / 22:30:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!BooleanArray class methodsFor:'accessing-java'!
+
+javaComponentClass
+
+    ^Boolean
+
+    "Created: / 20-12-2010 / 22:13:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!BooleanArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'[X'.
+
+    "Modified: / 25-02-2011 / 19:03:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ByteArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!ByteArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 05-02-2011 / 22:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ByteArray class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    "Java arrays are reference types"
+    ^true
+
+    "Created: / 20-12-2010 / 22:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ByteArray class methodsFor:'accessing-java'!
+
+javaArrayClass
+
+    ^JavaArray javaArrayClassFor: self
+
+    "Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ByteArray class methodsFor:'accessing-java'!
+
+javaComponentClass
+
+    ^Byte
+
+    "Created: / 20-12-2010 / 22:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ByteArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'[B'.
+
+    "Modified: / 25-02-2011 / 19:02:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Character class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^true
+
+    "Created: / 20-12-2010 / 22:18:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Character class methodsFor:'accessing'!
+
+javaArrayClass
+    ^ String
+
+    "Created: / 11-02-2011 / 10:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Character class methodsFor:'autoboxing support'!
+
+javaBox:anObject 
+
+| wrapper |
+
+wrapper := (Java classForName: 'java.lang.Character') new.
+wrapper perform: #'<init>(C)V' with: anObject.
+^wrapper
+
+    "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Character class methodsFor:'accessing'!
+
+javaName
+
+    ^'char'.
+
+    "Modified: / 25-02-2011 / 18:58:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!CharacterArray class methodsFor:'encoding & decoding'!
+
+decodeFromJavaUTF8: bytes 
+    "Decodes a string from modified UTF8 encoding
+     as used in Java .class files. see
+     'The class file format specification', section 4.5.7"
+    
+    | string  i  s  b  codePoint  realLength |
+
+    string := String new: bytes size.
+    realLength := bytes size.
+    s := bytes readStream.
+    i := 1.
+    [ s atEnd ] whileFalse: 
+            [ b := s next.
+            (b & 2r10000000) == 0 
+                ifTrue: [ codePoint := b ]
+                ifFalse: 
+                    [ self assert: (b & 2r01000000) = 2r01000000.
+                    (b & 2r00100000) = 0 
+                        ifTrue: 
+                            [ "two byte utf char"
+                            realLength := realLength - 1.
+                            self assert: s size > 0.
+                            self assert: (b & 2r01000000) = 2r01000000.
+                            string bitsPerCharacter = 8 
+                                ifTrue: [ string := Unicode16String fromString: string ].
+                            codePoint := (b & 2r00011111) << 6.
+                            b := s next.
+                            self assert: (b & 2r11000000) = 2r10000000.
+                            codePoint := codePoint + (b & 2r00111111). ]
+                        ifFalse: 
+                            [ "at lease 3 byte utf char"
+                            realLength := realLength - 2.
+                            string bitsPerCharacter ~= 16"was: 32" 
+                                ifTrue: [ string := Unicode16String"was: Unicode32String" fromString: string ].
+                            self assert: s size > 1.
+                            (b & 2r00010000) = 0 
+                                ifTrue: 
+                                    [ | utf32Possible  utf32Value |
+
+                                    "3 or 6 byte utf char"
+                                    self assert: s size > 1.
+                                    s size < 5 
+                                        ifTrue: [ utf32Possible := false ]
+                                        ifFalse: [ utf32Possible := true ].
+                                    b ~= 2r11101101 ifTrue: [ utf32Possible := false ].
+                                    codePoint := (b & 2r00001111) << 12.
+                                    b := s next.
+                                    self assert: (b & 2r11000000) = 2r10000000.
+                                    ((b & 2r11110000) = 2r10100000 and: [ utf32Possible ]) 
+                                        ifTrue: [ utf32Value := 2r00010000 + ((b & 2r00001111) << 16) ]
+                                        ifFalse: [ utf32Possible := false ].
+                                    codePoint := codePoint + ((b & 2r00111111) << 6).
+                                    b := s next.
+                                    self assert: (b & 2r11000000) = 2r10000000.
+                                    utf32Possible 
+                                        ifTrue: [ utf32Value := utf32Value + ((b & 2r00111111) << 10) ].
+                                    codePoint := codePoint + (b & 2r00111111).
+                                    utf32Possible 
+                                        ifTrue: 
+                                            [ | tmpB |
+
+                                            tmpB := s copy.
+                                            b := tmpB next.
+                                            b = 2r11101101 
+                                                ifTrue: 
+                                                    [ b := tmpB next.
+                                                    (b & 2r11110000) = 2r10110000 
+                                                        ifTrue: 
+                                                            [ utf32Value := utf32Value + ((b & 2r00001111) << 6).
+                                                            b := tmpB next.
+                                                            self assert: (b & 2r11000000) = 2r10000000.
+                                                            utf32Value := utf32Value + (b & 2r00111111).
+                                                            codePoint := utf32Value.
+                                                            realLength := realLength - 3. s position: tmpB position.] ] ] ]
+                                ifFalse: 
+                                    [ "should not happen, ask mh"
+                                    self halt. ] ] ].
+            string at: i put: (Character codePoint: codePoint).
+            i := i + 1. ].
+    ^ string subString: 1 to: realLength.
+
+    "
+        String decodeFromJavaUTF8: 'Hello world' asByteArray"
+
+    "Created: / 22-12-2010 / 23:45:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-02-2011 / 01:12:25 / Marcel Hlopko <hlopik@gmail.com>"
+    "Modified: / 13-03-2011 / 15:52:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 10-08-2011 / 01:00:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!CharacterArray class methodsFor:'instance creation'!
+
+fromJavaUTF8Bytes:aByteCollection
+    "return a new string which represents the characters as decoded
+     from the modified utf8 encoded bytes as specified in 
+     The class file format specification, section 4.5.7"
+
+    ^ self decodeFromJavaUTF8:aByteCollection.
+
+    "
+     CharacterArray fromUTF8Bytes:#[ 16r41 16r42 ]
+     CharacterArray fromUTF8Bytes:#[ 16rC1 16r02 ]
+     CharacterArray fromUTF8Bytes:#[ 16rE0 16r81 16r02 ]
+     CharacterArray fromUTF8Bytes:#[ 16rEF 16rBF 16rBF ]
+
+   rfc2279 examples:
+     CharacterArray fromUTF8Bytes:#[ 16r41 16rE2 16r89 16rA2 16rCE 16r91 16r2E ]
+     CharacterArray fromUTF8Bytes:#[ 16rED 16r95 16r9C 16rEA 16rB5 16rAD 16rEC 16r96 16rB4 ]
+     CharacterArray fromUTF8Bytes:#[ 16rE6 16r97 16rA5 16rE6 16r9C 16rAC 16rE8 16rAA 16r9E ]
+
+   invalid:
+     CharacterArray fromUTF8Bytes:#[ 16rC0 16r80 ]
+     CharacterArray fromUTF8Bytes:#[ 16rE0 16r80 16r80 ]
+    "
+
+    "Created: / 23-12-2010 / 09:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!CharacterArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 05-02-2011 / 22:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!CharacterArray class methodsFor:'accessing-java'!
+
+javaArrayClass
+
+    ^JavaArray javaArrayClassFor: Unicode16String
+
+    "Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-08-2011 / 13:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!CharacterArray class methodsFor:'accessing-java'!
+
+javaComponentClass
+
+    ^Character
+
+    "Created: / 20-12-2010 / 22:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!DoubleArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!DoubleArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 20-12-2010 / 22:47:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!DoubleArray class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    "Java arrays are reference types"
+    ^true
+
+    "Created: / 20-12-2010 / 22:30:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!DoubleArray class methodsFor:'accessing-java'!
+
+javaComponentClass
+
+    ^Float
+
+    "Created: / 20-12-2010 / 22:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!DoubleArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'[D'.
+
+    "Modified: / 25-02-2011 / 19:03:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Float class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^true
+
+    "Created: / 06-02-2011 / 17:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Float class methodsFor:'accessing'!
+
+javaArrayClass
+    ^ DoubleArray
+
+    "Created: / 11-02-2011 / 10:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Float class methodsFor:'autoboxing support'!
+
+javaBox:anObject 
+
+    | wrapper |
+
+    wrapper := (Java classForName: 'java.lang.Double') new.
+    wrapper perform: #'<init>(D)V' with: anObject.
+    ^wrapper
+
+    "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Float class methodsFor:'accessing'!
+
+javaName
+
+    ^'double'.
+
+    "Modified: / 25-02-2011 / 18:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!FloatArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!FloatArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 20-12-2010 / 22:47:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!FloatArray class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    "Java arrays are reference types"
+    ^true
+
+    "Created: / 20-12-2010 / 22:30:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!FloatArray class methodsFor:'accessing-java'!
+
+javaComponentClass
+
+    ^ShortFloat
+
+    "Created: / 20-12-2010 / 22:06:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!FloatArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'[F'.
+
+    "Modified: / 25-02-2011 / 19:03:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!GenericToolbarIconLibrary class methodsFor:'image specs'!
+
+javaClassBrowserIcon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self javaClassBrowserIcon inspect
+     ImageEditor openOnClass:self andSelector:#javaClassBrowserIcon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'GenericToolbarIconLibrary class javaClassBrowserIcon'
+        ifAbsentPut:[(Depth24Image new) width: 13; height: 11; photometric:(#rgb); bitsPerSample:(#[8 8 8]); samplesPerPixel:(3); bits:(ByteArray fromPackedString:'
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@96<@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@96<@96<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@\CA0LG@0\CA0LG@0\CA0\GA \@A0@a') ; yourself); yourself]
+! !
+!Integer class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^true
+
+    "Created: / 11-02-2011 / 11:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Integer class methodsFor:'accessing'!
+
+javaArrayClass
+    ^ SignedIntegerArray
+
+    "Created: / 11-02-2011 / 10:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Integer class methodsFor:'autoboxing support'!
+
+javaBox:anObject 
+
+    | wrapper |
+
+    wrapper := (Java classForName: 'java.lang.Integer') new.
+    wrapper perform: #'<init>(I)V' with: anObject.
+    ^wrapper
+
+    "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Integer class methodsFor:'accessing'!
+
+javaName
+
+    ^'int'.
+
+    "Modified: / 25-02-2011 / 18:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!LargeInteger class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^true
+
+    "Created: / 04-02-2011 / 11:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!LargeInteger class methodsFor:'accessing'!
+
+javaArrayClass
+    ^ SignedLongIntegerArray
+
+    "Created: / 11-02-2011 / 10:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!LargeInteger class methodsFor:'autoboxing support'!
+
+javaBox:anObject 
+
+    | wrapper |
+
+    wrapper := (Java classForName: 'java.lang.Long') new.
+    wrapper perform: #'<init>(J)V' with: anObject.
+    ^wrapper
+
+    "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!LargeInteger class methodsFor:'accessing'!
+
+javaName
+
+    ^'long'.
+
+    "Modified: / 25-02-2011 / 18:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^false
+
+    "Created: / 19-12-2010 / 17:05:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object class methodsFor:'queries'!
+
+isJavaClassType
+
+    ^false
+
+    "Created: / 11-02-2011 / 08:08:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^false
+
+    "Created: / 20-12-2010 / 21:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    ^false
+
+    "Created: / 20-12-2010 / 21:52:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!Object class methodsFor:'queries'!
+
+isJavaType
+
+    ^false
+
+    "Created: / 20-12-2010 / 21:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ShortFloat class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    ^true
+
+    "Created: / 06-02-2011 / 17:21:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ShortFloat class methodsFor:'accessing'!
+
+javaArrayClass
+    ^ FloatArray
+
+    "Created: / 11-02-2011 / 10:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ShortFloat class methodsFor:'autoboxing support'!
+
+javaBox:anObject 
+
+    | wrapper |
+
+    wrapper := (Java classForName: 'java.lang.Float') new.
+    wrapper perform: #'<init>(F)V' with: anObject.
+    ^wrapper
+
+    "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!ShortFloat class methodsFor:'accessing'!
+
+javaName
+
+    ^'float'.
+
+    "Modified: / 25-02-2011 / 18:59:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedIntegerArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!SignedIntegerArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 06-02-2011 / 15:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedIntegerArray class methodsFor:'accessing-java'!
+
+javaArrayClass
+
+    ^JavaArray javaArrayClassFor: SignedIntegerArray
+
+    "Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-08-2011 / 22:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedIntegerArray class methodsFor:'accessing'!
+
+javaComponentClass
+
+    ^ Integer
+
+    "Created: / 25-06-2011 / 08:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedIntegerArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'[I'.
+
+    "Modified: / 25-02-2011 / 19:03:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedLongIntegerArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!SignedLongIntegerArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 20-12-2010 / 22:47:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedLongIntegerArray class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    "Java arrays are reference types"
+    ^true
+
+    "Created: / 20-12-2010 / 22:30:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedLongIntegerArray class methodsFor:'accessing-java'!
+
+javaArrayClass
+
+    ^JavaArray javaArrayClassFor: SignedLongIntegerArray
+
+    "Modified: / 10-08-2011 / 22:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 26-08-2011 / 18:29:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedLongIntegerArray class methodsFor:'accessing'!
+
+javaComponentClass
+
+    ^LargeInteger
+
+    "Modified: / 25-06-2011 / 08:38:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!SignedLongIntegerArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'[J'.
+
+    "Modified: / 25-02-2011 / 19:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!UndefinedObject class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+    "void"
+
+    ^true
+
+    "Created: / 21-12-2010 / 22:52:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!UndefinedObject class methodsFor:'accessing'!
+
+javaName
+
+    ^'void'.
+
+    "Modified: / 25-02-2011 / 18:59:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!WordArray class methodsFor:'testing'!
+
+isInterface
+
+    ^false
+! !
+!WordArray class methodsFor:'queries'!
+
+isJavaArrayClass
+
+    ^true
+
+    "Created: / 20-12-2010 / 22:47:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!WordArray class methodsFor:'queries'!
+
+isJavaReferenceType
+
+    "Java arrays are reference types"
+    ^true
+
+    "Created: / 20-12-2010 / 22:30:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!WordArray class methodsFor:'accessing-java'!
+
+javaArrayClass
+
+    ^JavaArray javaArrayClassFor: WordArray
+
+    "Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-08-2011 / 22:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!WordArray class methodsFor:'accessing-java'!
+
+javaComponentClass
+
+    ^Short
+
+    "Created: / 20-12-2010 / 22:13:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!WordArray class methodsFor:'accessing'!
+
+javaName
+
+    ^'['.
+! !